summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-28 00:12:45 -0500
committerDan McGee <dan@archlinux.org>2011-06-28 00:12:45 -0500
commitd3f1763efefef9ff5095a49b075b27b38df83d16 (patch)
tree4a5c09bca9a219187bd9fc79bdee42f85281696b
parentf913bbcab4dc458d1566778a094bdd337cb91841 (diff)
Add a bad compression ratio report
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--devel/views.py19
-rw-r--r--templates/devel/index.html3
2 files changed, 21 insertions, 1 deletions
diff --git a/devel/views.py b/devel/views.py
index 4399b73f..79eef318 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -6,7 +6,7 @@ from django.contrib.auth.models import User, Group
from django.contrib.sites.models import Site
from django.core.mail import send_mail
from django.db import transaction
-from django.db.models import Q
+from django.db.models import F, Q
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.template import loader, Context
@@ -163,6 +163,23 @@ def report(request, report, username=None):
package.compressed_size)
package.installed_size_pretty = filesizeformat(
package.installed_size)
+ elif report == 'badcompression':
+ title = 'Packages that have little need for compression'
+ cutoff = 0.90 * F('installed_size')
+ packages = packages.filter(compressed_size__gt=0, installed_size__gt=0,
+ compressed_size__gte=cutoff).order_by('-compressed_size')
+ names = [ 'Compressed Size', 'Installed Size', 'Ratio', 'Type' ]
+ attrs = [ 'compressed_size_pretty', 'installed_size_pretty',
+ 'ratio', 'compress_type' ]
+ # Format the compressed and installed sizes with MB/GB/etc suffixes
+ for package in packages:
+ package.compressed_size_pretty = filesizeformat(
+ package.compressed_size)
+ package.installed_size_pretty = filesizeformat(
+ package.installed_size)
+ ratio = package.compressed_size / float(package.installed_size)
+ package.ratio = '%.2f' % ratio
+ package.compress_type = package.filename.split('.')[-1]
elif report == 'uncompressed-man':
title = 'Packages with uncompressed manpages'
# magic going on here! Checking for all '.1'...'.9' extensions
diff --git a/templates/devel/index.html b/templates/devel/index.html
index f9ca2135..1689319b 100644
--- a/templates/devel/index.html
+++ b/templates/devel/index.html
@@ -115,6 +115,9 @@
<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/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>