From a97ba8bbca30d656598f71f249e6fbe7020773bf Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 25 Nov 2013 21:31:00 -0600 Subject: Bump some requirements Signed-off-by: Dan McGee --- requirements.txt | 4 ++-- requirements_prod.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 08d89107..7ff363e6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,9 +2,9 @@ Django==1.6 IPy==0.81 Markdown==2.3.1 -South==0.8.2 +South==0.8.4 bencode==1.0 django-countries==1.5 -jsmin==2.0.6 +jsmin==2.0.8 pgpdump==1.4 pytz>=2013.8 diff --git a/requirements_prod.txt b/requirements_prod.txt index 565c3c6c..3f2958c6 100644 --- a/requirements_prod.txt +++ b/requirements_prod.txt @@ -2,10 +2,10 @@ Django==1.6 IPy==0.81 Markdown==2.3.1 -South==0.8.2 +South==0.8.4 bencode==1.0 django-countries==1.5 -jsmin==2.0.6 +jsmin==2.0.8 pgpdump==1.4 psycopg2==2.5.1 pyinotify==0.9.4 -- cgit v1.2.3-54-g00ecf From efd1bd15ef34b9ebafd703375108fb41b1a6ecf0 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 25 Nov 2013 21:31:21 -0600 Subject: Capitalize URL properly in Django admin Signed-off-by: Dan McGee --- main/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/models.py b/main/models.py index 8d9d4c89..bf7a9409 100644 --- a/main/models.py +++ b/main/models.py @@ -97,7 +97,7 @@ class Package(models.Model): pkgrel = models.CharField(max_length=255) epoch = models.PositiveIntegerField(default=0) pkgdesc = models.TextField('description', null=True) - url = models.CharField(max_length=255, null=True) + url = models.CharField('URL', max_length=255, null=True) filename = models.CharField(max_length=255) compressed_size = PositiveBigIntegerField() installed_size = PositiveBigIntegerField() -- cgit v1.2.3-54-g00ecf From ae61d98ed63ce0f5932548b31ce516fc52f05c8d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 25 Nov 2013 21:54:12 -0600 Subject: Move markdown formatted readme to README.md Signed-off-by: Dan McGee --- README | 81 +-------------------------------------------------------------- README.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 80 deletions(-) mode change 100644 => 120000 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index beeb7f99..00000000 --- a/README +++ /dev/null @@ -1,80 +0,0 @@ -# Archweb README - -To get a pretty version of this document, run - - $ markdown README > README.html - -# License - -See LICENSE file. - -# Authors - -See AUTHORS file. - -# Dependencies - -- python2 -- python2-virtualenv - -# Python dependencies - -More detail in `requirements.txt` and `requirements_prod.txt`; it is best to -use virtualenv and pip to handle these. But if you insist on (Arch Linux) -packages, you will probably want the following: - -- django -- python2-psycopg2 -- python2-markdown -- python2-south -- python2-memcached - -# Testing Installation - -1. Run `virtualenv2`. - - $ cd /path/to/archweb && virtualenv2 ./env/ - -2. Activate the virtualenv. - - $ source ./env/bin/activate - -2. Install dependencies through `pip`. - - (archweb-env) $ pip install -r requirements.txt - -3. Copy `local_settings.py.example` to `local_settings.py` and modify. - Make sure to uncomment the appropriate database section (either sqlite or - PostgreSQL). - -4. Sync the database to create it. - - (archweb-env) $ ./manage.py syncdb - -5. Migrate changes. - - (archweb-env) $ ./manage.py migrate - -6. Load the fixtures to prepopulate some data. If you don't want some of the - provided data, adjust the file glob accordingly. - - (archweb-env) $ ./manage.py loaddata */fixtures/*.json - -7. Use the following commands to start a service instance - - (archweb-env) $ ./manage.py runserver - -8. To optionally populate the database with real data: - - (archweb-env) $ wget ftp://ftp.archlinux.org/core/os/i686/core.db.tar.gz - (archweb-env) $ ./manage.py reporead i686 core.db.tar.gz - (archweb-env) $ ./manage.py syncisos - -Alter architecture and repo to get x86\_64 and packages from other repos if -needed. - -# Production Installation - -Ask someone who knows, or you are going to be in trouble. - -vim: set syntax=markdown et: diff --git a/README b/README new file mode 120000 index 00000000..42061c01 --- /dev/null +++ b/README @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..beeb7f99 --- /dev/null +++ b/README.md @@ -0,0 +1,80 @@ +# Archweb README + +To get a pretty version of this document, run + + $ markdown README > README.html + +# License + +See LICENSE file. + +# Authors + +See AUTHORS file. + +# Dependencies + +- python2 +- python2-virtualenv + +# Python dependencies + +More detail in `requirements.txt` and `requirements_prod.txt`; it is best to +use virtualenv and pip to handle these. But if you insist on (Arch Linux) +packages, you will probably want the following: + +- django +- python2-psycopg2 +- python2-markdown +- python2-south +- python2-memcached + +# Testing Installation + +1. Run `virtualenv2`. + + $ cd /path/to/archweb && virtualenv2 ./env/ + +2. Activate the virtualenv. + + $ source ./env/bin/activate + +2. Install dependencies through `pip`. + + (archweb-env) $ pip install -r requirements.txt + +3. Copy `local_settings.py.example` to `local_settings.py` and modify. + Make sure to uncomment the appropriate database section (either sqlite or + PostgreSQL). + +4. Sync the database to create it. + + (archweb-env) $ ./manage.py syncdb + +5. Migrate changes. + + (archweb-env) $ ./manage.py migrate + +6. Load the fixtures to prepopulate some data. If you don't want some of the + provided data, adjust the file glob accordingly. + + (archweb-env) $ ./manage.py loaddata */fixtures/*.json + +7. Use the following commands to start a service instance + + (archweb-env) $ ./manage.py runserver + +8. To optionally populate the database with real data: + + (archweb-env) $ wget ftp://ftp.archlinux.org/core/os/i686/core.db.tar.gz + (archweb-env) $ ./manage.py reporead i686 core.db.tar.gz + (archweb-env) $ ./manage.py syncisos + +Alter architecture and repo to get x86\_64 and packages from other repos if +needed. + +# Production Installation + +Ask someone who knows, or you are going to be in trouble. + +vim: set syntax=markdown et: -- cgit v1.2.3-54-g00ecf From e557545ca803fa215b3a7f43f4c421dff1259fe3 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 27 Nov 2013 16:00:49 -0500 Subject: Use pkg_details_link tag on differences report page Signed-off-by: Dan McGee --- templates/packages/differences.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/templates/packages/differences.html b/templates/packages/differences.html index f137126d..f4d93151 100644 --- a/templates/packages/differences.html +++ b/templates/packages/differences.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load cycle from future %} {% load static from staticfiles %} +{% load package_extras %} {% block title %}Arch Linux - Package Differences Reports{% endblock %} {% block navbarclass %}anb-packages{% endblock %} @@ -78,12 +79,10 @@

