From c8d0e5a7897d142f2b77da10b04d2ce47fe208e6 Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Fri, 15 Apr 2011 19:28:37 +0200 Subject: [PATCH] euscanwww: big ugly commit, sorry Signed-off-by: Corentin Chary --- euscan | 15 ++- euscanwww/annoying/__init__.pyc | Bin 141 -> 0 bytes euscanwww/annoying/decorators.pyc | Bin 8396 -> 0 bytes euscanwww/euscan/__init__.pyc | Bin 139 -> 0 bytes euscanwww/euscan/admin.pyc | Bin 255 -> 0 bytes euscanwww/euscan/forms.py | 7 ++ .../management/commands/list-packages.py | 47 ++++++++- .../management/commands/scan-metadata.py | 12 ++- .../management/commands/scan-portage.py | 1 + ...email__del_unique_maintainer_name_email.py | 99 ++++++++++++++++++ euscanwww/euscan/models.py | 5 +- euscanwww/euscan/templatetags/packages.py | 7 ++ euscanwww/euscan/urls.py | 8 +- euscanwww/euscan/urls.pyc | Bin 1129 -> 0 bytes euscanwww/euscan/views.py | 48 ++++++++- euscanwww/euscan/views.pyc | Bin 3225 -> 0 bytes euscanwww/settings.py | 17 ++- euscanwww/templates/_base.html | 12 ++- euscanwww/templates/euscan/_base.html | 46 -------- euscanwww/templates/euscan/_packages.html | 29 +++++ euscanwww/templates/euscan/category.html | 32 +----- euscanwww/templates/euscan/herd.html | 12 +++ euscanwww/templates/euscan/herds.html | 38 +++++++ euscanwww/templates/euscan/maintainer.html | 12 +++ euscanwww/templates/euscan/maintainers.html | 38 +++++++ euscanwww/templates/euscan/package.html | 2 +- euscanwww/templates/euscan/world.html | 28 +++++ euscanwww/templates/euscan/world_scan.html | 12 +++ 28 files changed, 428 insertions(+), 99 deletions(-) delete mode 100644 euscanwww/annoying/__init__.pyc delete mode 100644 euscanwww/annoying/decorators.pyc delete mode 100644 euscanwww/euscan/__init__.pyc delete mode 100644 euscanwww/euscan/admin.pyc create mode 100644 euscanwww/euscan/forms.py create mode 100644 euscanwww/euscan/migrations/0002_auto__add_unique_maintainer_email__del_unique_maintainer_name_email.py create mode 100644 euscanwww/euscan/templatetags/packages.py delete mode 100644 euscanwww/euscan/urls.pyc delete mode 100644 euscanwww/euscan/views.pyc delete mode 100644 euscanwww/templates/euscan/_base.html create mode 100644 euscanwww/templates/euscan/_packages.html create mode 100644 euscanwww/templates/euscan/herd.html create mode 100644 euscanwww/templates/euscan/herds.html create mode 100644 euscanwww/templates/euscan/maintainer.html create mode 100644 euscanwww/templates/euscan/maintainers.html create mode 100644 euscanwww/templates/euscan/world.html create mode 100644 euscanwww/templates/euscan/world_scan.html diff --git a/euscan b/euscan index ff54642..4905187 100755 --- a/euscan +++ b/euscan @@ -45,10 +45,13 @@ from gentoolkit.eclean.search import (port_settings) QUERY_OPTS = {"include_masked": True} +BLACKLIST_PACKAGES = ['sys-kernel/usermode-sources', 'sys-kernel/xbox-sources', + 'sys-kernel/cell-sources', 'sys-libs/libstdc++-v3'] + SCANDIR_BLACKLIST_URLS = ['mirror://rubygems/(.*)', 'mirror://gentoo/(.*)'] BRUTEFORCE_BLACKLIST_PACKAGES = ['dev-util/patchelf', 'net-zope/plonepopoll'] -BRUTEFORCE_BLACKLIST_URLS = ['http://www.dockapps.org/download.php/id/(.*)'] +BRUTEFORCE_BLACKLIST_URLS = ['http://(.*)dockapps.org/download.php/id/(.*)'] # ========= # Functions @@ -282,11 +285,16 @@ def scan_directory_recursive(url, steps, vmin, vmax, output): for version, path in results: ver = parse_version(version) + if vmin and ver <= vmin: continue if vmax and ver >= vmax: continue + # Try to skip nightly builds when not wanted (www-apps/moodle) + if len(vmin) != len(ver) and len(ver) == 2 and len(ver[0]) == len('yyyymmdd'): + continue + if not url.endswith('/') and not path.startswith('/'): path = url + '/' + path else: @@ -576,6 +584,7 @@ def scanUpstream(options, package, output): matches = sorted(matches) pkg = matches.pop() + if pkg.version == '9999': if len(matches) == 0: sys.stderr.write(pp.warn("Package '%s' only have a dev version (9999)" % pp.pkgquery(package))) @@ -583,6 +592,10 @@ def scanUpstream(options, package, output): else: pkg = matches.pop() + if pkg.cp in BLACKLIST_PACKAGES: + sys.stderr.write(pp.warn("Package '%s' is blacklisted" % pp.pkgquery(package))) + sys.exit(errno.ENOENT) + pp.uprint(" * %s [%s]" % (pp.cpv(pkg.cpv), pp.section(pkg.repo_name()))) pp.uprint() diff --git a/euscanwww/annoying/__init__.pyc b/euscanwww/annoying/__init__.pyc deleted file mode 100644 index 6915190058d2e87378b2a9edab1709ea80dbc5ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 141 zcmcckiI?k^<5J&b1}I1X8Urs`*A7bj+> z=@%Cz>!+3$Cnx4Xsq*r2{lvVy{L0L{bp81F%)HE!_;|g7$`THsR-4@Xl+v73JCFs% HK+FID!YUvr diff --git a/euscanwww/annoying/decorators.pyc b/euscanwww/annoying/decorators.pyc deleted file mode 100644 index 2ed3c22908ec02ff37f04a22ba2e9ac17b09ecc0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8396 zcmcIpTa(nr6>iP!owb2AU}Kl7>T0d-`gOHAp^{0pHtG5k zYI8~@(`s$T^(WQltV-t8+MMf8sm((wnOAG`=ufL?Mn$tKnp5owwf2hIJtmtTQk$=; zX}lXuN_n781L4wEAHoH`1oM>xQb4&vvxv7uglHrTynMX7Q_+%2Y(HSL=_8Y za+5|T4~i_vjqPQrHEwJYV;foCwXXXry1sebH@3KurG?ok-1BKXw{bfSlXBub9(+<1 zJ%7(?b26>lOUxsS*JsfkZ0y(3EBIdcDBJ-VvWv_K`$cApJnju?+RnqCEx29~bhD_R zm>?)-q??9ac1ThXL|JPv5XG$`2wL1{0vCUI*^_9V*VJ=QJqNROYRETAJ*}%JbqK45 z(Ulej#XD~C8ZH~6*;!OCJazNIyXvW@3Z|v{-#MpVD9mig zOs|}Y32|*Wzk_3~t7lNl$LH03EVe5At~5k4B4Sg7MUe|{?ecyKg!Fq+SQsHy#weYh z$qTZ{7ltdinURPpv^+8sjl2>y@P@Jhy5?-WX~THqtj$|zP2aY{wEWrL-aZ?q z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G z)i11+7)1bX#1~modgaWjNGN5<(IukwCK70qSo!+vFL4JRQTbknUy$h#MTX_Wei387 zU>rxUBr0-rQk}>$49kIWrQ6*esJxZuXt~l#mKrIp3BBckoWX#@Ph8Qb5QhgMcjKuj r7rf*u1y?8=dkW1F)Hln2wS{^eC-kaU_m0jTzI5WpvlAy~XHWbWg-g!D diff --git a/euscanwww/euscan/__init__.pyc b/euscanwww/euscan/__init__.pyc deleted file mode 100644 index 6c1ec8bc03ae486774fd3b3b3dca697227ce52f8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 139 zcmcckiI=N1Zi#O)0~9a_ui>ls1ZH!?K)yc- ze@Nb+1>L=#dqIYXP`8*s5t5KIG9ssB(#MNhh)_!IJy|D{Rx7Gb+_3 jaGj^%MXDMQ+z!&V?Kt?|svlvFTWkEdsnlkQHDHo2`O`)1 diff --git a/euscanwww/euscan/forms.py b/euscanwww/euscan/forms.py new file mode 100644 index 0000000..5dc0bb1 --- /dev/null +++ b/euscanwww/euscan/forms.py @@ -0,0 +1,7 @@ +from django import forms + +class WorldFileForm(forms.Form): + world_file = forms.FileField() + +class WorldForm(forms.Form): + world = forms.CharField(widget=forms.Textarea) diff --git a/euscanwww/euscan/management/commands/list-packages.py b/euscanwww/euscan/management/commands/list-packages.py index 8233966..842e24a 100644 --- a/euscanwww/euscan/management/commands/list-packages.py +++ b/euscanwww/euscan/management/commands/list-packages.py @@ -1,3 +1,5 @@ +from optparse import make_option + from django.core.management.base import BaseCommand, CommandError from euscanwww.euscan.models import Package @@ -5,6 +7,49 @@ class Command(BaseCommand): _overlays = {} help = 'List packages' + option_list = BaseCommand.option_list + ( + make_option('--after', + action='store', + dest='after', + default=False, + help='After package'), + make_option('--before', + action='store', + dest='before', + default=False, + help='Before package'), + make_option('--limit', + action='store', + dest='limit', + default=False, + help='limit'), + ) + def handle(self, *args, **options): - for pkg in Package.objects.all(): + after = None + before = None + + if options['after']: + category, name = options['after'].split('/') + after = Package.objects.get(category=category, name=name) + + if options['before']: + category, name = options['before'].split('/') + before = Package.objects.get(category=category, name=name) + + packages = Package.objects + + if after or before: + if after: + packages = packages.filter(id__gte=after.id) + if before: + packages = packages.filter(id__lte=before.id) + else: + packages = packages.all() + + if options['limit']: + packages = packages[:int(options['limit'])] + + for pkg in packages: self.stdout.write('%s/%s\n' % (pkg.category, pkg.name)) + self.stdout.close() diff --git a/euscanwww/euscan/management/commands/scan-metadata.py b/euscanwww/euscan/management/commands/scan-metadata.py index 1a92ebc..f6d0bd0 100644 --- a/euscanwww/euscan/management/commands/scan-metadata.py +++ b/euscanwww/euscan/management/commands/scan-metadata.py @@ -74,6 +74,9 @@ class Command(BaseCommand): sys.stderr.write(self.style.ERROR("Gentoolkit fatal error: '%s'\n" % str(err))) if pkg.metadata: + obj.herds.clear() + obj.maintainers.clear() + for herd in pkg.metadata.herds(True): herd = self.store_herd(options, herd[0], herd[1]) obj.herds.add(herd) @@ -88,6 +91,10 @@ class Command(BaseCommand): obj.save() def store_herd(self, options, name, email): + if not name: + name = '{nil}' + name = name.strip("\r").strip("\n").strip("\t").strip() + herd, created = Herd.objects.get_or_create(herd=name) if created or herd.email != email: @@ -102,13 +109,16 @@ class Command(BaseCommand): def store_maintainer(self, options, name, email): if not name: name = email + if not name: + name = '{nil}' - maintainer, created = Maintainer.objects.get_or_create(name=name, email=email) + maintainer, created = Maintainer.objects.get_or_create(email=email) if created: if not options['quiet']: sys.stdout.write('[m] %s <%s>\n' % (name.encode('utf-8'), email)) + maintainer.name = name maintainer.save() return maintainer diff --git a/euscanwww/euscan/management/commands/scan-portage.py b/euscanwww/euscan/management/commands/scan-portage.py index f08fcd8..d276742 100644 --- a/euscanwww/euscan/management/commands/scan-portage.py +++ b/euscanwww/euscan/management/commands/scan-portage.py @@ -120,6 +120,7 @@ class Command(BaseCommand): # Delete previous versions to handle incremental scan correctly Version.objects.filter(package=obj, packaged=True).delete() + obj.n_packaged = 0 obj.n_versions = Version.objects.filter(package=obj).count() obj.save() diff --git a/euscanwww/euscan/migrations/0002_auto__add_unique_maintainer_email__del_unique_maintainer_name_email.py b/euscanwww/euscan/migrations/0002_auto__add_unique_maintainer_email__del_unique_maintainer_name_email.py new file mode 100644 index 0000000..8c8b720 --- /dev/null +++ b/euscanwww/euscan/migrations/0002_auto__add_unique_maintainer_email__del_unique_maintainer_name_email.py @@ -0,0 +1,99 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Removing unique constraint on 'Maintainer', fields ['name', 'email'] + db.delete_unique('euscan_maintainer', ['name', 'email']) + + # Adding unique constraint on 'Maintainer', fields ['email'] + db.create_unique('euscan_maintainer', ['email']) + + + def backwards(self, orm): + + # Removing unique constraint on 'Maintainer', fields ['email'] + db.delete_unique('euscan_maintainer', ['email']) + + # Adding unique constraint on 'Maintainer', fields ['name', 'email'] + db.create_unique('euscan_maintainer', ['name', 'email']) + + + models = { + 'euscan.categorylog': { + 'Meta': {'object_name': 'CategoryLog'}, + 'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'datetime': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'n_packaged': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'n_packages': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'n_versions': ('django.db.models.fields.IntegerField', [], {'default': '0'}) + }, + 'euscan.euscanresult': { + 'Meta': {'object_name': 'EuscanResult'}, + 'datetime': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['euscan.Package']"}), + 'result': ('django.db.models.fields.TextField', [], {'blank': 'True'}) + }, + 'euscan.herd': { + 'Meta': {'object_name': 'Herd'}, + 'email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'herd': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'euscan.herdlog': { + 'Meta': {'object_name': 'HerdLog'}, + 'datetime': ('django.db.models.fields.DateTimeField', [], {}), + 'herd': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['euscan.Herd']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'n_packaged': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'n_packages': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'n_versions': ('django.db.models.fields.IntegerField', [], {'default': '0'}) + }, + 'euscan.maintainer': { + 'Meta': {'object_name': 'Maintainer'}, + 'email': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'euscan.maintainerlog': { + 'Meta': {'object_name': 'MaintainerLog'}, + 'datetime': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'maintainer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['euscan.Maintainer']"}), + 'n_packaged': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'n_packages': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'n_versions': ('django.db.models.fields.IntegerField', [], {'default': '0'}) + }, + 'euscan.package': { + 'Meta': {'unique_together': "(['category', 'name'],)", 'object_name': 'Package'}, + 'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'herds': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['euscan.Herd']", 'symmetrical': 'False', 'blank': 'True'}), + 'homepage': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'maintainers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['euscan.Maintainer']", 'symmetrical': 'False', 'blank': 'True'}), + 'n_packaged': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'n_versions': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'euscan.version': { + 'Meta': {'unique_together': "(['package', 'slot', 'revision', 'version', 'overlay'],)", 'object_name': 'Version'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'overlay': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['euscan.Package']"}), + 'packaged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'revision': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'slot': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'urls': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'version': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + } + } + + complete_apps = ['euscan'] diff --git a/euscanwww/euscan/models.py b/euscanwww/euscan/models.py index 04e46dc..7d34b63 100644 --- a/euscanwww/euscan/models.py +++ b/euscanwww/euscan/models.py @@ -11,14 +11,11 @@ class Herd(models.Model): class Maintainer(models.Model): name = models.CharField(max_length=128) - email = models.CharField(max_length=128) + email = models.CharField(max_length=128, unique=True) def __unicode__(self): return '%s <%s>' % (self.name, self.email) - class Meta: - unique_together = ['name', 'email'] - class Package(models.Model): category = models.CharField(max_length=128) name = models.CharField(max_length=128) diff --git a/euscanwww/euscan/templatetags/packages.py b/euscanwww/euscan/templatetags/packages.py new file mode 100644 index 0000000..81fb2a3 --- /dev/null +++ b/euscanwww/euscan/templatetags/packages.py @@ -0,0 +1,7 @@ +from django import template + +register = template.Library() + +@register.inclusion_tag('euscan/_packages.html') +def packages(packages): + return { 'packages' : packages } diff --git a/euscanwww/euscan/urls.py b/euscanwww/euscan/urls.py index 08c3873..3b026c4 100644 --- a/euscanwww/euscan/urls.py +++ b/euscanwww/euscan/urls.py @@ -3,11 +3,13 @@ from django.conf.urls.defaults import * urlpatterns = patterns('euscan.views', (r'^$', 'index'), (r'^logs/$', 'logs'), + (r'^world/$', 'world'), + (r'^world/scan/$', 'world_scan'), (r'^categories/$', 'categories'), - (r'^category/(?P[\w+][\w+.-]*)/packages/$', 'category'), + (r'^categories/(?P[\w+][\w+.-]*)/view/$', 'category'), (r'^herds/$', 'herds'), - (r'^herd/(?P[\w+][\w+.-]*)/packages/$', 'herd'), + (r'^herds/(?P[\{\}\w+.-]*)/view/$', 'herd'), (r'^maintainers/$', 'maintainers'), - (r'^maintainer/(?P\d+)/packages/$', 'maintainer'), + (r'^maintainers/(?P\d+)/view/$', 'maintainer'), (r'^package/(?P[\w+][\w+.-]*)/(?P[\w+][\w+.-]*)/$', 'package'), ) diff --git a/euscanwww/euscan/urls.pyc b/euscanwww/euscan/urls.pyc deleted file mode 100644 index c63d84b8d839e6ceca36c65e0e181067a3a3b3b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1129 zcmb`G%}(1u5XUD8EmeS?fHvjpl7kDv=F%HV+XrY>0Vh6!R-R4RCb1*W1~=zEOkbv# zzDi#JW_Im52@(>hPCUE*&+K@1e%?QS*P6f0uP-qa*BXzX_@)nRkpDFp0G#O>U>$H1 z@D1Qwz!u;;z%9USz#YI{_}PSW4%mRxV2@XtJHCP%&#ahzT4k#z6ssh>H99A%v(RnZ z7d)5*^$%JWVVL$QYTG5A%ao*?Zmg{CrYO+!ZbTkt%je?Kgjtl3sb8(p;T!{$} zulCNql3mJia|%k?B^B+Fgi^0t_F7hrlu0b#I+K(uEX^o% zI3MEDSN>~*ol88JD_6E$MbKwSQ0(T>9ZNTgxW(GrR@z-SzXk%MAVU9$cy$KLiG+Fe z0T-I*;-j7e$MGl``ZTkITzRh5-uDztRATZ=AF`qaRzB{@z+5jXU_Q%#q2>-rK`m%7 z4clUa-&N92!#GWP;UpVUh`OgHLrYdVH&)i_EFt$Hvb%hi&Ov3|Ns4aLk&euOl<7s3 l#gRX<#gONDDY(~+r|t#EqZB7Y-I0S%>uj3!m$k;i?;gs=FE#)G diff --git a/euscanwww/euscan/views.py b/euscanwww/euscan/views.py index 523496b..0609453 100644 --- a/euscanwww/euscan/views.py +++ b/euscanwww/euscan/views.py @@ -4,13 +4,14 @@ from django.shortcuts import get_object_or_404 from django.db.models import Sum, Max from euscan.models import Version, Package, Herd, Maintainer, EuscanResult +from euscan.forms import WorldForm, WorldFileForm @render_to('euscan/index.html') def index(request): ctx = {} ctx['n_packaged'] = Package.objects.aggregate(Sum('n_packaged'))['n_packaged__sum'] ctx['n_versions'] = Package.objects.aggregate(Sum('n_versions'))['n_versions__sum'] - if ctx['n_versions'] is not None and ctx['n_pacaged'] is not None: + if ctx['n_versions'] is not None and ctx['n_packaged'] is not None: ctx['n_upstream'] = ctx['n_versions'] - ctx['n_packaged'] ctx['n_packages'] = Package.objects.count() ctx['n_herds'] = Herd.objects.count() @@ -36,19 +37,26 @@ def category(request, category): @render_to('euscan/herds.html') def herds(request): - return {} + # FIXME: optimize the query, it uses 'LEFT OUTER JOIN' instead of 'INNER JOIN' + herds = Package.objects.filter(herds__isnull=False).values('herds__herd').annotate(n_packaged=Sum('n_packaged'), n_versions=Sum('n_versions')) + return { 'herds' : herds } @render_to('euscan/herd.html') def herd(request, herd): - return {} + herd = get_object_or_404(Herd, herd=herd) + packages = Package.objects.filter(herds__id=herd.id) + return { 'herd' : herd, 'packages' : packages } @render_to('euscan/maintainers.html') def maintainers(request): - return {} + maintainers = Package.objects.filter(maintainers__isnull=False).values('maintainers__id', 'maintainers__name').annotate(n_packaged=Sum('n_packaged'), n_versions=Sum('n_versions')) + return { 'maintainers' : maintainers } @render_to('euscan/maintainer.html') def maintainer(request, maintainer_id): - return {} + maintainer = get_object_or_404(Maintainer, id=maintainer_id) + packages = Package.objects.filter(maintainers__id=maintainer.id) + return { 'maintainer' : maintainer, 'packages' : packages } @render_to('euscan/package.html') def package(request, category, package): @@ -56,3 +64,33 @@ def package(request, category, package): packaged = Version.objects.filter(package=package, packaged=True) upstream = Version.objects.filter(package=package, packaged=False) return { 'package' : package, 'packaged' : packaged, 'upstream' : upstream } + +@render_to('euscan/world.html') +def world(request): + form = WorldForm() + file_form = WorldFileForm() + + return { 'form' : form , 'file_form' : file_form } + +@render_to('euscan/world_scan.html') +def world_scan(request): + packages = [] + + # FIXME + if 'world_file' in request.FILES: + data = request.FILES['world_file'].read() + elif 'world' in request.POST: + data = request.POST['world'] + else: + data = "" + + for pkg in data.split('\n'): + try: + cat, pkg = pkg.split('/') + packages.append(Package.objects.get(category=cat, name=pkg)) + except: + pass + + return { 'packages' : packages } + + diff --git a/euscanwww/euscan/views.pyc b/euscanwww/euscan/views.pyc deleted file mode 100644 index ca2b0f7d8ecbcd73bb05842d02e791c3b83cc293..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3225 zcmc&$+ioL85Un2HVkh1tn>aUatK}lYLcB=J3W*3IA<(|WLKEP@FQZvcuRZa2#!R%qh$-`zcJ>92!s%xswsrDa#wOc=#-;ak>{5AOb4d14x zh$8-1G$Be94HPMiJ(_rwRA^9f;|fixl+XbBS(4b_61}hG&(WFU9iv}%9 zR%x(G$r=sTC~4E6P00fqJRqeNMRmI7wn4uUI)ilrxFTS)1UCe13AkE0 zxlSXU2R3sM!u!J7*|Vq59I(m2NZTNLd8&u}$OBAyc)h~S$$To$)gay zD*YeA;Ur`ORmNZFJhCnB9EWjg`PR8zC_1_|Un%FSZoWcCSXQBZ=FVx8vL~bf z)NX(S2k;7KZ+{QZIvu4`TDXVCLc&*>wgN!yqu60mL*7&Rp0{v7{WjCCIhB#>sF=NQ3#z*j$I@`^6SU z@|Ff;&X%$8Aq}QC2{Y_Dt1PtI##1fRCUyi$f&TcfMiLKj6j`kBzYh;t z8$@Seg3KY#VVY*Pq=4jBBILivbN3CC7(u}^h!=TJm1OmHkS<*U%gO>KN{GJX&T@!Y z+t;LCdvxW|ti`&o(65S60mh7Rz!W{_DUKe;2Uhz2yD))|EM?V&AODKQt2nVb_rVQ$ z&3!&z^&bP{`#!7|Ct%IM5%M~!p;~IW#EQt@2#cX}+5JQKSI~G#UYJ{C2lM|cFD#Jg zNhQI{_YNK$`*_K@UG5k3S*nL`BzUXr%90PCEqS?A2^K5v6iAf*g^3`(cSNN)EG(i> zmxuULzi`GOcJ1$`egqE04u#J>o(Za}}#Vs8N-;tY35e;&S%i zDgG(PQ&k$f#T8aCS3$0DS8SjLA!E}*$k1*Y@_~o5r|@uD-H{B+1GOthmrxQme0+fv zK>vO22}6I(=kBcgK1_^ubrPq8NY?)Zy(efs<>uZ@hPf~JF3P~3dW)}qcaI^9$fFKl z#_8xV(!(qdZI&CKVY1*^bQ-3kjMHIfQm8CMT7YJp<#sr?#>dAl&qOZ|r&**EBgeZO z-tuF?CAplFz(|NBVyIH?uzwr9chKN0a6$P1J&4l(2o0hlfm(z|dUrfkvG)

