[Toaster] [review-request] [Patch 1/1] toaster: add rev dep column to image detail pages
Dave Lerner
dave.lerner at windriver.com
Wed Mar 23 15:18:32 PDT 2016
Add a column to the custom image pages that shows the reverse
dependencies in a format matching the dependency column:
- either blank or a button showing the count of reverse dependencies,
- when the button is clicked, a popover appears showing the list
of reverse dependencies, with each packages' size, and the total
size.
The implementation adds a packages table method to retreive the reverse
dependency total size, and adds a separate 'popover' html template. Both
of these changes follow the pattern for the dependency column.
Signed-off-by: Dave Lerner <dave.lerner at windriver.com>
---
bitbake/lib/toaster/orm/models.py | 7 +++++++
bitbake/lib/toaster/toastergui/tables.py | 6 ++++++
.../templates/snippets/pkg_revdependencies_popover.html | 15 +++++++++++++++
3 files changed, 28 insertions(+)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 6ae6316..cfab7b7 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -813,6 +813,13 @@ class Package_DependencyManager(models.Manager):
"""
return self.all().aggregate(Sum('depends_on__size'))
+ def get_total_revdeps_size(self):
+ """ Returns the total file size of all the packages that depend on
+ this package.
+ """
+ return self.all().aggregate(Sum('package_id__size'))
+
+
def all_depends(self):
""" Returns just the depends packages and not any other dep_type """
return self.filter(Q(dep_type=Package_Dependency.TYPE_RDEPENDS) |
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index 67a6592..c677ec5 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -725,6 +725,12 @@ class PackagesTable(ToasterTable):
static_data_template='\
{% include "snippets/pkg_dependencies_popover.html" %}')
+ self.add_column(title="Reverse dependencies",
+ static_data_name="reverse_dependencies",
+ static_data_template='\
+ {% include "snippets/pkg_revdependencies_popover.html" %}',
+ hidden=True)
+
self.add_column(title="Recipe",
field_name="recipe__name",
orderable=True,
diff --git a/bitbake/lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html b/bitbake/lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html
new file mode 100644
index 0000000..e64f4c6
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html
@@ -0,0 +1,15 @@
+{# Popover that displays the dependences and sizes of a package 'data' used in the Packages table #}
+{% with data.package_dependencies_target.all_depends.count as dep_count %}
+{% load projecttags %}
+{% if dep_count %}
+ <a data-content="<ul class='unstyled'>
+ {% for dep in data.package_dependencies_target.all_depends|dictsort:'package.name' %}
+ <li>{{dep.package.name}} {% if dep.package.size > 0 %}({{dep.package.size|filtered_filesizeformat}}){% endif %}</li>
+ {% endfor %}
+ </ul>" title="" class="btn" data-original-title="
+ <strong>{{data.name}}</strong> reverse dependencies - <strong>{{data.package_dependencies_target.get_total_revdeps_size.package_id__size__sum|filtered_filesizeformat}}</strong>">
+ {{dep_count}}
+</a>
+{% endif %}
+{% endwith %}
+
--
2.7.4
More information about the toaster
mailing list