summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-04-29 18:21:43 -0500
committerDan McGee <dan@archlinux.org>2011-04-29 18:21:43 -0500
commit5379348c9337a4abe27e807fef7956e11eebed30 (patch)
treed85b6e3168fff72a2d179d1f4a064097e54cdef5
parente58eb76a1ab4d6f1293b717e21da68f5aa3e5c45 (diff)
Add unneeded orphans report
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--devel/views.py9
-rw-r--r--templates/devel/index.html3
-rw-r--r--templates/devel/packages.html1
3 files changed, 12 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
diff --git a/templates/devel/index.html b/templates/devel/index.html
index 8bf8c910..29b98bdf 100644
--- a/templates/devel/index.html
+++ b/templates/devel/index.html
@@ -104,6 +104,9 @@
<li><a href="reports/old/">Old</a>: Packages last built more than two years ago</li>
<li><a href="reports/uncompressed-man/">Uncompressed Manpages</a>: Self-explanatory</li>
<li><a href="reports/uncompressed-info/">Uncompressed Info Pages</a>: Self-explanatory</li>
+ <li><a href="reports/unneeded-orphans/">Unneeded Orphans</a>: Packages
+ that have no maintainer and are not required by any other package in
+ any repository</li>
</ul>
</div><!-- #dev-dashboard -->
diff --git a/templates/devel/packages.html b/templates/devel/packages.html
index 3b511c98..32cdf217 100644
--- a/templates/devel/packages.html
+++ b/templates/devel/packages.html
@@ -6,6 +6,7 @@
{% block content %}
<div class="box">
<h2>{{ title }}</h2>
+ <p>{{ packages|length }} package{{ packages|pluralize }} found.</p>
<table class="results">
<thead>
<tr>