euscan-ng/euscanwww/djeuscan/management/commands/update_counters.py
Corentin Chary 8062fddc23 euscanwww: move processing to scan and misc, enhance update_portage_tree
update_portage_tree() now:
- watch stderr and stdout for each command
- use layman command instead of layman API for sync because
  layman API doesn't work when stdout or stderr is not a real file
  (we could probably work around that with pipes and epoll)
- use egencache instead of emerge to generate cache
- export PORTAGE_CONFIGROOT, ROOT, EIX_CACHEFILE etc.. so they
  are used everywhere

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
2012-07-02 18:16:59 +02:00

36 lines
917 B
Python

import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from djeuscan.processing import set_verbosity_level
from djeuscan.processing.misc import update_counters
logger = logging.getLogger(__name__)
class Command(BaseCommand):
_overlays = {}
help = 'Update counters'
option_list = BaseCommand.option_list + (
make_option('--fast',
action='store_true',
dest='fast',
default=False,
help='Skip sanity checks'),
make_option('--nolog',
action='store_true',
dest='nolog',
default=False,
help='Skip logs'),
)
def handle(self, *args, **options):
set_verbosity_level(logger, options.get("verbosity", 1))
update_counters(
fast=options["fast"],
nolog=options["nolog"],
logger=logger,
)