Multilib Differences to Main Packages

{% for pkg1, pkg2 in multilib_differences %} - {{ pkg1.pkgname }} + {% pkg_details_link pkg1 %} {{ pkg1.full_version }} {{ pkg2.full_version }} - {{ pkg2.pkgname }} + {% pkg_details_link pkg2 %} {{ pkg2.repo }} {{ pkg1.last_update|date }} {{ pkg2.last_update|date }} -- cgit v1.2.3-54-g00ecf From 58356ec5b38c71204895eb77856a45ffd7ac1725 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 27 Nov 2013 16:07:49 -0500 Subject: Allow pkg_details_link to honor package flag state This allows the tag to be used in a few more places we weren't already able to use it, and hopefully speeds up rendering a tad on the package differences page. Signed-off-by: Dan McGee --- packages/templatetags/package_extras.py | 7 +++++-- templates/packages/differences.html | 8 ++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py index f7392a96..3ce64748 100644 --- a/packages/templatetags/package_extras.py +++ b/packages/templatetags/package_extras.py @@ -67,13 +67,16 @@ def do_buildsortqs(parser, token): @register.simple_tag -def pkg_details_link(pkg, link_title=None): +def pkg_details_link(pkg, link_title=None, honor_flagged=False): if not pkg: return link_title or '' if link_title is None: link_title = pkg.pkgname + link_content = link_title + if honor_flagged and pkg.flag_date: + link_content = '%s' % link_title link = '%s' - return link % (pkg.get_absolute_url(), pkg.pkgname, link_title) + return link % (pkg.get_absolute_url(), pkg.pkgname, link_content) @register.simple_tag diff --git a/templates/packages/differences.html b/templates/packages/differences.html index f4d93151..5ebe18e2 100644 --- a/templates/packages/differences.html +++ b/templates/packages/differences.html @@ -46,14 +46,10 @@