diff --git a/euscanwww/templates/euscan/_base.html b/euscanwww/templates/euscan/_base.html deleted file mode 100644 index 586ec90..0000000 --- a/euscanwww/templates/euscan/_base.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - {% block title %}euscan{% endblock %} - - {% block css %} - - {% endblock %} - {% block javascript %} - {% endblock %} - - - -
- {% block content %} - {% endblock %} -
- - - - diff --git a/euscanwww/templates/euscan/_packages.html b/euscanwww/templates/euscan/_packages.html new file mode 100644 index 0000000..27ebb23 --- /dev/null +++ b/euscanwww/templates/euscan/_packages.html @@ -0,0 +1,29 @@ +{% load sub %} +{% load mul %} + + + + + + + + + {% for package in packages %} + {% if package.n_versions == package.n_packaged %} + + {% else %}{% if package.n_versions < package.n_packaged|mul:2 %} + + {% else %} + + {% endif %}{% endif %} + + + + + {% endfor %} + +
PackageEbuildsUnpackaged
+ + {{ package.category }}/{{ package.name }} + + {{ package.n_packaged }}{{ package.n_versions|sub:package.n_packaged }}
diff --git a/euscanwww/templates/euscan/category.html b/euscanwww/templates/euscan/category.html index 1319fe7..ecbef56 100644 --- a/euscanwww/templates/euscan/category.html +++ b/euscanwww/templates/euscan/category.html @@ -1,38 +1,12 @@ {% extends "euscan/_datatable.html" %} -{% load sub %} -{% load mul %} +{% load packages %} {% block title %} -{{ block.super }} - {{ category }} +{{ block.super }} - Category: {{ category }} {% endblock %} {% block content %}

