1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 14:30:11 +01:00

all: deduplicate -v/-q setup

This commit is contained in:
Daniel Martí 2015-09-11 23:42:50 -07:00
parent b42b45f762
commit 576da1d048
17 changed files with 23 additions and 64 deletions

View File

@ -935,11 +935,8 @@ def parse_commandline():
"""Parse the command line. Returns options, parser.""" """Parse the command line. Returns options, parser."""
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]") parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]") parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("-l", "--latest", action="store_true", default=False, parser.add_argument("-l", "--latest", action="store_true", default=False,
help="Build only the latest version of each package") help="Build only the latest version of each package")
parser.add_argument("-s", "--stop", action="store_true", default=False, parser.add_argument("-s", "--stop", action="store_true", default=False,

View File

@ -527,11 +527,8 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]") parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id to check for updates") parser.add_argument("appid", nargs='*', help="app-id to check for updates")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("--auto", action="store_true", default=False, parser.add_argument("--auto", action="store_true", default=False,
help="Process auto-updates") help="Process auto-updates")
parser.add_argument("--autoonly", action="store_true", default=False, parser.add_argument("--autoonly", action="store_true", default=False,

View File

@ -91,6 +91,13 @@ default_config = {
} }
def setup_global_opts(parser):
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
def fill_config_defaults(thisconfig): def fill_config_defaults(thisconfig):
for k, v in default_config.items(): for k, v in default_config.items():
if k not in thisconfig: if k not in thisconfig:

View File

@ -36,10 +36,7 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options]") parser = ArgumentParser(usage="%(prog)s [options]")
parser.add_argument("-v", "--verbose", action="store_true", default=False, common.setup_global_opts(parser)
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)

View File

@ -158,10 +158,7 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser() parser = ArgumentParser()
parser.add_argument("-v", "--verbose", action="store_true", default=False, common.setup_global_opts(parser)
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("-u", "--url", default=None, parser.add_argument("-u", "--url", default=None,
help="Project URL to import from.") help="Project URL to import from.")
parser.add_argument("-s", "--subdir", default=None, parser.add_argument("-s", "--subdir", default=None,

View File

@ -51,10 +51,7 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser() parser = ArgumentParser()
parser.add_argument("-v", "--verbose", action="store_true", default=False, common.setup_global_opts(parser)
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("-d", "--distinguished-name", default=None, parser.add_argument("-d", "--distinguished-name", default=None,
help="X.509 'Distiguished Name' used when generating keys") help="X.509 'Distiguished Name' used when generating keys")
parser.add_argument("--keystore", default=None, parser.add_argument("--keystore", default=None,

View File

@ -50,11 +50,8 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]") parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]") parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("-a", "--all", action="store_true", default=False, parser.add_argument("-a", "--all", action="store_true", default=False,
help="Install all signed applications available") help="Install all signed applications available")
options = parser.parse_args() options = parser.parse_args()

View File

@ -307,11 +307,8 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]") parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id in the form APPID") parser.add_argument("appid", nargs='*', help="app-id in the form APPID")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)

View File

@ -41,11 +41,8 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] " parser = ArgumentParser(usage="%(prog)s [options] "
"[APPID[:VERCODE] [APPID[:VERCODE] ...]]") "[APPID[:VERCODE] [APPID[:VERCODE] ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]") parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)

View File

@ -25,10 +25,7 @@ import metadata
def main(): def main():
parser = ArgumentParser(usage="%(prog)s") parser = ArgumentParser(usage="%(prog)s")
parser.add_argument("-v", "--verbose", action="store_true", default=False, common.setup_global_opts(parser)
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.parse_args() parser.parse_args()
common.read_config(None) common.read_config(None)

View File

@ -34,11 +34,8 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]") parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id in the form APPID") parser.add_argument("appid", nargs='*', help="app-id in the form APPID")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)

View File

@ -250,11 +250,8 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]") parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]") parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)

View File

@ -196,6 +196,7 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser() parser = ArgumentParser()
common.setup_global_opts(parser)
parser.add_argument("command", help="command to execute, either 'init' or 'update'") parser.add_argument("command", help="command to execute, either 'init' or 'update'")
parser.add_argument("-i", "--identity-file", default=None, parser.add_argument("-i", "--identity-file", default=None,
help="Specify an identity file to provide to SSH for rsyncing") help="Specify an identity file to provide to SSH for rsyncing")
@ -203,10 +204,6 @@ def main():
help="Specify a local folder to sync the repo to") help="Specify a local folder to sync the repo to")
parser.add_argument("--sync-from-local-copy-dir", action="store_true", default=False, parser.add_argument("--sync-from-local-copy-dir", action="store_true", default=False,
help="Before uploading to servers, sync from local copy dir") help="Before uploading to servers, sync from local copy dir")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("--no-checksum", action="store_true", default=False, parser.add_argument("--no-checksum", action="store_true", default=False,
help="Don't use rsync checksums") help="Don't use rsync checksums")
options = parser.parse_args() options = parser.parse_args()

View File

@ -35,10 +35,7 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options]") parser = ArgumentParser(usage="%(prog)s [options]")
parser.add_argument("-v", "--verbose", action="store_true", default=False, common.setup_global_opts(parser)
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)

View File

@ -51,10 +51,7 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser() parser = ArgumentParser()
parser.add_argument("-v", "--verbose", action="store_true", default=False, common.setup_global_opts(parser)
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("-d", "--download", action="store_true", default=False, parser.add_argument("-d", "--download", action="store_true", default=False,
help="Download logs we don't have") help="Download logs we don't have")
parser.add_argument("--recalc", action="store_true", default=False, parser.add_argument("--recalc", action="store_true", default=False,

View File

@ -1049,16 +1049,13 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser() parser = ArgumentParser()
common.setup_global_opts(parser)
parser.add_argument("--create-key", action="store_true", default=False, parser.add_argument("--create-key", action="store_true", default=False,
help="Create a repo signing key in a keystore") help="Create a repo signing key in a keystore")
parser.add_argument("-c", "--create-metadata", action="store_true", default=False, parser.add_argument("-c", "--create-metadata", action="store_true", default=False,
help="Create skeleton metadata files that are missing") help="Create skeleton metadata files that are missing")
parser.add_argument("--delete-unknown", action="store_true", default=False, parser.add_argument("--delete-unknown", action="store_true", default=False,
help="Delete APKs without metadata from the repo") help="Delete APKs without metadata from the repo")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
parser.add_argument("-b", "--buildreport", action="store_true", default=False, parser.add_argument("-b", "--buildreport", action="store_true", default=False,
help="Report on build data status") help="Report on build data status")
parser.add_argument("-i", "--interactive", default=False, action="store_true", parser.add_argument("-i", "--interactive", default=False, action="store_true",

View File

@ -37,11 +37,8 @@ def main():
# Parse command line... # Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]") parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
common.setup_global_opts(parser)
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]") parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
parser.add_argument("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_argument("-q", "--quiet", action="store_true", default=False,
help="Restrict output to warnings and errors")
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)