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() {
opts="-h -v -p"
lopts="--help --verbose --package --auto --autoonly --commit --gplay"
case "${prev}" in
-p|--package)
lopts="--help --verbose --auto --autoonly --commit --gplay"
case "${cur}" in
-*)
__complete_options
return 0;;
*)
__package
return 0;;
esac
__complete_options
}
__complete_import() {

View file

@ -876,7 +876,7 @@ def main():
# Get all apps...
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
len(app['Repo Type']) > 0 and len(app['builds']) > 0]

View file

@ -280,8 +280,6 @@ def main():
parser = OptionParser()
parser.add_option("-v", "--verbose", action="store_true", default=False,
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,
help="Process auto-updates")
parser.add_option("--autoonly", action="store_true", default=False,
@ -295,14 +293,9 @@ def main():
config = common.read_config(options)
# Get all apps...
apps = metadata.read_metadata(options.verbose)
allapps = metadata.read_metadata(options.verbose)
# Filter apps according to command-line options
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)
apps = common.read_app_args(args, options, allapps, False)
if options.gplay:
for app in apps:
@ -325,7 +318,6 @@ def main():
for app in apps:
if options.autoonly and app['Auto Update Mode'] == 'None':
if options.verbose:
print "Nothing to do for %s..." % app['id']

View file

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

View file

@ -56,7 +56,7 @@ def main():
# Get all apps...
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:
last = None