euscanwwww: implement scan-portage and scan-metadata
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
This commit is contained in:
parent
0b0595d23c
commit
2a61dfa982
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
*~
|
||||
*.pyc
|
0
euscanwww/euscan/management/__init__.py
Normal file
0
euscanwww/euscan/management/__init__.py
Normal file
0
euscanwww/euscan/management/commands/__init__.py
Normal file
0
euscanwww/euscan/management/commands/__init__.py
Normal file
110
euscanwww/euscan/management/commands/scan-metadata.py
Normal file
110
euscanwww/euscan/management/commands/scan-metadata.py
Normal file
@ -0,0 +1,110 @@
|
||||
import subprocess
|
||||
import portage
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
from portage import versions
|
||||
from optparse import make_option
|
||||
|
||||
from django.db.transaction import commit_on_success
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from euscanwww.euscan.models import Package, Herd, Maintainer
|
||||
|
||||
from gentoolkit.query import Query
|
||||
from gentoolkit.eclean.search import (port_settings)
|
||||
|
||||
class Command(BaseCommand):
|
||||
_overlays = {}
|
||||
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option('--all',
|
||||
action='store_true',
|
||||
dest='all',
|
||||
default=False,
|
||||
help='Scan all packages'),
|
||||
make_option('--quiet',
|
||||
action='store_true',
|
||||
dest='quiet',
|
||||
default=False,
|
||||
help='Be quiet'),
|
||||
)
|
||||
args = '<package package ...>'
|
||||
help = 'Scans metadata and fills database'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if len(args) == 0 and options['all'] == False:
|
||||
raise CommandError('You must specify a package or use --all')
|
||||
|
||||
if not options['quiet']:
|
||||
self.stdout.write('Scanning portage tree...\n')
|
||||
|
||||
if len(args) == 0:
|
||||
for pkg in Package.objects.all():
|
||||
self.scan(options, '%s/%s' % (pkg.category, pkg.name))
|
||||
else:
|
||||
for package in args:
|
||||
self.scan(options, package)
|
||||
|
||||
if not options['quiet']:
|
||||
self.stdout.write('Done.\n')
|
||||
|
||||
@commit_on_success
|
||||
def scan(self, options, query=None):
|
||||
matches = Query(query).find(
|
||||
include_masked=True,
|
||||
in_installed=False
|
||||
)
|
||||
|
||||
if not matches:
|
||||
sys.stderr.write(self.style.ERROR("Unknown package '%s'\n" % query))
|
||||
return
|
||||
|
||||
matches = sorted(matches)
|
||||
pkg = matches.pop()
|
||||
if pkg.version == '9999':
|
||||
pkg = matches.pop()
|
||||
|
||||
obj, created = Package.objects.get_or_create(category=pkg.category, name=pkg.name)
|
||||
|
||||
obj.homepage = pkg.environment("HOMEPAGE")
|
||||
obj.description = pkg.environment("DESCRIPTION")
|
||||
|
||||
for herd in pkg.metadata.herds(True):
|
||||
herd = self.store_herd(options, herd[0], herd[1])
|
||||
obj.herds.add(herd)
|
||||
|
||||
for maintainer in pkg.metadata.maintainers():
|
||||
maintainer = self.store_maintainer(options, maintainer.name, maintainer.email)
|
||||
obj.maintainers.add(maintainer)
|
||||
|
||||
if not options['quiet']:
|
||||
sys.stdout.write('[p] %s/%s\n' % (pkg.category, pkg.name))
|
||||
|
||||
obj.save()
|
||||
|
||||
def store_herd(self, options, name, email):
|
||||
herd, created = Herd.objects.get_or_create(herd=name)
|
||||
|
||||
if created or herd.email != email:
|
||||
if not options['quiet']:
|
||||
sys.stdout.write('[h] %s <%s>\n' % (name, email))
|
||||
|
||||
herd.email = email
|
||||
herd.save()
|
||||
|
||||
return herd
|
||||
|
||||
def store_maintainer(self, options, name, email):
|
||||
if not name:
|
||||
name = email
|
||||
|
||||
maintainer, created = Maintainer.objects.get_or_create(name=name, email=email)
|
||||
|
||||
if created:
|
||||
if not options['quiet']:
|
||||
sys.stdout.write('[m] %s <%s>\n' % (name.encode('utf-8'), email))
|
||||
|
||||
maintainer.save()
|
||||
|
||||
return maintainer
|
147
euscanwww/euscan/management/commands/scan-portage.py
Normal file
147
euscanwww/euscan/management/commands/scan-portage.py
Normal file
@ -0,0 +1,147 @@
|
||||
import subprocess
|
||||
import portage
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
from portage import versions
|
||||
from optparse import make_option
|
||||
|
||||
from django.db.transaction import commit_on_success
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from euscanwww.euscan.models import Package, Version
|
||||
|
||||
class Command(BaseCommand):
|
||||
_overlays = {}
|
||||
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option('--all',
|
||||
action='store_true',
|
||||
dest='all',
|
||||
default=False,
|
||||
help='Scan all packages'),
|
||||
make_option('--quiet',
|
||||
action='store_true',
|
||||
dest='quiet',
|
||||
default=False,
|
||||
help='Be quiet'),
|
||||
)
|
||||
args = '<package package ...>'
|
||||
help = 'Scans portage tree and fills database'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if len(args) == 0 and options['all'] == False:
|
||||
raise CommandError('You must specify a package or use --all')
|
||||
|
||||
if not options['quiet']:
|
||||
self.stdout.write('Scanning portage tree...\n')
|
||||
|
||||
Version.objects.all().delete()
|
||||
Package.objects.all().delete()
|
||||
|
||||
for package in args:
|
||||
self.scan(options, package)
|
||||
|
||||
if len(args) == 0:
|
||||
self.scan(options)
|
||||
|
||||
if not options['quiet']:
|
||||
self.stdout.write('Done.\n')
|
||||
|
||||
def overlays(self):
|
||||
if self._overlays:
|
||||
return self._overlays
|
||||
|
||||
env = os.environ
|
||||
env['OVERLAYS_LIST'] = 'all'
|
||||
env['PRINT_COUNT_ALWAYS'] = 'never'
|
||||
|
||||
cmd = ['eix', '-!']
|
||||
|
||||
output = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
|
||||
output = output.strip().strip('\n').split('\n')
|
||||
|
||||
overlay_re = re.compile(r'^\[(?P<key>\d+)] "(?P<name>.*?)"')
|
||||
|
||||
self._overlays = {}
|
||||
|
||||
for line in output:
|
||||
match = overlay_re.match(line)
|
||||
if not match:
|
||||
continue
|
||||
self._overlays[match.group('key')] = match.group('name')
|
||||
|
||||
return self._overlays
|
||||
|
||||
@commit_on_success
|
||||
def scan(self, options, query=None):
|
||||
env = os.environ
|
||||
env['MY'] = "<category>/<name>-<version>:<slot> [<overlaynum>]\n"
|
||||
|
||||
cmd = ['eix', '--format', '<availableversions:MY>', '--pure-packages', '-x']
|
||||
if query:
|
||||
cmd.extend(['--exact', query])
|
||||
|
||||
output = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
|
||||
output = output.strip().strip('\n')
|
||||
|
||||
if len(output) == 0:
|
||||
if package:
|
||||
sys.stderr.write(self.style.ERROR("Unknown package '%s'\n" % package))
|
||||
return
|
||||
|
||||
output = output.split('\n')
|
||||
|
||||
line_re = re.compile(r'^(?P<cpv>.*?):(?P<slot>.*?) \[(?P<overlay>.*?)\]$')
|
||||
|
||||
package = None
|
||||
|
||||
for line in output:
|
||||
match = line_re.match(line)
|
||||
|
||||
if not match:
|
||||
continue
|
||||
|
||||
cpv = match.group('cpv')
|
||||
slot = match.group('slot')
|
||||
overlay = match.group('overlay')
|
||||
|
||||
if not package or not cpv.startswith(str(package)):
|
||||
package = self.store_package(options, cpv)
|
||||
|
||||
self.store_version(options, package, cpv, slot, overlay)
|
||||
|
||||
def store_package(self, options, cpv):
|
||||
cat, pkg, ver, rev = portage.catpkgsplit(cpv)
|
||||
|
||||
obj, created = Package.objects.get_or_create(category=cat, name=pkg)
|
||||
|
||||
if created:
|
||||
if not options['quiet']:
|
||||
sys.stdout.write('[p] %s/%s\n' % (cat, pkg))
|
||||
obj.save()
|
||||
|
||||
# Delete previous versions to handle incremental scan correctly
|
||||
Version.objects.filter(package=obj, packaged=True).delete()
|
||||
|
||||
return obj
|
||||
|
||||
def store_version(self, options, package, cpv, slot, overlay):
|
||||
cat, pkg, ver, rev = portage.catpkgsplit(cpv)
|
||||
|
||||
overlays = self.overlays()
|
||||
|
||||
if overlay in overlays:
|
||||
overlay = overlays[overlay]
|
||||
else:
|
||||
overlay = 'gentoo'
|
||||
|
||||
if not options['quiet']:
|
||||
sys.stdout.write('[v] %s:%s [%s]\n' % (cpv, slot, overlay))
|
||||
|
||||
obj, created = Version.objects.get_or_create(package=package, slot=slot,
|
||||
revision=rev, version=ver,
|
||||
overlay=overlay)
|
||||
obj.packaged = True
|
||||
#obj.save()
|
||||
|
0
euscanwww/euscan/management/commands/utils.py
Normal file
0
euscanwww/euscan/management/commands/utils.py
Normal file
161
euscanwww/euscan/migrations/0001_initial.py
Normal file
161
euscanwww/euscan/migrations/0001_initial.py
Normal file
@ -0,0 +1,161 @@
|
||||
# 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):
|
||||
|
||||
# Adding model 'Herd'
|
||||
db.create_table('euscan_herd', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('herd', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
|
||||
))
|
||||
db.send_create_signal('euscan', ['Herd'])
|
||||
|
||||
# Adding model 'Maintainer'
|
||||
db.create_table('euscan_maintainer', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
('email', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
))
|
||||
db.send_create_signal('euscan', ['Maintainer'])
|
||||
|
||||
# Adding unique constraint on 'Maintainer', fields ['name', 'email']
|
||||
db.create_unique('euscan_maintainer', ['name', 'email'])
|
||||
|
||||
# Adding model 'Package'
|
||||
db.create_table('euscan_package', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('category', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
('description', self.gf('django.db.models.fields.TextField')(blank=True)),
|
||||
('homepage', self.gf('django.db.models.fields.CharField')(max_length=256, blank=True)),
|
||||
))
|
||||
db.send_create_signal('euscan', ['Package'])
|
||||
|
||||
# Adding unique constraint on 'Package', fields ['category', 'name']
|
||||
db.create_unique('euscan_package', ['category', 'name'])
|
||||
|
||||
# Adding M2M table for field herds on 'Package'
|
||||
db.create_table('euscan_package_herds', (
|
||||
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
|
||||
('package', models.ForeignKey(orm['euscan.package'], null=False)),
|
||||
('herd', models.ForeignKey(orm['euscan.herd'], null=False))
|
||||
))
|
||||
db.create_unique('euscan_package_herds', ['package_id', 'herd_id'])
|
||||
|
||||
# Adding M2M table for field maintainers on 'Package'
|
||||
db.create_table('euscan_package_maintainers', (
|
||||
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
|
||||
('package', models.ForeignKey(orm['euscan.package'], null=False)),
|
||||
('maintainer', models.ForeignKey(orm['euscan.maintainer'], null=False))
|
||||
))
|
||||
db.create_unique('euscan_package_maintainers', ['package_id', 'maintainer_id'])
|
||||
|
||||
# Adding model 'Version'
|
||||
db.create_table('euscan_version', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('package', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['euscan.Package'])),
|
||||
('slot', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
('revision', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
('version', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
('packaged', self.gf('django.db.models.fields.BooleanField')(default=False)),
|
||||
('overlay', self.gf('django.db.models.fields.CharField')(max_length=128)),
|
||||
('urls', self.gf('django.db.models.fields.TextField')(blank=True)),
|
||||
))
|
||||
db.send_create_signal('euscan', ['Version'])
|
||||
|
||||
# Adding unique constraint on 'Version', fields ['package', 'slot', 'revision', 'version']
|
||||
db.create_unique('euscan_version', ['package_id', 'slot', 'revision', 'version'])
|
||||
|
||||
# Adding model 'EuscanResult'
|
||||
db.create_table('euscan_euscanresult', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('package', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['euscan.Package'])),
|
||||
('startdate', self.gf('django.db.models.fields.DateTimeField')()),
|
||||
('endstate', self.gf('django.db.models.fields.DateTimeField')()),
|
||||
('result', self.gf('django.db.models.fields.TextField')(blank=True)),
|
||||
))
|
||||
db.send_create_signal('euscan', ['EuscanResult'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'Version', fields ['package', 'slot', 'revision', 'version']
|
||||
db.delete_unique('euscan_version', ['package_id', 'slot', 'revision', 'version'])
|
||||
|
||||
# Removing unique constraint on 'Package', fields ['category', 'name']
|
||||
db.delete_unique('euscan_package', ['category', 'name'])
|
||||
|
||||
# Removing unique constraint on 'Maintainer', fields ['name', 'email']
|
||||
db.delete_unique('euscan_maintainer', ['name', 'email'])
|
||||
|
||||
# Deleting model 'Herd'
|
||||
db.delete_table('euscan_herd')
|
||||
|
||||
# Deleting model 'Maintainer'
|
||||
db.delete_table('euscan_maintainer')
|
||||
|
||||
# Deleting model 'Package'
|
||||
db.delete_table('euscan_package')
|
||||
|
||||
# Removing M2M table for field herds on 'Package'
|
||||
db.delete_table('euscan_package_herds')
|
||||
|
||||
# Removing M2M table for field maintainers on 'Package'
|
||||
db.delete_table('euscan_package_maintainers')
|
||||
|
||||
# Deleting model 'Version'
|
||||
db.delete_table('euscan_version')
|
||||
|
||||
# Deleting model 'EuscanResult'
|
||||
db.delete_table('euscan_euscanresult')
|
||||
|
||||
|
||||
models = {
|
||||
'euscan.euscanresult': {
|
||||
'Meta': {'object_name': 'EuscanResult'},
|
||||
'endstate': ('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'}),
|
||||
'startdate': ('django.db.models.fields.DateTimeField', [], {})
|
||||
},
|
||||
'euscan.herd': {
|
||||
'Meta': {'object_name': 'Herd'},
|
||||
'herd': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||
},
|
||||
'euscan.maintainer': {
|
||||
'Meta': {'unique_together': "(['name', 'email'],)", 'object_name': 'Maintainer'},
|
||||
'email': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
'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'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
'euscan.version': {
|
||||
'Meta': {'unique_together': "(['package', 'slot', 'revision', 'version'],)", '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']
|
@ -0,0 +1,70 @@
|
||||
# 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 'Version', fields ['slot', 'revision', 'version', 'package']
|
||||
db.delete_unique('euscan_version', ['slot', 'revision', 'version', 'package_id'])
|
||||
|
||||
# Adding unique constraint on 'Version', fields ['slot', 'overlay', 'revision', 'version', 'package']
|
||||
db.create_unique('euscan_version', ['slot', 'overlay', 'revision', 'version', 'package_id'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'Version', fields ['slot', 'overlay', 'revision', 'version', 'package']
|
||||
db.delete_unique('euscan_version', ['slot', 'overlay', 'revision', 'version', 'package_id'])
|
||||
|
||||
# Adding unique constraint on 'Version', fields ['slot', 'revision', 'version', 'package']
|
||||
db.create_unique('euscan_version', ['slot', 'revision', 'version', 'package_id'])
|
||||
|
||||
|
||||
models = {
|
||||
'euscan.euscanresult': {
|
||||
'Meta': {'object_name': 'EuscanResult'},
|
||||
'endstate': ('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'}),
|
||||
'startdate': ('django.db.models.fields.DateTimeField', [], {})
|
||||
},
|
||||
'euscan.herd': {
|
||||
'Meta': {'object_name': 'Herd'},
|
||||
'herd': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||
},
|
||||
'euscan.maintainer': {
|
||||
'Meta': {'unique_together': "(['name', 'email'],)", 'object_name': 'Maintainer'},
|
||||
'email': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
'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'}),
|
||||
'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']
|
@ -0,0 +1,65 @@
|
||||
# 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):
|
||||
|
||||
# Adding field 'Herd.email'
|
||||
db.add_column('euscan_herd', 'email', self.gf('django.db.models.fields.CharField')(default='', max_length=128), keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting field 'Herd.email'
|
||||
db.delete_column('euscan_herd', 'email')
|
||||
|
||||
|
||||
models = {
|
||||
'euscan.euscanresult': {
|
||||
'Meta': {'object_name': 'EuscanResult'},
|
||||
'endstate': ('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'}),
|
||||
'startdate': ('django.db.models.fields.DateTimeField', [], {})
|
||||
},
|
||||
'euscan.herd': {
|
||||
'Meta': {'object_name': 'Herd'},
|
||||
'email': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'herd': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||
},
|
||||
'euscan.maintainer': {
|
||||
'Meta': {'unique_together': "(['name', 'email'],)", 'object_name': 'Maintainer'},
|
||||
'email': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
'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'}),
|
||||
'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']
|
@ -0,0 +1,65 @@
|
||||
# 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):
|
||||
|
||||
# Changing field 'Herd.email'
|
||||
db.alter_column('euscan_herd', 'email', self.gf('django.db.models.fields.CharField')(max_length=128, null=True))
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'Herd.email'
|
||||
db.alter_column('euscan_herd', 'email', self.gf('django.db.models.fields.CharField')(default='', max_length=128))
|
||||
|
||||
|
||||
models = {
|
||||
'euscan.euscanresult': {
|
||||
'Meta': {'object_name': 'EuscanResult'},
|
||||
'endstate': ('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'}),
|
||||
'startdate': ('django.db.models.fields.DateTimeField', [], {})
|
||||
},
|
||||
'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.maintainer': {
|
||||
'Meta': {'unique_together': "(['name', 'email'],)", 'object_name': 'Maintainer'},
|
||||
'email': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
'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'}),
|
||||
'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']
|
0
euscanwww/euscan/migrations/__init__.py
Normal file
0
euscanwww/euscan/migrations/__init__.py
Normal file
@ -1,31 +1,57 @@
|
||||
from django.db import models
|
||||
"""
|
||||
class Package(models.Model):
|
||||
category
|
||||
package
|
||||
description
|
||||
homepage
|
||||
herds
|
||||
maintainers
|
||||
|
||||
class Herd(models.Model):
|
||||
herd
|
||||
herd = models.CharField(max_length=128, unique=True)
|
||||
email = models.CharField(max_length=128, blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
if self.email:
|
||||
return '%s <%s>' % (self.herd, self.email)
|
||||
return self.herd
|
||||
|
||||
class Maintainer(models.Model):
|
||||
name
|
||||
email
|
||||
name = models.CharField(max_length=128)
|
||||
email = models.CharField(max_length=128)
|
||||
|
||||
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)
|
||||
description = models.TextField(blank=True)
|
||||
homepage = models.CharField(max_length=256, blank=True)
|
||||
herds = models.ManyToManyField(Herd, blank=True)
|
||||
maintainers = models.ManyToManyField(Maintainer, blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return '%s/%s' % (self.category, self.name)
|
||||
|
||||
class Meta:
|
||||
unique_together = ['category', 'name']
|
||||
|
||||
class Version(models.Model):
|
||||
package
|
||||
slot
|
||||
revision
|
||||
version
|
||||
packaged
|
||||
overlay
|
||||
urls
|
||||
package = models.ForeignKey(Package)
|
||||
slot = models.CharField(max_length=128)
|
||||
revision = models.CharField(max_length=128)
|
||||
version = models.CharField(max_length=128)
|
||||
packaged = models.BooleanField()
|
||||
overlay = models.CharField(max_length=128)
|
||||
urls = models.TextField(blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return '%s/%s-%s-%s:%s [%s]' % (self.package.category, self.package.name,
|
||||
self.version, self.revision, self.slot,
|
||||
self.overlay)
|
||||
|
||||
class Meta:
|
||||
unique_together = ['package', 'slot', 'revision', 'version', 'overlay']
|
||||
|
||||
class EuscanResult(models.Model):
|
||||
package
|
||||
datetime
|
||||
result
|
||||
"""
|
||||
package = models.ForeignKey(Package)
|
||||
startdate = models.DateTimeField()
|
||||
endstate = models.DateTimeField()
|
||||
result = models.TextField(blank=True)
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user