diff options
-rw-r--r-- | devel/management/commands/reporead.py | 12 | ||||
-rw-r--r-- | devel/models.py | 6 | ||||
-rw-r--r-- | devel/views.py | 4 | ||||
-rw-r--r-- | public/views.py | 15 | ||||
-rw-r--r-- | releng/admin.py | 1 | ||||
-rw-r--r-- | releng/views.py | 1 | ||||
-rw-r--r-- | sitemaps.py | 19 | ||||
-rw-r--r-- | templates/public/keys.html | 4 | ||||
-rw-r--r-- | templates/releng/result_section.html | 2 |
9 files changed, 45 insertions, 19 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index 30c09c5e..d0e5ef3d 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -70,7 +70,7 @@ class Command(BaseCommand): return read_repo(arch, filename, options) -class Pkg(object): +class RepoPackage(object): """An interim 'container' object for holding Arch package data.""" bare = ( 'name', 'base', 'arch', 'filename', 'md5sum', 'sha256sum', 'url', 'packager' ) @@ -85,6 +85,7 @@ class Pkg(object): self.ver = None self.rel = None self.epoch = 0 + self.desc = None self.pgpsig = None for k in self.bare + self.number: setattr(self, k, None) @@ -463,7 +464,7 @@ def parse_info(iofile): def parse_repo(repopath): """ - Parses an Arch repo db file, and returns a list of Pkg objects. + Parses an Arch repo db file, and returns a list of RepoPackage objects. Arguments: repopath -- The path of a repository db file. @@ -485,7 +486,7 @@ def parse_repo(repopath): repodb = tarfile.open(repopath, "r") logger.debug("Starting package parsing") dbfiles = ('desc', 'depends', 'files') - newpkg = lambda: Pkg(reponame) + newpkg = lambda: RepoPackage(reponame) pkgs = defaultdict(newpkg) for tarinfo in repodb.getmembers(): if tarinfo.isreg(): @@ -541,8 +542,9 @@ def read_repo(primary_arch, repo_file, options): if package.arch in packages_arches: packages_arches[package.arch].append(package) else: - # we don't include mis-arched packages - logger.warning("Package %s arch = %s", package.name, package.arch) + raise Exception( + "Package %s in database %s had wrong architecture %s" % ( + package.name, repo_file, package.arch)) del packages logger.info('Starting database updates for %s.', repo_file) diff --git a/devel/models.py b/devel/models.py index a9a2efc5..2fc61060 100644 --- a/devel/models.py +++ b/devel/models.py @@ -24,10 +24,8 @@ class MasterKey(models.Model): class PGPSignature(models.Model): - signer = PGPKeyField(max_length=40, verbose_name="Signer key fingerprint", - help_text="consists of 40 hex digits; use `gpg --fingerprint`") - signee = PGPKeyField(max_length=40, verbose_name="Signee key fingerprint", - help_text="consists of 40 hex digits; use `gpg --fingerprint`") + signer = PGPKeyField(max_length=40, verbose_name="Signer key fingerprint") + signee = PGPKeyField(max_length=40, verbose_name="Signee key fingerprint") created = models.DateField() expires = models.DateField(null=True, blank=True) valid = models.BooleanField(default=True) diff --git a/devel/views.py b/devel/views.py index 33314931..36d0cccf 100644 --- a/devel/views.py +++ b/devel/views.py @@ -101,8 +101,8 @@ def clock(request): response = direct_to_template(request, 'devel/clock.html', page_dict) if not response.has_header('Expires'): # why this works only with the non-UTC date I have no idea... - expire_time = now.replace(minute=utc_now.minute + 1, - second=0, microsecond=0) + expire_time = now.replace(second=0, microsecond=0) + expire_time += timedelta(minutes=1) expire_time = time.mktime(expire_time.timetuple()) response['Expires'] = http_date(expire_time) return response diff --git a/public/views.py b/public/views.py index e3d26f92..a8ce2fa7 100644 --- a/public/views.py +++ b/public/views.py @@ -1,12 +1,13 @@ from django.conf import settings from django.contrib.auth.models import User +from django.db.models import Count from django.http import Http404 from django.shortcuts import redirect from django.views.decorators.cache import cache_control from django.views.generic import list_detail from django.views.generic.simple import direct_to_template -from devel.models import MasterKey +from devel.models import MasterKey, PGPSignature from main.models import Arch, Repo, Donor from mirrors.models import MirrorUrl from news.models import News @@ -70,9 +71,17 @@ def feeds(request): @cache_control(max_age=300) def keys(request): + master_keys = MasterKey.objects.select_related('owner', 'revoker', + 'owner__userprofile', 'revoker__userprofile').filter( + revoked__isnull=True) + sig_counts = PGPSignature.objects.filter(valid=True, + expires__isnull=True).values_list('signer').annotate( + Count('signer')) + sig_counts = dict((key_id[-16:], ct) for key_id, ct in sig_counts) + for key in master_keys: + key.signature_count = sig_counts.get(key.pgp_key[-16:], 0) context = { - 'keys': MasterKey.objects.select_related('owner', 'revoker', - 'owner__userprofile', 'revoker__userprofile').all(), + 'keys': master_keys, } return direct_to_template(request, 'public/keys.html', context) diff --git a/releng/admin.py b/releng/admin.py index e1411b84..42755002 100644 --- a/releng/admin.py +++ b/releng/admin.py @@ -7,6 +7,7 @@ from .models import (Architecture, BootType, Bootloader, ClockChoice, class IsoAdmin(admin.ModelAdmin): list_display = ('name', 'created', 'active', 'removed') list_filter = ('active', 'created') + date_hierarchy = 'created' class TestAdmin(admin.ModelAdmin): list_display = ('user_name', 'user_email', 'created', 'ip_address', diff --git a/releng/views.py b/releng/views.py index e17a6e9c..007c8c84 100644 --- a/releng/views.py +++ b/releng/views.py @@ -81,6 +81,7 @@ def calculate_option_overview(field_name): is_rollback = field_name.startswith('rollback_') option = { 'option': model, + 'field_name': field_name, 'name': model._meta.verbose_name, 'is_rollback': is_rollback, 'values': [] diff --git a/sitemaps.py b/sitemaps.py index 958d1f44..177555ff 100644 --- a/sitemaps.py +++ b/sitemaps.py @@ -1,3 +1,5 @@ +from datetime import datetime, timedelta + from django.contrib.sitemaps import Sitemap from django.core.urlresolvers import reverse @@ -17,8 +19,8 @@ class PackagesSitemap(Sitemap): class PackageFilesSitemap(PackagesSitemap): - changefreq = "monthly" - priority = "0.3" + changefreq = "weekly" + priority = "0.2" def location(self, obj): return PackagesSitemap.location(self, obj) + 'files/' @@ -57,15 +59,26 @@ class SplitPackagesSitemap(Sitemap): class NewsSitemap(Sitemap): - changefreq = "never" priority = "0.8" + def __init__(self): + now = datetime.utcnow() + self.one_day_ago = now - timedelta(days=1) + self.one_week_ago = now - timedelta(days=7) + def items(self): return News.objects.all() def lastmod(self, obj): return obj.last_modified + def changefreq(self, obj): + if obj.last_modified > self.one_day_ago: + return 'daily' + if obj.last_modified > self.one_week_ago: + return 'weekly' + return 'yearly' + class BaseSitemap(Sitemap): base_viewnames = ( diff --git a/templates/public/keys.html b/templates/public/keys.html index 20b91749..43b1b067 100644 --- a/templates/public/keys.html +++ b/templates/public/keys.html @@ -34,13 +34,14 @@ <th>Owner's Signing Key</th> <th>Revoker</th> <th>Revoker's Signing Key</th> + <th>Developer/TU Keys Signed</th> </tr> </thead> <tbody> {% for key in keys %} <tr> <td>{% pgp_key_link key.pgp_key %}</td> - <td>{{ key.pgp_key|pgp_fingerprint }}</td> + <td><tt>{{ key.pgp_key|pgp_fingerprint }}</tt></td> {% with key.owner.userprofile as owner_profile %} <td><a href="{{ owner_profile.get_absolute_url }}">{{ key.owner.get_full_name }}</a></td> <td>{% pgp_key_link owner_profile.pgp_key %}</td> @@ -49,6 +50,7 @@ <td><a href="{{ revoker_profile.get_absolute_url }}">{{ key.revoker.get_full_name }}</a></td> <td>{% pgp_key_link revoker_profile.pgp_key %}</td> {% endwith %} + <td>{{ key.signature_count }}</td> </tr> {% endfor %} </tbody> diff --git a/templates/releng/result_section.html b/templates/releng/result_section.html index 08e46fb7..e9375cdd 100644 --- a/templates/releng/result_section.html +++ b/templates/releng/result_section.html @@ -6,7 +6,7 @@ {% for item in option.values %} <tr> <td> - <a href="{% url releng-results-for option.name|lower item.value.pk %}"> + <a href="{% url releng-results-for option.field_name item.value.pk %}"> {{ item.value.name|lower }} </a> </td> |