Filter Differences View

{{ diff.pkgname }} {{ diff.repo.name }} {% if diff.pkg_a %} - - {{ diff.pkg_a.full_version }} + {% pkg_details_link diff.pkg_a diff.pkg_a.full_version True %} {% else %}-{% endif %} {% if diff.pkg_b %} - - {{ diff.pkg_b.full_version }} + {% pkg_details_link diff.pkg_b diff.pkg_b.full_version True %} {% else %}-{% endif %} {% endfor %} -- cgit v1.2.3-54-g00ecf From 429736f7e9fcdc92ea43f98e3a246b9e41e04707 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 27 Nov 2013 17:05:02 -0500 Subject: Remove date_hierarchy from several package admin views I was never using this and it adds some pretty substantial overhead to each render of the admin page, so toss it. Add the simple date filter to the sidebar instead. Signed-off-by: Dan McGee --- packages/admin.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/admin.py b/packages/admin.py index 4680c755..5df0043a 100644 --- a/packages/admin.py +++ b/packages/admin.py @@ -15,10 +15,9 @@ class PackageRelationAdmin(admin.ModelAdmin): class FlagRequestAdmin(admin.ModelAdmin): list_display = ('pkgbase', 'full_version', 'repo', 'created', 'who', 'is_spam', 'is_legitimate', 'message') - list_filter = ('is_spam', 'is_legitimate', 'repo') + list_filter = ('is_spam', 'is_legitimate', 'repo', 'created') search_fields = ('pkgbase', 'user_email', 'message') ordering = ('-created',) - date_hierarchy = 'created' def get_queryset(self, request): qs = super(FlagRequestAdmin, self).queryset(request) @@ -28,19 +27,17 @@ def get_queryset(self, request): class SignoffAdmin(admin.ModelAdmin): list_display = ('pkgbase', 'full_version', 'arch', 'repo', 'user', 'created', 'revoked') - list_filter = ('arch', 'repo', 'user') + list_filter = ('arch', 'repo', 'user', 'created') search_fields = ('pkgbase', 'user__username') ordering = ('-created',) - date_hierarchy = 'created' class SignoffSpecificationAdmin(admin.ModelAdmin): list_display = ('pkgbase', 'full_version', 'arch', 'repo', 'user', 'created', 'comments') - list_filter = ('arch', 'repo', 'user') + list_filter = ('arch', 'repo', 'user', 'created') search_fields = ('pkgbase', 'user__username') ordering = ('-created',) - date_hierarchy = 'created' def get_queryset(self, request): qs = super(SignoffSpecificationAdmin, self).queryset(request) @@ -50,10 +47,9 @@ def get_queryset(self, request): class UpdateAdmin(admin.ModelAdmin): list_display = ('pkgname', 'repo', 'arch', 'action_flag', 'old_version', 'new_version', 'created') - list_filter = ('action_flag', 'repo', 'arch') + list_filter = ('action_flag', 'repo', 'arch', 'created') search_fields = ('pkgname',) ordering = ('-created',) - date_hierarchy = 'created' raw_id_fields = ('package',) -- cgit v1.2.3-54-g00ecf From 954b61ee3a0760990f8e17d7d692f3cabd949f9f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 27 Nov 2013 17:08:42 -0500 Subject: Syntax cleanups to main admin Signed-off-by: Dan McGee --- main/admin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/admin.py b/main/admin.py index 6aff12e5..ec2b5bc8 100644 --- a/main/admin.py +++ b/main/admin.py @@ -1,23 +1,27 @@ from django.contrib import admin from main.models import Arch, Donor, Package, Repo + class DonorAdmin(admin.ModelAdmin): list_display = ('name', 'visible', 'created') list_filter = ('visible', 'created') search_fields = ('name',) exclude = ('created',) + class ArchAdmin(admin.ModelAdmin): list_display = ('name', 'agnostic', 'required_signoffs') list_filter = ('agnostic',) search_fields = ('name',) + class RepoAdmin(admin.ModelAdmin): list_display = ('name', 'testing', 'staging', 'bugs_project', 'bugs_category', 'svn_root') list_filter = ('testing', 'staging') search_fields = ('name',) + class PackageAdmin(admin.ModelAdmin): list_display = ('pkgname', 'full_version', 'repo', 'arch', 'packager', 'last_update', 'build_date') -- cgit v1.2.3-54-g00ecf From 9adc2e53124daa6d13090166830396ffff9013d3 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 27 Nov 2013 17:49:58 -0500 Subject: Stop using Django-provided floatformat template tag It turns out this is a HUGE part of our slow mirror status template rendering, due to the internal workings. Everything is converted to a Python decimal object which is way slower than just staying in native floating point. Given we are always dealing with floats when we need to do our formatting, a home-rolled template tag can accomplish this much faster. Signed-off-by: Dan McGee --- mirrors/templatetags/mirror_status.py | 11 ++++++++--- templates/mirrors/mirror_details.html | 6 +++--- templates/mirrors/mirrorlist_status.txt | 4 ++-- templates/mirrors/status_table.html | 6 +++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/mirrors/templatetags/mirror_status.py b/mirrors/templatetags/mirror_status.py index 9a363fbe..b3810d9a 100644 --- a/mirrors/templatetags/mirror_status.py +++ b/mirrors/templatetags/mirror_status.py @@ -1,6 +1,5 @@ from datetime import timedelta from django import template -from django.template.defaultfilters import floatformat register = template.Library() @@ -27,10 +26,16 @@ def hours(value): return '%d hours' % hrs @register.filter -def percentage(value, arg=-1): +def floatvalue(value, arg=2): + if value is None: + return u'' + return '%.*f' % (arg, value) + +@register.filter +def percentage(value, arg=1): if not value and type(value) != float: return u'' new_val = value * 100.0 - return floatformat(new_val, arg) + '%' + return '%.*f%%' % (arg, new_val) # vim: set ts=4 sw=4 et: diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html index f2ffce20..e1962b85 100644 --- a/templates/mirrors/mirror_details.html +++ b/templates/mirrors/mirror_details.html @@ -110,9 +110,9 @@

