euscanwww: Added tasks for syncing and updating portage tree
Added these tasks: * emerge_sync * layman_sync * emerge_regen * eix_update Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
2edb220d3e
commit
60e2019cc3
@ -1,8 +1,12 @@
|
|||||||
|
import subprocess
|
||||||
|
from StringIO import StringIO
|
||||||
|
|
||||||
from celery.task import task
|
from celery.task import task
|
||||||
from celery.task.sets import TaskSet
|
from celery.task.sets import TaskSet
|
||||||
|
|
||||||
from djeuscan.models import Package
|
from django.conf import settings
|
||||||
|
|
||||||
|
from djeuscan.models import Package
|
||||||
from djeuscan.management.commands.regen_rrds import regen_rrds
|
from djeuscan.management.commands.regen_rrds import regen_rrds
|
||||||
from djeuscan.management.commands.update_counters import update_counters
|
from djeuscan.management.commands.update_counters import update_counters
|
||||||
from djeuscan.management.commands.scan_metadata import ScanMetadata
|
from djeuscan.management.commands.scan_metadata import ScanMetadata
|
||||||
@ -97,6 +101,41 @@ def scan_upstream_purge_task():
|
|||||||
scan_upstream_purge()
|
scan_upstream_purge()
|
||||||
|
|
||||||
|
|
||||||
|
def _launch_command(cmd):
|
||||||
|
fp = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
output = StringIO(fp.communicate()[0])
|
||||||
|
return output.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def emerge_sync():
|
||||||
|
cmd = ["emerge", "--sync", "--root", settings.PORTAGE_ROOT,
|
||||||
|
"--config-root", settings.PORTAGE_CONFIGROOT]
|
||||||
|
return _launch_command(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def layman_sync():
|
||||||
|
cmd = ["layman", "-S", "--config", settings.LAYMAN_CONFIG]
|
||||||
|
return _launch_command(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def emerge_regen():
|
||||||
|
cmd = [
|
||||||
|
"emerge", "--regen", "--jobs", settings.EMERGE_REGEN_JOBS, "--root",
|
||||||
|
settings.PORTAGE_ROOT, "--config-root", settings.PORTAGE_CONFIGROOT
|
||||||
|
]
|
||||||
|
return _launch_command(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def eix_update():
|
||||||
|
cmd = ["eix-update"]
|
||||||
|
return _launch_command(cmd)
|
||||||
|
|
||||||
|
|
||||||
launchable_tasks = [
|
launchable_tasks = [
|
||||||
regen_rrds_task,
|
regen_rrds_task,
|
||||||
update_counters_task,
|
update_counters_task,
|
||||||
@ -108,4 +147,8 @@ launchable_tasks = [
|
|||||||
scan_upstream_all_task,
|
scan_upstream_all_task,
|
||||||
scan_upstream_task,
|
scan_upstream_task,
|
||||||
scan_upstream_purge_task,
|
scan_upstream_purge_task,
|
||||||
|
emerge_sync,
|
||||||
|
layman_sync,
|
||||||
|
emerge_regen,
|
||||||
|
eix_update,
|
||||||
]
|
]
|
||||||
|
@ -202,6 +202,12 @@ LOGGING = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PORTAGE_ROOT = "/usr/portage/"
|
||||||
|
PORTAGE_CONFIGROOT = PORTAGE_ROOT
|
||||||
|
LAYMAN_CONFIG = "/etc/layman/layman.cfg"
|
||||||
|
EMERGE_REGEN_JOBS = 4
|
||||||
|
|
||||||
|
|
||||||
# Celery config
|
# Celery config
|
||||||
import djcelery
|
import djcelery
|
||||||
djcelery.setup_loader()
|
djcelery.setup_loader()
|
||||||
@ -213,7 +219,7 @@ try:
|
|||||||
from local_settings import *
|
from local_settings import *
|
||||||
except ImportError, ex:
|
except ImportError, ex:
|
||||||
import sys
|
import sys
|
||||||
sys.stderr.write(\
|
sys.stderr.write(
|
||||||
("settings.py: error importing local settings file:\n" + \
|
"settings.py: error importing local settings file:\n"
|
||||||
"\t%s\n" + \
|
"\t%s\nDo you have a local_settings.py module?\n" % str(ex)
|
||||||
"Do you have a local_settings.py module?\n") % str(ex))
|
)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import sys, os
|
import sys
|
||||||
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
PROJECT = '/path/to/euscanwww'
|
PROJECT = '/path/to/euscanwww'
|
||||||
|
Loading…
Reference in New Issue
Block a user