mirror of
https://git.yoctoproject.org/poky
synced 2026-04-18 12:32:12 +02:00
bitbake: toaster: replace package dependency tag w/ view queries
This patch moves the queries for package dependencies from the project tags to the views. This is done to bring the code inline with the Django philosophy of making all data queries in views.py This change has no performance implication. (Bitbake rev: 9dd53bd4355148916a89cf672b6c5db5f6b1ae35) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
70f1a3db5e
commit
478f1b7afe
@@ -79,7 +79,7 @@
|
||||
{{package.license}}
|
||||
</td>
|
||||
<td class="depends">
|
||||
{% with deps=package|runtime_dependencies:target.id %}
|
||||
{% with deps=package.runtime_dependencies %}
|
||||
{% with deps_count=deps|length %}
|
||||
{% if deps_count > 0 %}
|
||||
<a class="btn"
|
||||
@@ -96,7 +96,7 @@
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td class="brought_in_by">
|
||||
{% with rdeps=package|reverse_runtime_dependencies:target.id %}
|
||||
{% with rdeps=package.reverse_runtime_dependencies %}
|
||||
{% with rdeps_count=rdeps|length %}
|
||||
{% if rdeps_count > 0 %}
|
||||
<a class="btn"
|
||||
|
||||
@@ -217,20 +217,6 @@ def filtered_packageversion(version, revision):
|
||||
"""
|
||||
return "" if (not version or version == "") else version if (not revision or revision == "") else version + "-" + revision
|
||||
|
||||
from django.db import models
|
||||
from orm.models import Package
|
||||
@register.filter
|
||||
def runtime_dependencies(package_object, targetid):
|
||||
""" Return a queryset that lists the packages this package depends on
|
||||
"""
|
||||
return package_object.package_dependencies_source.filter(target_id__exact=targetid, dep_type__in={'1'})
|
||||
|
||||
@register.filter
|
||||
def reverse_runtime_dependencies(package_object, targetid):
|
||||
""" Return a queryset that lists the packages depending on this package
|
||||
"""
|
||||
return package_object.package_dependencies_target.filter(target_id__exact = targetid,dep_type__in={'1'})
|
||||
|
||||
@register.filter
|
||||
def filter_sizeovertotal(package_object, total_size):
|
||||
""" Return the % size of the package over the total size argument
|
||||
|
||||
@@ -429,6 +429,12 @@ def target(request, build_id, target_id):
|
||||
packages_sum = queryset.aggregate(Sum('installed_size'))
|
||||
queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string)
|
||||
packages = _build_page_range(Paginator(queryset, request.GET.get('count', 25)),request.GET.get('page', 1))
|
||||
|
||||
# bring in package dependencies
|
||||
for p in packages.object_list:
|
||||
p.runtime_dependencies = p.package_dependencies_source.filter(target_id = target_id, dep_type=Package_Dependency.TYPE_TRDEPENDS)
|
||||
p.reverse_runtime_dependencies = p.package_dependencies_target.filter(target_id = target_id, dep_type=Package_Dependency.TYPE_TRDEPENDS)
|
||||
|
||||
context = { 'build': Build.objects.filter(pk=build_id)[0],
|
||||
'target': Target.objects.filter(pk=target_id)[0],
|
||||
'objects': packages,
|
||||
|
||||
Reference in New Issue
Block a user