From ecf57207c0a5f90d51b6be551158ce7a0f82c9cb Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 21 Apr 2013 20:06:14 -0500 Subject: Fix sorting of file size values in jQuery tablesorter The dumbass currency parser was matching values like '1.5 GB', causing the actual sorting to not work right since the magnitude values of GB values are obviously different than MB. Remove it fully from the parser list so our actual parser matches and we sort correctly. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 16 ++++++++++++++++ templates/devel/packages.html | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index aa225f5f..800c5add 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -11,6 +11,7 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { }, type: 'numeric' }); + $.tablesorter.addParser({ id: 'todostatus', is: function(s) { return false; }, @@ -24,6 +25,7 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { }, type: 'numeric' }); + $.tablesorter.addParser({ /* sorts numeric, but put '', 'unknown', and '∞' last. */ id: 'mostlydigit', @@ -40,6 +42,7 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { }, type: 'numeric' }); + $.tablesorter.addParser({ /* sorts duration; put '', 'unknown', and '∞' last. */ id: 'duration', @@ -73,6 +76,7 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { }, type: 'numeric' }); + $.tablesorter.addParser({ id: 'longDateTime', re: /^(\d{4})-(\d{2})-(\d{2}) ([012]\d):([0-5]\d)(:([0-5]\d))?( (\w+))?$/, @@ -96,6 +100,7 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { }, type: 'numeric' }); + $.tablesorter.addParser({ id: 'filesize', re: /^(\d+(?:\.\d+)?) (bytes?|[KMGTPEZY]i?B)$/, @@ -141,6 +146,17 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { }, type: 'numeric' }); + + $.tablesorter.removeParser = function(id) { + $.tablesorter.parsers = $.grep($.tablesorter.parsers, + function(ele, i) { + return ele.id !== id; + }); + }; + + // We don't use currency, and the parser is over-zealous at deciding it + // matches. Kill it from the parser selection. + $.tablesorter.removeParser('currency'); } (function($) { diff --git a/templates/devel/packages.html b/templates/devel/packages.html index 0e6b1752..d6aab497 100644 --- a/templates/devel/packages.html +++ b/templates/devel/packages.html @@ -86,7 +86,7 @@

Filter Packages

var filter_func = function() { filter_pkgs_list('#report_filter', '#dev-report-results tbody'); }; $('#report_filter input').change(filter_func); $('#criteria_reset').click(function() { filter_pkgs_reset(filter_func); }); - // fire function on page load to ensure the current form selections take effect + // run on page load to ensure current form selections take effect filter_func(); }); -- cgit v1.2.3-54-g00ecf From 66412aa1037befef0b579c7df73656dc3b8b9804 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 21 Apr 2013 20:29:17 -0500 Subject: Move stats portion of developer dashboard to separate view This stuff is all below the fold when the page first loads, and adds a good amount of loading time to the developer dashboard. Split it out, where it will be wired back and hooked up via an AJAX insertion in a future commit. Both parts work standalone as is in this commit. Signed-off-by: Dan McGee --- devel/urls.py | 1 + devel/views.py | 21 +++++--- templates/devel/index.html | 128 +++------------------------------------------ templates/devel/stats.html | 120 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 128 deletions(-) create mode 100644 templates/devel/stats.html diff --git a/devel/urls.py b/devel/urls.py index 31afc86b..472c6456 100644 --- a/devel/urls.py +++ b/devel/urls.py @@ -5,6 +5,7 @@ (r'^admin_log/(?P.*)/$','admin_log'), (r'^clock/$', 'clock', {}, 'devel-clocks'), (r'^$', 'index', {}, 'devel-index'), + (r'^stats/$', 'stats', {}, 'devel-stats'), (r'^newuser/$', 'new_user_form'), (r'^profile/$', 'change_profile'), (r'^reports/(?P.*)/(?P.*)/$', 'report'), diff --git a/devel/views.py b/devel/views.py index 4258ea7f..378d6d57 100644 --- a/devel/views.py +++ b/devel/views.py @@ -33,7 +33,7 @@ @login_required def index(request): - '''the developer dashboard''' + """The developer dashboard.""" if request.user.is_authenticated(): inner_q = PackageRelation.objects.filter(user=request.user) else: @@ -54,6 +54,19 @@ def index(request): signoffs = sorted(get_signoff_groups(user=request.user), key=operator.attrgetter('pkgbase')) + page_dict = { + 'todos': todolists, + 'flagged': flagged, + 'todopkgs': todopkgs, + 'signoffs': signoffs + } + + return render(request, 'devel/index.html', page_dict) + + +@login_required +def stats(request): + """The second half of the dev dashboard.""" arches = Arch.objects.all().annotate( total_ct=Count('packages'), flagged_ct=Count('packages__flag_date')) repos = Repo.objects.all().annotate( @@ -80,17 +93,13 @@ def index(request): } page_dict = { - 'todos': todolists, 'arches': arches, 'repos': repos, 'maintainers': maintainers, 'orphan': orphan, - 'flagged': flagged, - 'todopkgs': todopkgs, - 'signoffs': signoffs } - return render(request, 'devel/index.html', page_dict) + return render(request, 'devel/stats.html', page_dict) @login_required diff --git a/templates/devel/index.html b/templates/devel/index.html index c067b69b..232a9034 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -161,7 +161,8 @@

