euscanwww: fix the scan process

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
Corentin Chary 2012-05-29 15:29:03 +02:00
parent f0a3c34ac8
commit 83f5df4daf
4 changed files with 20 additions and 11 deletions

View File

@ -8,6 +8,7 @@ from gentoolkit.errors import GentoolkitFatalError
from django.db.transaction import commit_on_success
from django.core.management.base import BaseCommand
from django.core.management.color import color_style
from django.core.exceptions import ValidationError
from djeuscan.models import Package, Herd, Maintainer
@ -89,10 +90,15 @@ class ScanMetadata(object):
for maintainer in new_maintainers:
maintainer = maintainers[maintainer]
try:
maintainer = self.store_maintainer(
maintainer.name, maintainer.email
)
obj.maintainers.add(maintainer)
except ValidationError:
sys.stderr.write(
self.style.ERROR("Bad maintainer: '%s' '%s'\n" % (maintainer.name, maintainer.email))
)
obj.save()

View File

@ -242,7 +242,6 @@ class ScanPortage(object):
overlay=obj.overlay
)
@commit_on_success
def purge_versions(options):
# For each dead versions

View File

@ -88,6 +88,9 @@ class ScanUpstream(object):
def parse_output(self, output):
from portage.versions import _cp
if type(_cp) == dict:
_cp = _cp["dots_allowed_in_PN"]
package_re = re.compile(
r'^ \* (?P<cpv>' + _cp + ') \[(?P<overlay>.*?)\]$'
)
@ -177,7 +180,7 @@ class Command(BaseCommand):
scan_upstream = ScanUpstream(options)
if options['feed']:
scan_upstream.parse_output(options, sys.stdin)
scan_upstream.parse_output(sys.stdin)
if options['purge-versions']:
purge_versions(options)
return

View File

@ -115,11 +115,12 @@ class Version(models.Model):
"""
package = models.ForeignKey(Package)
slot = models.CharField(max_length=128)
slot = models.CharField(max_length=128, blank=True, default='')
revision = models.CharField(max_length=128)
version = models.CharField(max_length=128)
packaged = models.BooleanField()
overlay = models.CharField(max_length=128, default='gentoo', db_index=True,
overlay = models.CharField(max_length=128, blank=True,
default='gentoo', db_index=True,
validators=[validate_name])
urls = models.TextField(blank=True)
alive = models.BooleanField(default=True, db_index=True)
@ -148,12 +149,12 @@ class VersionLog(models.Model):
package = models.ForeignKey(Package)
datetime = models.DateTimeField(auto_now_add=True)
slot = models.CharField(max_length=128)
slot = models.CharField(max_length=128, blank=True, default='')
revision = models.CharField(max_length=128)
version = models.CharField(max_length=128)
packaged = models.BooleanField()
overlay = models.CharField(max_length=128, default='gentoo',
validators=[validate_name])
overlay = models.CharField(max_length=128, blank=True,
default='gentoo', validators=[validate_name])
action = models.IntegerField(choices=VERSION_ACTIONS)
objects = VersionLogManager()