From ec396c3cc5fbe5035f5e09e8dbae5d82abba0cec Mon Sep 17 00:00:00 2001 From: Tias Guns Date: Sun, 11 Mar 2012 21:09:32 +0000 Subject: [PATCH 1/5] fdroid.py: list commands when not giving a right command (I used ./fdroid -h and expected actual info, even if -h is not valid --- fdroid | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fdroid b/fdroid index 22bcffac..20922475 100755 --- a/fdroid +++ b/fdroid @@ -41,7 +41,11 @@ def main(): command = sys.argv[1] if not command in commands: - print "Command '" + command + "' not recognised" + print "Command '" + command + "' not recognised." + print "" + print "Valid commands are:" + for command in commands: + print " " + command sys.exit(1) # Trick optparse into displaying the right usage when --help is used. From 409fd273b672135c12c9a12295a57339bad1e319 Mon Sep 17 00:00:00 2001 From: Tias Guns Date: Sun, 11 Mar 2012 21:15:17 +0000 Subject: [PATCH 2/5] fdroid.py: a pointer to the -h option of commands --- fdroid | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fdroid b/fdroid index 20922475..f8f2473f 100755 --- a/fdroid +++ b/fdroid @@ -31,21 +31,23 @@ commands = [ "stats", "server"] +def print_help(): + print "Valid commands are:" + for command in commands: + print " " + command + print "Use '%s -h' for more info about that command."%sys.argv[0] + def main(): if len(sys.argv) <= 1: - print "Specify a command. Valid commands are:" - for command in commands: - print " " + command + print_help() sys.exit(0) command = sys.argv[1] if not command in commands: print "Command '" + command + "' not recognised." print "" - print "Valid commands are:" - for command in commands: - print " " + command + print_help() sys.exit(1) # Trick optparse into displaying the right usage when --help is used. From ab0ed81702071607bdcb093203dabf856c1dbd84 Mon Sep 17 00:00:00 2001 From: Tias Guns Date: Sun, 11 Mar 2012 21:30:17 +0000 Subject: [PATCH 3/5] checkupdates: use -p check like in build.py, give error if package does not exist --- fdroidserver/checkupdates.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 96ad5a18..90b0fcd2 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -130,12 +130,14 @@ def main(): # Get all apps... apps = common.read_metadata(options.verbose) - for app in apps: + # 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) - if options.package and options.package != app['id']: - # Silent skip... - pass - else: + for app in apps: print "Processing " + app['id'] + '...' mode = app['Update Check Mode'] From 08ec659441655cfe7a6b0059eede10a1cf8836e3 Mon Sep 17 00:00:00 2001 From: Tias Guns Date: Sun, 11 Mar 2012 21:35:17 +0000 Subject: [PATCH 4/5] rewritemeta: add -p option to specify package useful if you're only working on a few packages and 'rewritemetadata' would make your working tree dirty --- fdroidserver/rewritemeta.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fdroidserver/rewritemeta.py b/fdroidserver/rewritemeta.py index 347493bd..3ec57714 100644 --- a/fdroidserver/rewritemeta.py +++ b/fdroidserver/rewritemeta.py @@ -36,11 +36,20 @@ 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="Build only the specified package") (options, args) = parser.parse_args() # Get all apps... apps = common.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) + for app in apps: print "Writing " + app['id'] common.write_metadata(os.path.join('metadata', app['id']) + '.txt', app) From fc621a8ad6172fb7eaa5894ca188203d6d6e3511 Mon Sep 17 00:00:00 2001 From: Tias Guns Date: Sun, 11 Mar 2012 21:59:25 +0000 Subject: [PATCH 5/5] scanner: use -p check like in build.py, give error if package does not exist --- fdroidserver/scanner.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index bd9d2700..c5a04132 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -50,6 +50,13 @@ def main(): # Get all apps... apps = common.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) + html_parser = HTMLParser.HTMLParser() problems = [] @@ -59,9 +66,7 @@ def main(): for app in apps: skip = False - if options.package and app['id'] != options.package: - skip = True - elif app['Disabled']: + if app['Disabled']: print "Skipping %s: disabled" % app['id'] skip = True elif not app['builds']: