From 57c80e59a9f3b38c4c1dc00fd3e8001b5e2b4283 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 5 Feb 2008 20:56:25 +0000 Subject: Allow listing targets through SSH submit host It required to add a option --list on create-srpm and change repsys submit to use this option. --- CHANGES | 2 ++ RepSys/commands/submit.py | 12 +++++++++++- create-srpm | 12 ++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 223528c..fa7889a 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,8 @@ matches the package URL; - added boolean configuration option strict-revision in the submit section, to allow forcing the use of --strict +- added option --list in create-srpm to list the available targets +- make submit -l work on svn+ssh:// targets - the fix for the unreleased commits problem in the previous release was wrong, really fixed it - moved all configuration options that will hardly be changed to diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index bd6e01c..f1726dc 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -55,7 +55,7 @@ def parse_options(): parser = OptionParser(help=HELP) parser.defaults["revision"] = "" parser.add_option("-t", dest="target", default="Cooker") - parser.add_option("-l", dest="list", action="store_true") + parser.add_option("-l", action="callback", callback=list_targets) parser.add_option("-r", dest="revision", type="string", nargs=1) parser.add_option("-s", dest="submithost", type="string", nargs=1, default=None) @@ -77,6 +77,16 @@ def parse_options(): raise Error, "provide -l or a revision number" return opts +def list_targets(option, opt, val, parser): + host = config.get("submit", "host") + if host is None: + raise Error, "no submit host defined in repsys.conf" + createsrpm = get_helper("create-srpm") + #TODO make it configurable + command = "ssh %s %s --list" % (host, createsrpm) + execcmd(command, show=True) + sys.exit(0) + def submit(pkgdirurl, revision, target, list=0, define=[], submithost=None): #if not NINZ: # raise Error, "you must have NINZ installed to use this command" diff --git a/create-srpm b/create-srpm index 3dab068..0c51e97 100755 --- a/create-srpm +++ b/create-srpm @@ -89,8 +89,11 @@ def parse_options(): dest="urlmap", default=False, help="disable url mapping") parser.add_option("--define", action="append") + parser.add_option("--list", dest="list_targets", default=False, + action="store_true", + help="list submit targets available") opts, args = parser.parse_args() - if not args: + if not opts.list_targets and not args: parser.error("you must supply a package url") return opts, args @@ -100,7 +103,12 @@ def main(): iface = CmdIface() opts, args = parse_options() try: - iface.submit_package(args[0], opts.revision, opts.target, opts.urlmap, opts.define) + if opts.list_targets: + for target in iface.submit_targets(): + print target + else: + iface.submit_package(args[0], opts.revision, opts.target, + opts.urlmap, opts.define) except Error, e: sys.stderr.write("error: %s\n" % str(e)) sys.exit(1) -- cgit v1.2.1