summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-02-22 13:48:52 -0600
committerDan McGee <dan@archlinux.org>2014-02-22 13:57:02 -0600
commit871b284dd76f01d8a297f43ae86d869e2b7d2b3c (patch)
tree83567b5758c9e89b6f1dc18c4739f73b6e7f32cc
parent7947d36c4e509a917941a34c576fde3a207a4439 (diff)
Generate list of reports dynamically
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--devel/reports.py15
-rw-r--r--devel/views.py3
-rw-r--r--templates/devel/index.html30
3 files changed, 17 insertions, 31 deletions
diff --git a/devel/reports.py b/devel/reports.py
index f1ffab3f..53cf9e69 100644
--- a/devel/reports.py
+++ b/devel/reports.py
@@ -11,13 +11,14 @@ from packages.models import PackageRelation, Depend
class DeveloperReport(object):
def __init__(self, slug, name, desc, packages_func,
- names=None, attrs=None):
+ names=None, attrs=None, personal=True):
self.slug = slug
self.name = name
self.description = desc
self.packages = packages_func
self.names = names
self.attrs = attrs
+ self.personal = personal
def old(packages, username):
@@ -143,7 +144,7 @@ REPORT_BIG = DeveloperReport('big', 'Big',
['compressed_size_pretty', 'installed_size_pretty'])
REPORT_BADCOMPRESS = DeveloperReport('badcompression', 'Bad Compression',
- 'Packages that have little need for compression', badcompression,
+ 'Packages with a compression ratio of less than 10%', badcompression,
['Compressed Size', 'Installed Size', 'Ratio', 'Type'],
['compressed_size_pretty', 'installed_size_pretty','ratio', 'compress_type'])
@@ -152,13 +153,17 @@ REPORT_MAN = DeveloperReport('uncompressed-man', 'Uncompressed Manpages',
'Packages with uncompressed manpages', uncompressed_man)
REPORT_INFO = DeveloperReport('uncompressed-info', 'Uncompressed Info Pages',
- 'Packages with uncompressed infopages', uncompressed_info)
+ 'Packages with uncompressed info pages', uncompressed_info)
REPORT_ORPHANS = DeveloperReport('unneeded-orphans', 'Unneeded Orphans',
- 'Orphan packages required by no other packages', unneeded_orphans)
+ 'Packages that have no maintainer and are not required by any '
+ + 'other package in any repository', unneeded_orphans,
+ personal=False)
REPORT_SIGNATURE = DeveloperReport('mismatched-signature', 'Mismatched Signatures',
- 'Packages with mismatched signatures', mismatched_signature,
+ 'Packages where 1) signing key is unknown, 2) signer != packager, '
+ + 'or 3) signature timestamp more than 24 hours after build timestamp',
+ mismatched_signature,
['Signature Date', 'Signed By', 'Packager'],
['sig_date', 'sig_by', 'packager'])
diff --git a/devel/views.py b/devel/views.py
index cd2e25f8..c53da668 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -57,7 +57,8 @@ def index(request):
'todos': todolists,
'flagged': flagged,
'todopkgs': todopkgs,
- 'signoffs': signoffs
+ 'signoffs': signoffs,
+ 'reports': available_reports(),
}
return render(request, 'devel/index.html', page_dict)
diff --git a/templates/devel/index.html b/templates/devel/index.html
index f432e6b9..147917a0 100644
--- a/templates/devel/index.html
+++ b/templates/devel/index.html
@@ -149,31 +149,11 @@
<h3>Developer Reports</h3>
<ul>
- <li><a href="reports/old/">Old</a>:
- Packages last built more than two years ago
- (<a href="reports/old/{{ user.username }}/">yours only</a>)</li>
- <li><a href="reports/long-out-of-date/">Long Out-of-date</a>:
- Packages marked out-of-date more than 30 days ago
- (<a href="reports/long-out-of-date/{{ user.username }}/">yours only</a>)</li>
- <li><a href="reports/uncompressed-man/">Uncompressed Manpages</a>:
- Self-explanatory
- (<a href="reports/uncompressed-man/{{ user.username }}/">yours only</a>)</li>
- <li><a href="reports/uncompressed-info/">Uncompressed Info Pages</a>:
- Self-explanatory
- (<a href="reports/uncompressed-info/{{ user.username }}/">yours only</a>)</li>
- <li><a href="reports/mismatched-signature/">Mismatched Signatures</a>:
- Packages where 1) signing key is unknown, 2) signer != packager,
- or 3) signature timestamp more than 24 hours after build timestamp
- (<a href="reports/mismatched-signature/{{ user.username }}/">yours only</a>)</li>
- <li><a href="reports/big/">Big</a>:
- All packages with compressed size &gt; 50 MiB
- (<a href="reports/big/{{ user.username }}/">yours only</a>)</li>
- <li><a href="reports/badcompression/">Bad Compression</a>:
- Packages with a compression ratio of less than 10%
- (<a href="reports/badcompression/{{ user.username }}/">yours only</a>)</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>
+ {% for report in reports %}
+ <li><a href="reports/{{ report.slug }}/">{{ report.name }}</a>:
+ {{ report.description }}
+ {% if report.personal %}(<a href="reports/{{ report.slug }}/{{ user.username }}/">yours only</a>){% endif %}</li>
+ {% endfor %}
</ul>
</div>{# #dev-dashboard #}