diff options
author | Dan McGee <dan@archlinux.org> | 2011-04-29 18:21:43 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-04-29 18:21:43 -0500 |
commit | 5379348c9337a4abe27e807fef7956e11eebed30 (patch) | |
tree | d85b6e3168fff72a2d179d1f4a064097e54cdef5 /devel/views.py | |
parent | e58eb76a1ab4d6f1293b717e21da68f5aa3e5c45 (diff) |
Add unneeded orphans report
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel/views.py')
-rw-r--r-- | devel/views.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/devel/views.py b/devel/views.py index a013b329..6907de24 100644 --- a/devel/views.py +++ b/devel/views.py @@ -13,7 +13,7 @@ from django.template import loader, Context from django.views.decorators.cache import never_cache from django.views.generic.simple import direct_to_template -from main.models import Package, PackageFile, TodolistPkg +from main.models import Package, PackageDepend, PackageFile, TodolistPkg from main.models import Arch, Repo from main.models import UserProfile from packages.models import PackageRelation @@ -156,6 +156,13 @@ def report(request, report): filename__endswith='.info').values_list( 'pkg_id', flat=True).distinct() packages = packages.filter(id__in=set(bad_files)) + elif report == 'unneeded-orphans': + title = 'Orphan packages required by no other packages' + owned = PackageRelation.objects.all().values('pkgbase') + required = PackageDepend.objects.all().values('depname') + # The two separate calls to exclude is required to do the right thing + packages = packages.exclude(pkgbase__in=owned).exclude( + pkgname__in=required) else: raise Http404 |