8062fddc23
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>
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
import sys
|
|
import logging
|
|
from optparse import make_option
|
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
from djeuscan.processing import set_verbosity_level
|
|
from djeuscan.processing.scan import scan_metadata
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class Command(BaseCommand):
|
|
_overlays = {}
|
|
|
|
option_list = BaseCommand.option_list + (
|
|
make_option('--all',
|
|
action='store_true',
|
|
dest='all',
|
|
default=False,
|
|
help='Scan all packages'),
|
|
make_option('--category',
|
|
action='store',
|
|
dest='category',
|
|
default=None,
|
|
help='Scan only this category'),
|
|
)
|
|
args = '<package package ...>'
|
|
help = 'Scans metadata and fills database'
|
|
|
|
def handle(self, *args, **options):
|
|
set_verbosity_level(logger, options.get("verbosity", 1))
|
|
|
|
if options['all'] or options['category']:
|
|
packages = None
|
|
|
|
elif len(args):
|
|
packages = [pkg for pkg in args]
|
|
else:
|
|
packages = [pkg[:-1] for pkg in sys.stdin.readlines()]
|
|
|
|
scan_metadata(
|
|
packages=packages,
|
|
category=options['category'],
|
|
logger=logger
|
|
)
|