Developer Reports

Self-explanatory (yours only)
  • Mismatched Signatures: - Packages where 1) signing key is unknown, 2) signer != packager, or 3) signature timestamp more than 24 hours after build timestamp + Packages where 1) signing key is unknown, 2) signer != packager, + or 3) signature timestamp more than 24 hours after build timestamp (yours only)
  • Big: All packages with compressed size > 50 MiB @@ -173,127 +174,10 @@

    Developer Reports

    Packages that have no maintainer and are not required by any other package in any repository
  • - - - -{% cache 60 dev-dash-by-arch %} -
    - -

    Stats by Architecture

    - - - - - - - - - - - {% for arch in arches %} - - - - - - {% endfor %} - -
    Arch# Packages# Flagged
    {{ arch.name }} - {{ arch.total_ct }} packages - {{ arch.flagged_ct }} packages
    -
    {# #dash-by-arch #} -{% endcache %} - -{% cache 60 dev-dash-by-repo %} -
    - -

    Stats by Repository

    - - - - - - - - - - - - {% for repo in repos %} - - - - - - - - {% endfor %} - -
    Repository# Packages# Flagged# Maintainers
    {{ repo.name }} - {{ repo.total_ct }} packages - {{ repo.flagged_ct }} packages{{ repo.maintainer_ct }} maintainers
    -
    {# dash-by-arch #} -{% endcache %} - -{% cache 60 dev-dash-by-developer %} -
    - -

    Stats by Developer

    - - {% if perms.main.change_package %} -

    Look for stale relations

    - {% endif %} - - - - - - - - - - - - - - - - - - {% for maint in maintainers %} - - - - - - - {% endfor %} - -
    Maintainer# Maintained# Flagged# Last Packager
    Orphan/Unknown - {{ orphan.package_count }} packages - - {{ orphan.flagged_count }} packages - - {{ orphan.updated_count }} packages -
    {{ maint.get_full_name }} - {{ maint.package_count }} packages - - {{ maint.flagged_count }} packages - - {{ maint.updated_count }} packages -
    -
    {# #dash-by-developer #} -{% endcache %} +{# #dev-dashboard #} +
    +

    Enable Javascript to get more useful info here.

    +
    {% endblock %} {% block script_block %} diff --git a/templates/devel/stats.html b/templates/devel/stats.html new file mode 100644 index 00000000..2dbe4755 --- /dev/null +++ b/templates/devel/stats.html @@ -0,0 +1,120 @@ +{% load cache %} + +{% cache 60 dev-dash-by-arch %} +
    + +

    Stats by Architecture

    + + + + + + + + + + + {% for arch in arches %} + + + + + + {% endfor %} + +
    Arch# Packages# Flagged
    {{ arch.name }} + {{ arch.total_ct }} packages + {{ arch.flagged_ct }} packages
    +
    {# #dash-by-arch #} +{% endcache %} + +{% cache 60 dev-dash-by-repo %} +
    + +

    Stats by Repository

    + + + + + + + + + + + + {% for repo in repos %} + + + + + + + + {% endfor %} + +
    Repository# Packages# Flagged# Maintainers
    {{ repo.name }} + {{ repo.total_ct }} packages + {{ repo.flagged_ct }} packages{{ repo.maintainer_ct }} maintainers
    +
    {# dash-by-arch #} +{% endcache %} + +{% cache 60 dev-dash-by-developer %} +
    + +

    Stats by Developer

    + + {% if perms.main.change_package %} +

    Look for stale relations

    + {% endif %} + + + + + + + + + + + + + + + + + + {% for maint in maintainers %} + + + + + + + {% endfor %} + +
    Maintainer# Maintained# Flagged# Last Packager
    Orphan/Unknown + {{ orphan.package_count }} packages + + {{ orphan.flagged_count }} packages + + {{ orphan.updated_count }} packages +
    {{ maint.get_full_name }} + {{ maint.package_count }} packages + + {{ maint.flagged_count }} packages + + {{ maint.updated_count }} packages +
    +
    {# #dash-by-developer #} +{% endcache %} -- cgit v1.2.3-54-g00ecf From a8203a0a17fbd8680f96c9357c7fba5923960e34 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 21 Apr 2013 20:37:44 -0500 Subject: Load developer dashboard stats via $.load() call This completes the separation started in an earlier commit. Signed-off-by: Dan McGee --- templates/devel/index.html | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/templates/devel/index.html b/templates/devel/index.html index 232a9034..03e5d73a 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -175,6 +175,7 @@

    Developer Reports

    package in any repository {# #dev-dashboard #} +

    Enable Javascript to get more useful info here.

    @@ -185,6 +186,19 @@

    Developer Reports

    {% endblock %} -- cgit v1.2.3-54-g00ecf From 007b8d7573b64fd7f17023fa0288ba79e05683c4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 22 Apr 2013 09:10:09 -0500 Subject: Add 'required_signoffs' field to Arch model This will indicate how many signoffs are required for packages of the given architecture. Set the default to 2 as it currently stands. Signed-off-by: Dan McGee --- main/admin.py | 2 +- main/fixtures/arches.json | 49 ++++----- .../0064_auto__add_field_arch_required_signoffs.py | 112 +++++++++++++++++++++ main/models.py | 2 + 4 files changed, 141 insertions(+), 24 deletions(-) create mode 100644 main/migrations/0064_auto__add_field_arch_required_signoffs.py diff --git a/main/admin.py b/main/admin.py index ef134187..6aff12e5 100644 --- a/main/admin.py +++ b/main/admin.py @@ -8,7 +8,7 @@ class DonorAdmin(admin.ModelAdmin): exclude = ('created',) class ArchAdmin(admin.ModelAdmin): - list_display = ('name', 'agnostic') + list_display = ('name', 'agnostic', 'required_signoffs') list_filter = ('agnostic',) search_fields = ('name',) diff --git a/main/fixtures/arches.json b/main/fixtures/arches.json index 6334c2d3..1ece16c9 100644 --- a/main/fixtures/arches.json +++ b/main/fixtures/arches.json @@ -1,26 +1,29 @@ [ - { - "pk": 1, - "model": "main.arch", - "fields": { - "agnostic": true, - "name": "any" - } - }, - { - "pk": 2, - "model": "main.arch", - "fields": { - "agnostic": false, - "name": "i686" - } - }, - { - "pk": 3, - "model": "main.arch", - "fields": { - "agnostic": false, - "name": "x86_64" - } +{ + "pk": 1, + "model": "main.arch", + "fields": { + "agnostic": true, + "name": "any", + "required_signoffs": 2 } +}, +{ + "pk": 2, + "model": "main.arch", + "fields": { + "agnostic": false, + "name": "i686", + "required_signoffs": 1 + } +}, +{ + "pk": 3, + "model": "main.arch", + "fields": { + "agnostic": false, + "name": "x86_64", + "required_signoffs": 2 + } +} ] diff --git a/main/migrations/0064_auto__add_field_arch_required_signoffs.py b/main/migrations/0064_auto__add_field_arch_required_signoffs.py new file mode 100644 index 00000000..1846378f --- /dev/null +++ b/main/migrations/0064_auto__add_field_arch_required_signoffs.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + db.add_column('arches', 'required_signoffs', + self.gf('django.db.models.fields.PositiveIntegerField')(default=2), + keep_default=True) + + def backwards(self, orm): + db.delete_column('arches', 'required_signoffs') + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'main.arch': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Arch', 'db_table': "'arches'"}, + 'agnostic': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'required_signoffs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '2'}) + }, + u'main.donor': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Donor', 'db_table': "'donors'"}, + 'created': ('django.db.models.fields.DateTimeField', [], {}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + u'main.package': { + 'Meta': {'ordering': "('pkgname',)", 'unique_together': "(('pkgname', 'repo', 'arch'),)", 'object_name': 'Package', 'db_table': "'packages'"}, + 'arch': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'packages'", 'on_delete': 'models.PROTECT', 'to': u"orm['main.Arch']"}), + 'build_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'compressed_size': ('main.fields.PositiveBigIntegerField', [], {}), + 'created': ('django.db.models.fields.DateTimeField', [], {}), + 'epoch': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'filename': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'files_last_update': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'flag_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'installed_size': ('main.fields.PositiveBigIntegerField', [], {}), + 'last_update': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'packager': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), + 'packager_str': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'pgp_signature': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'pkgbase': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'pkgdesc': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'pkgname': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'pkgrel': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'pkgver': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'repo': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'packages'", 'on_delete': 'models.PROTECT', 'to': u"orm['main.Repo']"}), + 'url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}) + }, + u'main.packagefile': { + 'Meta': {'object_name': 'PackageFile', 'db_table': "'package_files'"}, + 'directory': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_directory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'pkg': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['main.Package']"}) + }, + u'main.repo': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Repo', 'db_table': "'repos'"}, + 'bugs_category': ('django.db.models.fields.SmallIntegerField', [], {'default': '2'}), + 'bugs_project': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'staging': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'svn_root': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'testing': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + } + } + + complete_apps = ['main'] diff --git a/main/models.py b/main/models.py index 2f4d3520..2ace0109 100644 --- a/main/models.py +++ b/main/models.py @@ -48,6 +48,8 @@ class Arch(models.Model): name = models.CharField(max_length=255, unique=True) agnostic = models.BooleanField(default=False, help_text="Is this architecture non-platform specific?") + required_signoffs = models.PositiveIntegerField(default=2, + help_text="Number of signoffs required for packages of this architecture") def __unicode__(self): return self.name -- cgit v1.2.3-54-g00ecf From 6fa6a8db0787fa40fa1c88b725b0bce184903c4c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 22 Apr 2013 10:50:03 -0500 Subject: Use required_signoffs value when creating signoff specs And respect it elsewhere when we create a fake default specification because a real one does not exist yet. Signed-off-by: Dan McGee --- packages/management/commands/populate_signoffs.py | 6 ++++-- packages/models.py | 12 +++++++++--- packages/utils.py | 4 ++-- templates/packages/signoffs.html | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/management/commands/populate_signoffs.py b/packages/management/commands/populate_signoffs.py index 97ba4146..a9c1c81c 100644 --- a/packages/management/commands/populate_signoffs.py +++ b/packages/management/commands/populate_signoffs.py @@ -29,7 +29,8 @@ logger = logging.getLogger() class Command(NoArgsCommand): - help = "Pull the latest commit message from SVN for a given package that is signoff-eligible and does not have an existing comment attached" + help = """Pull the latest commit message from SVN for a given package that +is signoff-eligible and does not have an existing comment attached""" def handle_noargs(self, **options): v = int(options.get('verbosity', None)) @@ -74,10 +75,11 @@ def cached_svn_log(pkgbase, repo): def create_specification(package, log, finder): trimmed_message = log['message'].strip() + required = package.arch.required_signoffs spec = SignoffSpecification(pkgbase=package.pkgbase, pkgver=package.pkgver, pkgrel=package.pkgrel, epoch=package.epoch, arch=package.arch, repo=package.repo, - comments=trimmed_message) + comments=trimmed_message, required=required) spec.user = finder.find_by_username(log['author']) return spec diff --git a/packages/models.py b/packages/models.py index f830aade..6477d412 100644 --- a/packages/models.py +++ b/packages/models.py @@ -60,7 +60,8 @@ def get_or_default_from_package(self, pkg): pkgbase=pkg.pkgbase, pkgver=pkg.pkgver, pkgrel=pkg.pkgrel, epoch=pkg.epoch, arch=pkg.arch, repo=pkg.repo) except SignoffSpecification.DoesNotExist: - return DEFAULT_SIGNOFF_SPEC + return fake_signoff_spec(pkg.arch) + class SignoffSpecification(models.Model): ''' @@ -97,10 +98,15 @@ def __unicode__(self): return u'%s-%s' % (self.pkgbase, self.full_version) -# fake default signoff spec when we don't have a persisted one in the database +# Fake signoff specs for when we don't have persisted ones in the database. +# These have all necessary attributes of the real thing but are lighter weight +# and have no chance of being persisted. FakeSignoffSpecification = namedtuple('FakeSignoffSpecification', ('required', 'enabled', 'known_bad', 'comments')) -DEFAULT_SIGNOFF_SPEC = FakeSignoffSpecification(2, True, False, u'') + + +def fake_signoff_spec(arch): + return FakeSignoffSpecification(arch.required_signoffs, True, False, u'') class SignoffManager(models.Manager): diff --git a/packages/utils.py b/packages/utils.py index 4f3b8665..b8d1504d 100644 --- a/packages/utils.py +++ b/packages/utils.py @@ -14,7 +14,7 @@ groupby_preserve_order, PackageStandin) from .models import (PackageGroup, PackageRelation, License, Depend, Conflict, Provision, Replacement, - SignoffSpecification, Signoff, DEFAULT_SIGNOFF_SPEC) + SignoffSpecification, Signoff, fake_signoff_spec) VERSION_RE = re.compile(r'^((\d+):)?(.+)-([^-]+)$') @@ -297,7 +297,6 @@ def __init__(self, packages): self.user = None self.target_repo = None self.signoffs = set() - self.specification = DEFAULT_SIGNOFF_SPEC self.default_spec = True first = packages[0] @@ -308,6 +307,7 @@ def __init__(self, packages): self.last_update = first.last_update self.packager = first.packager self.maintainers = first.maintainers + self.specification = fake_signoff_spec(first.arch) version = first.full_version if all(version == pkg.full_version for pkg in packages): diff --git a/templates/packages/signoffs.html b/templates/packages/signoffs.html index 6fbbd00e..807b613b 100644 --- a/templates/packages/signoffs.html +++ b/templates/packages/signoffs.html @@ -68,7 +68,7 @@

    Filter Displayed Signoffs

    {% endif %} {% include "packages/signoff_cell.html" %} {% if not group.default_spec %}{% with group.specification as spec %}{% comment %} - {% endcomment %}{% if spec.required != 2 %}Required signoffs: {{ spec.required }}
    {% endif %}{% comment %} + {% endcomment %}{% if spec.required != spec.arch.required_signoffs %}Required signoffs: {{ spec.required }}
    {% endif %}{% comment %} {% endcomment %}{% if not spec.enabled %}Signoffs are not currently enabled
    {% endif %}{% comment %} {% endcomment %}{% if spec.known_bad %}Package is known to be bad
    {% endif %}{% comment %} {% endcomment %}{{ spec.comments|default:""|linebreaksbr }} -- cgit v1.2.3-54-g00ecf From ac1c00ee86cc0e355af5e4e6be47ca861091356b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 23 Apr 2013 09:29:40 -0500 Subject: When retrieving signoff specs, select the arch object as well Otherwise we do one query per row in the signoff table to fetch the architecture and it's required_signoffs value, which is less than ideal. Signed-off-by: Dan McGee --- packages/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/utils.py b/packages/utils.py index b8d1504d..6ec39483 100644 --- a/packages/utils.py +++ b/packages/utils.py @@ -410,7 +410,8 @@ def get_current_signoffs(repos): def get_current_specifications(repos): '''Returns a list of signoff specification objects for the given repos.''' to_fetch = signoffs_id_query(SignoffSpecification, repos) - return SignoffSpecification.objects.in_bulk(to_fetch).values() + return SignoffSpecification.objects.select_related('arch').in_bulk( + to_fetch).values() def get_target_repo_map(repos): -- cgit v1.2.3-54-g00ecf From 8833749d9c9b361fcbbd1373e023569dd154b38e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 14:13:29 -0400 Subject: tweak README.BRANDING --- README.BRANDING | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.BRANDING b/README.BRANDING index e438ccc1..99df6a3b 100644 --- a/README.BRANDING +++ b/README.BRANDING @@ -1,7 +1,7 @@ It is now fairly easy to re-brand archweb. Replacing logos is still a bit of work. Here is a summary of the text files that need to be changed to -re-brand it. +re-brand it, from the text side. Files used to configure branding/url stuff ------------------------------------------ @@ -31,10 +31,6 @@ Files with minor Arch stuff that's just easier to patch `templates/packages/search.html` * link to AUR -`templates/public/feeds.html` - * links to AUR - * links to feeds on `bugs.archlinux.org` - `urls.py` `releng/views.py` `releng/models.py` @@ -68,6 +64,10 @@ Files with a significant amount of Arch-specific content: * Arch's donate button * Arch's sponsors +`templates/public/feeds.html` + * links to AUR + * links to feeds on `bugs.archlinux.org` + Files with totally Arch-specific content: ----------------------------------------- -- cgit v1.2.3-54-g00ecf From 330353f8dc50d5f27470f03f021cde72b056ac0b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 14:31:46 -0400 Subject: reduce differences --- local_settings.py.example | 22 ++++++++++++++++++---- main/context_processors.py | 7 +++++-- releng/views.py | 2 +- settings.py | 6 ++++++ templates/public/index.html | 14 +++++++------- visualize/static/visualize.js | 20 ++++++++++++++++++++ 6 files changed, 57 insertions(+), 14 deletions(-) diff --git a/local_settings.py.example b/local_settings.py.example index 4be1e2e9..52eab33c 100644 --- a/local_settings.py.example +++ b/local_settings.py.example @@ -1,9 +1,9 @@ ### Django settings for archlinux project. ## Debug settings -DEBUG = False +DEBUG = False # If you are running without another HTTP server, must be true TEMPLATE_DEBUG = False -#DEBUG_TOOLBAR = True +DEBUG_TOOLBAR = False # Must install package django-debug-toolbar to use ## For django debug toolbar INTERNAL_IPS = ('127.0.0.1',) @@ -25,6 +25,20 @@ ADMINS = ( # }, #} +## MySQL Database settings +#DATABASES = { +# 'default': { +# 'ENGINE' : 'django.db.backends.mysql', +# 'NAME' : 'archlinux', +# 'USER' : 'archlinux', +# 'PASSWORD': 'archlinux', +# 'HOST' : '', +# 'PORT' : '', +# # InnoDB WILL NOT work +# 'OPTIONS' : {'init_command': 'SET storage_engine=MyISAM'}, +# }, +#} + ## Sqlite Database settings DATABASES = { 'default': { @@ -50,10 +64,10 @@ CACHE_MIDDLEWARE_SECONDS = 300 SESSION_COOKIE_SECURE = False ## location for saving dev pictures (the 'devs' folder should be inside of this) -MEDIA_ROOT = '/srv/example.com/img/' +MEDIA_ROOT = '/srv/http/web-uploads' ## web url for serving image files (the 'devs' folder should be inside of this) -MEDIA_URL = '/media/img/' +MEDIA_URL = '/img/' ## Make this unique, and don't share it with anybody. SECRET_KEY = '00000000000000000000000000000000000000000000000' diff --git a/main/context_processors.py b/main/context_processors.py index 2543a3de..df9f1633 100644 --- a/main/context_processors.py +++ b/main/context_processors.py @@ -4,13 +4,16 @@ def secure(request): def branding(request): from django.conf import settings return { + 'BUGTRACKER_URL': settings.BUGTRACKER_URL, + 'MAILMAN_BASE_URL': settings.MAILMAN_BASE_URL, + 'PROJECTS_URL': settings.BUGTRACKER_URL, + 'BRANDING_APPNAME': settings.BRANDING_APPNAME, 'BRANDING_DISTRONAME': settings.BRANDING_DISTRONAME, 'BRANDING_SHORTNAME': settings.BRANDING_SHORTNAME, 'BRANDING_WIKINAME': settings.BRANDING_WIKINAME, 'BRANDING_EMAIL': settings.BRANDING_EMAIL, - 'MAILMAN_BASE_URL': settings.MAILMAN_BASE_URL, - 'BUGTRACKER_URL': settings.BUGTRACKER_URL, + 'BRANDING_OSEARCH_TAGS': settings.BRANDING_OSEARCH_TAGS, } # vim: set ts=4 sw=4 et: diff --git a/releng/views.py b/releng/views.py index b1c76a4a..ca0a7dd2 100644 --- a/releng/views.py +++ b/releng/views.py @@ -50,7 +50,7 @@ class TestForm(forms.ModelForm): success = forms.BooleanField( help_text="Only check this if everything went fine. " "If you ran into problems please create a ticket on the " + "href=\""+settings.BUGTRACKER_RELENG_URL+"\">the " "bugtracker (or check that one already exists) and link to " "it in the comments.", required=False) diff --git a/settings.py b/settings.py index 1cb85fc1..0bdc3162 100644 --- a/settings.py +++ b/settings.py @@ -171,6 +171,11 @@ # URL for linking to the bugtracker BUGTRACKER_URL = 'https://bugs.archlinux.org/' +# URL for linking to the release engineering/iso project on the bugtracker +BUGTRACKER_RELENG_URL = 'https://bugs.archlinux.org/index.php?project=6' + +PROJECTS_URL = 'https://projects.archlinux.org' + # Trackers used for ISO download magnet links TORRENT_TRACKERS = ( 'udp://tracker.archlinux.org:6969', @@ -184,6 +189,7 @@ BRANDING_SHORTNAME = 'Arch' BRANDING_WIKINAME = 'ArchWiki' BRANDING_EMAIL = 'Arch Website Notification ' +BRANDING_OSEARCH_TAGS = 'linux archlinux package software' ## Import local settings from local_settings import * diff --git a/templates/public/index.html b/templates/public/index.html index b32260b5..cdcde695 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -13,7 +13,7 @@

    A simple, lightweight distribution

    -

    You've reached the website for Arch Linux, a +

    You've reached the website for {{BRANDING_DISTRONAME}}, a lightweight and flexible Linux® distribution that tries to Keep It Simple.

    @@ -27,10 +27,10 @@

    A simple, lightweight distribution

    on the range of skillsets and uses for Arch that stem from it. Please check out our forums and mailing lists + title="{{ BRANDING_SHORTNAME }} Mailing Lists">mailing lists to get your feet wet. Also glance through our wiki - if you want to learn more about Arch.

    + if you want to learn more about {{BRANDING_SHORTNAME}}.

    Learn more...

    @@ -115,7 +115,7 @@

    Documentation

    title="Community documentation">Wiki
  • Official Installation Guide
  • -
  • Unofficial Beginners' Guide
  • @@ -161,8 +161,8 @@

    Tools

    Development

      -
    • Projects in Git
    • +
    • Projects in Git
    • SVN Repositories
    • More Resources
    • Signing Master Keys
    • Press Coverage
    • + title="{{ BRANDING_DISTRONAME }} in the media">Press Coverage
    • Logos & Artwork
    • News Archives
    • RSS Feeds
    • diff --git a/visualize/static/visualize.js b/visualize/static/visualize.js index 5004fe6c..ff39bb96 100644 --- a/visualize/static/visualize.js +++ b/visualize/static/visualize.js @@ -1,3 +1,23 @@ +/* archweb.js + * Homepage: https://projects.archlinux.org/archweb.git/ + * Copyright: 2011 Dan McGee + * License: GPLv2 + * + * This file is part of Archweb. + * + * Archweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Archweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Archweb. If not, see . + */ + function packages_treemap(chart_id, orderings, default_order) { var jq_div = jQuery(chart_id), color = d3.scale.category20(); -- cgit v1.2.3-54-g00ecf From f2a92588ebc3e2dcce9cc635df32e7550ec7588b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 14:32:26 -0400 Subject: consistent capitalization --- templates/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/public/index.html b/templates/public/index.html index cdcde695..8a7913cd 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -185,7 +185,7 @@

      More Resources

    • Logos & Artwork
    • News Archives
    • RSS Feeds
    • -
    • Developer Profiles
    • +
    • Developer Profiles
    • Trusted User Profiles
    • Fellows Profiles
    -- cgit v1.2.3-54-g00ecf From 23b955f8857e3110561cb77483a818e694353951 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 14:35:23 -0400 Subject: update README.BRANDING --- README.BRANDING | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.BRANDING b/README.BRANDING index 99df6a3b..37180c4b 100644 --- a/README.BRANDING +++ b/README.BRANDING @@ -13,12 +13,6 @@ Files used to configure branding/url stuff Files with minor Arch stuff that's just easier to patch ------------------------------------------------------- -`releng/views.py` - * link to `https://bugs.archlinux.org/index.php?project=6` - -`templates/packages/opensearch.xml` - * `` includes `archlinux` - `templates/packages/flaghelp.html` * link to "arch-general" mailing list -- cgit v1.2.3-54-g00ecf From c88c908c1eb39aa111c4eee8c8b25bf6ae457a36 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 14:35:39 -0400 Subject: use {{PROJECTS_URL}} in templates/public/svn.html --- templates/public/svn.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/public/svn.html b/templates/public/svn.html index 88c6df93..01c2ef80 100644 --- a/templates/public/svn.html +++ b/templates/public/svn.html @@ -9,9 +9,9 @@

    SVN Repositories

    The SVN repositories have been cloned into git repositories and can be viewed via the cgit interface. - All + All packages are available here except for - community + community and multilib which are available in a different repository.

    You can also get individual PKGBUILDs directly from SVN. This can be -- cgit v1.2.3-54-g00ecf From dfc054126b834df116522993f4a5bbd7837111eb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 15:02:21 -0400 Subject: fix stupid mistake --- main/context_processors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/context_processors.py b/main/context_processors.py index df9f1633..96a45dcf 100644 --- a/main/context_processors.py +++ b/main/context_processors.py @@ -6,7 +6,7 @@ def branding(request): return { 'BUGTRACKER_URL': settings.BUGTRACKER_URL, 'MAILMAN_BASE_URL': settings.MAILMAN_BASE_URL, - 'PROJECTS_URL': settings.BUGTRACKER_URL, + 'PROJECTS_URL': settings.PROJECTS_URL, 'BRANDING_APPNAME': settings.BRANDING_APPNAME, 'BRANDING_DISTRONAME': settings.BRANDING_DISTRONAME, -- cgit v1.2.3-54-g00ecf From 4ddc952c7720e95a6ec74dcded14cc403585ceab Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 15:03:23 -0400 Subject: introduce BRANDING_SLUG for releng --- README.BRANDING | 2 -- releng/models.py | 4 ++-- releng/views.py | 2 +- settings.py | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.BRANDING b/README.BRANDING index 37180c4b..a3855f77 100644 --- a/README.BRANDING +++ b/README.BRANDING @@ -26,8 +26,6 @@ Files with minor Arch stuff that's just easier to patch * link to AUR `urls.py` -`releng/views.py` -`releng/models.py` Files with a significant amount of Arch-specific content: --------------------------------------------------------- diff --git a/releng/models.py b/releng/models.py index 5ee2f325..47803a36 100644 --- a/releng/models.py +++ b/releng/models.py @@ -142,11 +142,11 @@ def dir_path(self): return "iso/%s/" % self.version def iso_url(self): - return "iso/%s/archlinux-%s-dual.iso" % (self.version, self.version) + return "iso/%s/%s-%s-dual.iso" % (self.version, settings.BRANDING_SLUG, self.version) def magnet_uri(self): query = [ - ('dn', "archlinux-%s-dual.iso" % self.version), + ('dn', "%s-%s-dual.iso" % (settings.BRANDING_SLUG, self.version)), ] if settings.TORRENT_TRACKERS: query.extend(('tr', uri) for uri in settings.TORRENT_TRACKERS) diff --git a/releng/views.py b/releng/views.py index ca0a7dd2..bc7ddb34 100644 --- a/releng/views.py +++ b/releng/views.py @@ -234,7 +234,7 @@ def release_torrent(request, version): data = b64decode(release.torrent_data.encode('utf-8')) response = HttpResponse(data, content_type='application/x-bittorrent') # TODO: this is duplicated from Release.iso_url() - filename = 'archlinux-%s-dual.iso.torrent' % release.version + filename = '%s-%s-dual.iso.torrent' % (settings.BRANDING_SLUG, release.version) response['Content-Disposition'] = 'attachment; filename=%s' % filename return response diff --git a/settings.py b/settings.py index 0bdc3162..dda8f74a 100644 --- a/settings.py +++ b/settings.py @@ -187,6 +187,7 @@ BRANDING_APPNAME = 'archweb' BRANDING_DISTRONAME = 'Arch Linux' BRANDING_SHORTNAME = 'Arch' +BRANDING_SLUG = 'archlinux' BRANDING_WIKINAME = 'ArchWiki' BRANDING_EMAIL = 'Arch Website Notification ' BRANDING_OSEARCH_TAGS = 'linux archlinux package software' -- cgit v1.2.3-54-g00ecf From 4578eb77da75c24f9b366c2ade46f55b0702b340 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 23 Apr 2013 15:03:31 -0400 Subject: reduce differences --- settings.py | 1 + templates/packages/opensearch.xml | 2 +- templates/public/donate.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/settings.py b/settings.py index dda8f74a..02a4d497 100644 --- a/settings.py +++ b/settings.py @@ -174,6 +174,7 @@ # URL for linking to the release engineering/iso project on the bugtracker BUGTRACKER_RELENG_URL = 'https://bugs.archlinux.org/index.php?project=6' +# URL for linking to projects in git PROJECTS_URL = 'https://projects.archlinux.org' # Trackers used for ISO download magnet links diff --git a/templates/packages/opensearch.xml b/templates/packages/opensearch.xml index 5aa4d5d7..0004b996 100644 --- a/templates/packages/opensearch.xml +++ b/templates/packages/opensearch.xml @@ -3,7 +3,7 @@ {{BRANDING_SHORTNAME}} Packages {{BRANDING_DISTRONAME}} Package Repository Search Search the {{BRANDING_DISTRONAME}} package repositories by keyword in package names and descriptions. - linux archlinux package software + {{BRANDING_OSEARCH_TAGS}} {{ domain }}{% static "favicon.ico" %} {{ domain }}{% static "logos/icon-transparent-64x64.png" %} en-us diff --git a/templates/public/donate.html b/templates/public/donate.html index 963a02ca..7b104e4e 100644 --- a/templates/public/donate.html +++ b/templates/public/donate.html @@ -8,7 +8,7 @@ {% cache 600 donations secure %}

    -

    Donate to Arch Linux

    +

    Donate to {{ BRANDING_SHORTNAME }}

    Arch Linux survives because of the tireless efforts of many people in the community and the core development circle. None of us are paid for -- cgit v1.2.3-54-g00ecf