Adapt checkupdates

This commit is contained in:
Daniel Martí 2013-12-11 19:37:38 +01:00
parent 21db79eea2
commit 3aec0aacd7
5 changed files with 13 additions and 19 deletions

View file

@ -139,13 +139,15 @@ __complete_publish() {
__complete_checkupdates() { __complete_checkupdates() {
opts="-h -v -p" opts="-h -v -p"
lopts="--help --verbose --package --auto --autoonly --commit --gplay" lopts="--help --verbose --auto --autoonly --commit --gplay"
case "${prev}" in case "${cur}" in
-p|--package) -*)
__complete_options
return 0;;
*)
__package __package
return 0;; return 0;;
esac esac
__complete_options
} }
__complete_import() { __complete_import() {

View file

@ -876,7 +876,7 @@ def main():
# Get all apps... # Get all apps...
allapps = metadata.read_metadata(xref=not options.onserver) allapps = metadata.read_metadata(xref=not options.onserver)
apps = common.read_app_args(args, options, allapps) apps = common.read_app_args(args, options, allapps, True)
apps = [app for app in apps if (options.force or not app['Disabled']) and apps = [app for app in apps if (options.force or not app['Disabled']) and
len(app['Repo Type']) > 0 and len(app['builds']) > 0] len(app['Repo Type']) > 0 and len(app['builds']) > 0]

View file

@ -280,8 +280,6 @@ def main():
parser = OptionParser() parser = OptionParser()
parser.add_option("-v", "--verbose", action="store_true", default=False, parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal") help="Spew out even more information than normal")
parser.add_option("-p", "--package", default=None,
help="Check only the specified package")
parser.add_option("--auto", action="store_true", default=False, parser.add_option("--auto", action="store_true", default=False,
help="Process auto-updates") help="Process auto-updates")
parser.add_option("--autoonly", action="store_true", default=False, parser.add_option("--autoonly", action="store_true", default=False,
@ -295,14 +293,9 @@ def main():
config = common.read_config(options) config = common.read_config(options)
# Get all apps... # Get all apps...
apps = metadata.read_metadata(options.verbose) allapps = metadata.read_metadata(options.verbose)
# Filter apps according to command-line options apps = common.read_app_args(args, options, allapps, False)
if options.package:
apps = [app for app in apps if app['id'] == options.package]
if len(apps) == 0:
print "No such package"
sys.exit(1)
if options.gplay: if options.gplay:
for app in apps: for app in apps:
@ -325,7 +318,6 @@ def main():
for app in apps: for app in apps:
if options.autoonly and app['Auto Update Mode'] == 'None': if options.autoonly and app['Auto Update Mode'] == 'None':
if options.verbose: if options.verbose:
print "Nothing to do for %s..." % app['id'] print "Nothing to do for %s..." % app['id']

View file

@ -110,20 +110,20 @@ def read_config(opts, config_file='config.py'):
return config return config
def read_app_args(args, options, allapps): def read_app_args(args, options, allapps, allow_vercodes=False):
if not args: if not args:
return [] return []
vercodes = {} vercodes = {}
for p in args: for p in args:
if ':' in p: if allow_vercodes and ':' in p:
package, vercode = p.split(':') package, vercode = p.split(':')
else: else:
package, vercode = p, None package, vercode = p, None
if package not in vercodes: if package not in vercodes:
vercodes[package] = [vercode] if vercode else [] vercodes[package] = [vercode] if vercode else []
continue continue
elif vercode not in vercodes[package]: elif vercode and vercode not in vercodes[package]:
vercodes[package] += [vercode] if vercode else [] vercodes[package] += [vercode] if vercode else []
packages = vercodes.keys() packages = vercodes.keys()
apps = [app for app in allapps if app['id'] in packages] apps = [app for app in allapps if app['id'] in packages]

View file

@ -56,7 +56,7 @@ def main():
# Get all apps... # Get all apps...
allapps = metadata.read_metadata() allapps = metadata.read_metadata()
apps = common.read_app_args(args, options, allapps) apps = common.read_app_args(args, options, allapps, True)
for app in apps: for app in apps:
last = None last = None