euscanwww: Scan tasks recieve a list of packages

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-06-05 13:30:31 +02:00
parent 4a9301a215
commit 8501805f8e
2 changed files with 46 additions and 25 deletions

View File

@ -16,7 +16,8 @@ from djeuscan.models import Package, Version, VersionLog
class ScanPortage(object): class ScanPortage(object):
def __init__(self, stdout=None, options=None): def __init__(self, stdout=None, options=None):
self.stdout = sys.stdout if stdout is None else stdout self.stdout = sys.stdout if stdout is None else stdout
self.options = defaultdict(None) if options is None else options self.options = defaultdict(lambda: None) \
if options is None else options
self.style = color_style() self.style = color_style()
self._cache = {'packages': {}, 'versions': {}} self._cache = {'packages': {}, 'versions': {}}

View File

@ -35,6 +35,15 @@ def scan_metadata_task(query, obj=None):
scan_metadata.scan(query, obj) scan_metadata.scan(query, obj)
@task
def scan_metadata_list_task(query):
job = TaskSet(tasks=[
scan_metadata_task.subtask((pkg, ))
for pkg in query.split()
])
job.apply_async()
@task @task
def scan_metadata_all_task(): def scan_metadata_all_task():
job = TaskSet(tasks=[ job = TaskSet(tasks=[
@ -44,6 +53,21 @@ def scan_metadata_all_task():
job.apply_async() job.apply_async()
@task
def scan_portage_list_task(query, purge=False):
scan_portage = ScanPortage()
for pkg in query.split():
logger = scan_portage_list_task.get_logger()
logger.info("Starting Portage package scanning: %s ...", pkg)
scan_portage.scan(pkg)
if purge:
logger.info("Purging")
scan_portage_purge()
@task @task
def scan_portage_all_task(purge=False): def scan_portage_all_task(purge=False):
logger = scan_portage_all_task.get_logger() logger = scan_portage_all_task.get_logger()
@ -58,21 +82,26 @@ def scan_portage_all_task(purge=False):
@task @task
def scan_portage_task(query, purge=False): def scan_portage_purge_task():
logger = scan_portage_task.get_logger()
logger.info("Starting Portage package scanning: %s ...", query)
scan_portage = ScanPortage()
scan_portage.scan(query)
if purge:
logger.info("Purging")
scan_portage_purge() scan_portage_purge()
@task @task
def scan_portage_purge_task(): def scan_upstream_task(query):
scan_portage_purge() logger = scan_upstream_task.get_logger()
logger.info("Starting upstream scanning for package %s ...", query)
scan_upstream = ScanUpstream()
scan_upstream.scan(query)
@task
def scan_upstream_list_task(query):
job = TaskSet(tasks=[
scan_upstream_task.subtask((pkg, ))
for pkg in query.split()
])
job.apply_async()
@task @task
@ -87,15 +116,6 @@ def scan_upstream_all_task(purge=False):
job.apply_async() job.apply_async()
@task
def scan_upstream_task(query):
logger = scan_upstream_task.get_logger()
logger.info("Starting upstream scanning for package %s ...", query)
scan_upstream = ScanUpstream()
scan_upstream.scan(query)
@task @task
def scan_upstream_purge_task(): def scan_upstream_purge_task():
scan_upstream_purge() scan_upstream_purge()
@ -143,13 +163,13 @@ def eix_update():
launchable_tasks = [ launchable_tasks = [
regen_rrds_task, regen_rrds_task,
update_counters_task, update_counters_task,
scan_metadata_task, scan_metadata_list_task,
scan_metadata_all_task, scan_metadata_all_task,
scan_portage_all_task, scan_portage_all_task,
scan_portage_task, scan_portage_list_task,
scan_portage_purge_task, scan_portage_purge_task,
scan_upstream_all_task, scan_upstream_all_task,
scan_upstream_task, scan_upstream_list_task,
scan_upstream_purge_task, scan_upstream_purge_task,
emerge_sync, emerge_sync,
layman_sync, layman_sync,