toaster: add rev dep column to image detail pages
Poky Contrib Branch:
Target Branches: toaster-next master
Defect:
Summary: toaster: add rev dep column to image detail pages
Commit
------
f3f10b8 toaster: add rev dep column to image detail pages
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(+)
Tests
-----
create myproject
New Custom Image
name it myminimal,
base it on core-image-minimal
build it
All Projects| Custom Images| myminimal
verfiy that "Reverse dependencies" column does NOT appear verify that "Reverse dependencies" column can be added
Enable "Reverse dependencies" column
verify that some of the packages show a button in the reverse
dependency column similar to dependencies containing the number of reverse dependencies.
Enter glibc on the customise image screen
Click on the count button in Rev Dep column
verify a pop-up appears saying
glibc reverse dependencies - 2.5 MB
with a list of 9 packages, adding up to 2.5 MB in size
busybox, eudev, libkmod, sysvinit, sysvinit-pidof, util-linux-libblkid, util-linux-libuuid, v86d, zlib
All Builds | myminimal | Packages
Enter glibc | click on glibc | Reverse Runtime dependencies
Verify names, count, sizes match the custom image page results above.
All Projects | Custom images | myminimal
In the About myminimal panel, click core-image-minimal Build it as requested
Now repeat...
All Projects | Custom images | myminimal
In the About myminimal panel, click core-image-minimal
Verify that Reverse Dependencies does NOT appear
Click Edit columns | check Reverse dependencies
Verify Reverse Depencency column appears
Enter glibc | click on the Rev. Dep. column
Verify count, names, size are as shown on the Add | Remove page
END TESTS
PATCH 1/1 toaster: add rev dep column to image detail pages
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.
--- 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(+)
bitbake/lib/toaster/orm/models.py +7 -0
@@ -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) |
bitbake/lib/toaster/toastergui/tables.py +6 -0
@@ -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,
bitbake/lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html new file +15 -0
@@ -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 %} +
Signature · 1 line
2.7.4