Category: {{ category }}

- - - - - - - - {% for package in packages %} - {% if package.n_versions == package.n_packaged %} - - {% else %}{% if package.n_versions < package.n_packaged|mul:2 %} - - {% else %} - - {% endif %}{% endif %} - - - - - {% endfor %} - -
PackageEbuildsUnpackaged
- - {{ package.category }}/{{ package.name }} - - {{ package.n_packaged }}{{ package.n_versions|sub:package.n_packaged }}
+{% packages packages %} {% endblock %} diff --git a/euscanwww/templates/euscan/herd.html b/euscanwww/templates/euscan/herd.html new file mode 100644 index 0000000..60bc50d --- /dev/null +++ b/euscanwww/templates/euscan/herd.html @@ -0,0 +1,12 @@ +{% extends "euscan/_datatable.html" %} + +{% load packages %} + +{% block title %} +{{ block.super }} - Herd: {{ herd.herd }} +{% endblock %} + +{% block content %} +

Herd: {{ herd.herd }}

+{% packages packages %} +{% endblock %} diff --git a/euscanwww/templates/euscan/herds.html b/euscanwww/templates/euscan/herds.html new file mode 100644 index 0000000..6dfbb35 --- /dev/null +++ b/euscanwww/templates/euscan/herds.html @@ -0,0 +1,38 @@ +{% extends "euscan/_datatable.html" %} + +{% load sub %} +{% load mul %} + +{% block title %} +{{ block.super }} - herds +{% endblock %} + +{% block content %} +

