euscanwww: take args from stdin and update INSTALL

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
This commit is contained in:
Corentin Chary 2012-03-02 14:08:28 +01:00
parent 329b20fecf
commit d6f3b6629c
4 changed files with 22 additions and 16 deletions

View File

@ -13,6 +13,13 @@ touch local_settings.py
./manage.py scan-portage htop # Scan ebuilds ./manage.py scan-portage htop # Scan ebuilds
./manage.py scan-metadata htop # Lookup for maintainers, herds, etc... ./manage.py scan-metadata htop # Lookup for maintainers, herds, etc...
./manage.py scan-upstream htop # Run euscan ./manage.py scan-upstream htop # Run euscan
# Scan dev-python
eix --only-names -C dev-python | ./manage.py scan-portage
eix --only-names -C dev-python | ./manage.py scan-metadata
eix --only-names -C dev-python | ./manage.py scan-upstream
# Update counters at end of scan
./manage.py update-counters # Update counters, graphs, etc... ./manage.py update-counters # Update counters, graphs, etc...
# Start server # Start server

View File

@ -33,15 +33,15 @@ class Command(BaseCommand):
help = 'Scans metadata and fills database' help = 'Scans metadata and fills database'
def handle(self, *args, **options): def handle(self, *args, **options):
if len(args) == 0 and options['all'] == False: if options['all']:
raise CommandError('You must specify a package or use --all')
if len(args) == 0:
for pkg in Package.objects.all(): for pkg in Package.objects.all():
self.scan(options, '%s/%s' % (pkg.category, pkg.name)) self.scan(options, '%s/%s' % (pkg.category, pkg.name))
else: elif len(args):
for package in args: for package in args:
self.scan(options, package) self.scan(options, package)
else:
for package in sys.stdin.readlines():
self.scan(options, package[:-1])
@commit_on_success @commit_on_success
def scan(self, options, query=None): def scan(self, options, query=None):

View File

@ -36,21 +36,21 @@ class Command(BaseCommand):
default=False, default=False,
help='Be quiet'), help='Be quiet'),
) )
args = '<package package ...>' args = '[package package ...]'
help = 'Scans portage tree and fills database' help = 'Scans portage tree and fills database'
def handle(self, *args, **options): def handle(self, *args, **options):
if len(args) == 0 and options['all'] == False:
raise CommandError('You must specify a package or use --all')
if not options['quiet']: if not options['quiet']:
self.stdout.write('Scanning portage tree...\n') self.stdout.write('Scanning portage tree...\n')
if len(args) == 0: if options['all']:
self.scan(options) self.scan(options)
else: elif len(args):
for package in args: for package in args:
self.scan(options, package) self.scan(options, package)
else:
for package in sys.stdin.readlines():
self.scan(options, package[:-1])
if options['purge-versions']: if options['purge-versions']:
self.purge_versions(options) self.purge_versions(options)

View File

@ -42,9 +42,6 @@ class Command(BaseCommand):
help = 'Scans metadata and fills database' help = 'Scans metadata and fills database'
def handle(self, *args, **options): def handle(self, *args, **options):
if len(args) == 0 and options['all'] == False and options['feed'] == False:
raise CommandError('You must specify a package or use --all')
if options['feed']: if options['feed']:
self.parse_output(options, sys.stdin) self.parse_output(options, sys.stdin)
if options['purge-versions']: if options['purge-versions']:
@ -56,11 +53,13 @@ class Command(BaseCommand):
packages = [] packages = []
if len(args) == 0: if options['all']:
for pkg in Package.objects.all(): for pkg in Package.objects.all():
packages.append('%s/%s' % (pkg.category, pkg.name)) packages.append('%s/%s' % (pkg.category, pkg.name))
else: elif args:
packages = list(args) packages = list(args)
else:
packages = [ package[:-1] for package in sys.stdin.readlines() ]
self.scan(options, packages) self.scan(options, packages)