Available URLs

{{ m_url.last_sync|date:'Y-m-d H:i'|default:'unknown' }} {{ m_url.completion_pct|percentage:1 }} {{ m_url.delay|duration|default:'unknown' }} - {{ m_url.duration_avg|floatformat:2 }} - {{ m_url.duration_stddev|floatformat:2 }} - {{ m_url.score|floatformat:1|default:'∞' }} + {{ m_url.duration_avg|floatvalue:2 }} + {{ m_url.duration_stddev|floatvalue:2 }} + {{ m_url.score|floatvalue:1|default:'∞' }} {% endfor %} diff --git a/templates/mirrors/mirrorlist_status.txt b/templates/mirrors/mirrorlist_status.txt index 575d19f7..c69075a3 100644 --- a/templates/mirrors/mirrorlist_status.txt +++ b/templates/mirrors/mirrorlist_status.txt @@ -1,4 +1,4 @@ -{% comment %} +{% load mirror_status %}{% comment %} Yes, ugly templates are ugly, but in order to keep line breaks where we want them, sacrifices have to be made. If editing this template, it is easiest to forget about where line breaks are happening until you are done getting the @@ -9,6 +9,6 @@ content right, and then go back later to fix it all up. ## Generated on {% now "Y-m-d" %} ## {% for mirror_url in mirror_urls %} -## Score: {{ mirror_url.score|floatformat:1|default:'unknown' }}, {{ mirror_url.country.name|default:'Worldwide' }} +## Score: {{ mirror_url.score|floatvalue:1|default:'unknown' }}, {{ mirror_url.country.name|default:'Worldwide' }} #Server = {{ mirror_url.url}}$repo/os/$arch{% endfor %} {% endautoescape %} diff --git a/templates/mirrors/status_table.html b/templates/mirrors/status_table.html index 6fc07a31..00b9c1df 100644 --- a/templates/mirrors/status_table.html +++ b/templates/mirrors/status_table.html @@ -20,9 +20,9 @@ {% country_flag m_url.country %}{{ m_url.country.name }} {{ m_url.completion_pct|percentage:1 }} {{ m_url.delay|duration|default:'unknown' }} - {{ m_url.duration_avg|floatformat:2 }} - {{ m_url.duration_stddev|floatformat:2 }} - {{ m_url.score|floatformat:1|default:'∞' }} + {{ m_url.duration_avg|floatvalue:2 }} + {{ m_url.duration_stddev|floatvalue:2 }} + {{ m_url.score|floatvalue:1|default:'∞' }} {% endfor %} -- cgit v1.2.3-54-g00ecf