djeuscan: fix some small bugs

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
Corentin Chary 2012-08-14 09:11:23 +02:00
parent d1058aed8b
commit 97830775c8
3 changed files with 3 additions and 5 deletions

View File

@ -44,7 +44,7 @@ def packages_from_names(data):
data = data.replace("\r", "") data = data.replace("\r", "")
for pkg in data.split('\n'): for pkg in data.split('\n'):
if '/' in pkg: if pkg.count('/') == 1:
cat, pkg = pkg.split('/') cat, pkg = pkg.split('/')
packages.extend(Package.objects.filter(category=cat, name=pkg)) packages.extend(Package.objects.filter(category=cat, name=pkg))
else: else:

View File

@ -26,7 +26,7 @@ class ScanMetadata(object):
try: try:
category, package = portage.catsplit(query) category, package = portage.catsplit(query)
return Package.objects.get(category=package, name=package) return Package.objects.get(category=category, name=package)
except Package.DoesNotExist: except Package.DoesNotExist:
pass pass
@ -88,7 +88,6 @@ class ScanMetadata(object):
return pkg, package.metadata return pkg, package.metadata
def scan(self, query=None, pkg=None): def scan(self, query=None, pkg=None):
try: try:
metadata = None metadata = None
pkg, metadata = self.metadata_from_db(query, pkg) pkg, metadata = self.metadata_from_db(query, pkg)

View File

@ -154,8 +154,7 @@ def scan_upstream(packages=[], purge_versions=False):
logger.info("Starting upstream scan subtask for %d packages...", logger.info("Starting upstream scan subtask for %d packages...",
len(packages)) len(packages))
else: else:
logger.info("Starting upstream scan...", logger.info("Starting upstream scan...")
len(packages))
scan.scan_upstream( scan.scan_upstream(
packages=packages, packages=packages,