euscanwww: fix the scan process
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
@ -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]
|
||||
maintainer = self.store_maintainer(
|
||||
maintainer.name, maintainer.email
|
||||
)
|
||||
obj.maintainers.add(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()
|
||||
|
||||
|
@ -242,7 +242,6 @@ class ScanPortage(object):
|
||||
overlay=obj.overlay
|
||||
)
|
||||
|
||||
|
||||
@commit_on_success
|
||||
def purge_versions(options):
|
||||
# For each dead versions
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user