Skip to content

Commit

Permalink
Add unneeded orphans report
Browse files Browse the repository at this point in the history
Signed-off-by: Dan McGee <dan@archlinux.org>
  • Loading branch information
toofishes committed Apr 29, 2011
1 parent e58eb76 commit 5379348
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion devel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions templates/devel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ <h3>Developer Reports</h3>
<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 -->
Expand Down
1 change: 1 addition & 0 deletions templates/devel/packages.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 5379348

Please sign in to comment.