Herds

+ + + + + + + + {% for herd in herds %} + {% if herd.n_versions == herd.n_packaged %} + + {% else %}{% if herd.n_versions < herd.n_packaged|mul:2 %} + + {% else %} + + {% endif %}{% endif %} + + + + + {% endfor %} + +
HerdEbuildsUnpackaged
+ + {{ herd.herds__herd }} + + {{ herd.n_packaged }}{{ herd.n_versions|sub:herd.n_packaged }}
+{% endblock %} diff --git a/euscanwww/templates/euscan/maintainer.html b/euscanwww/templates/euscan/maintainer.html new file mode 100644 index 0000000..2c4c76e --- /dev/null +++ b/euscanwww/templates/euscan/maintainer.html @@ -0,0 +1,12 @@ +{% extends "euscan/_datatable.html" %} + +{% load packages %} + +{% block title %} +{{ block.super }} - Maintainer: {{ maintainer.name }} +{% endblock %} + +{% block content %} +

Maintainer: {{ maintainer.name }} <{{ maintainer.email }}>

+{% packages packages %} +{% endblock %} diff --git a/euscanwww/templates/euscan/maintainers.html b/euscanwww/templates/euscan/maintainers.html new file mode 100644 index 0000000..569630d --- /dev/null +++ b/euscanwww/templates/euscan/maintainers.html @@ -0,0 +1,38 @@ +{% extends "euscan/_datatable.html" %} + +{% load sub %} +{% load mul %} + +{% block title %} +{{ block.super }} - maintainers +{% endblock %} + +{% block content %} +

Maintainers

+ + + + + + + + {% for maintainer in maintainers %} + {% if maintainer.n_versions == maintainer.n_packaged %} + + {% else %}{% if maintainer.n_versions < maintainer.n_packaged|mul:2 %} + + {% else %} + + {% endif %}{% endif %} + + + + + {% endfor %} + +
MaintainerEbuildsUnpackaged
+ + {{ maintainer.maintainers__name }} + + {{ maintainer.n_packaged }}{{ maintainer.n_versions|sub:maintainer.n_packaged }}
+{% endblock %} diff --git a/euscanwww/templates/euscan/package.html b/euscanwww/templates/euscan/package.html index 70bd110..4851931 100644 --- a/euscanwww/templates/euscan/package.html +++ b/euscanwww/templates/euscan/package.html @@ -63,7 +63,7 @@
    {% for version in upstream %}
  • - {{ version.version }} - {{ version.url }} + {{ version.version }} - {{ version.urls }}
  • {% endfor %}
diff --git a/euscanwww/templates/euscan/world.html b/euscanwww/templates/euscan/world.html new file mode 100644 index 0000000..a7c7da2 --- /dev/null +++ b/euscanwww/templates/euscan/world.html @@ -0,0 +1,28 @@ +{% extends "_base.html" %} + +{% block title %} +{{ block.super }} - World scan +{% endblock %} + +{% block content %} +

Scan your packages

+ +
+ +

Import your /var/lib/portage/world file

+ +
{% csrf_token %} +{{ file_form.as_p }} + +
+ +
+ +

Or just list some packages

+ +
{% csrf_token %} +{{ form.as_p }} + +
+ +{% endblock %} diff --git a/euscanwww/templates/euscan/world_scan.html b/euscanwww/templates/euscan/world_scan.html new file mode 100644 index 0000000..ebb6561 --- /dev/null +++ b/euscanwww/templates/euscan/world_scan.html @@ -0,0 +1,12 @@ +{% extends "euscan/_datatable.html" %} + +{% load packages %} + +{% block title %} +{{ block.super }} - World Scan +{% endblock %} + +{% block content %} +

World scan:

+{% packages packages %} +{% endblock %}