diff options
Diffstat (limited to 'RepSys/commands')
-rw-r--r-- | RepSys/commands/getsrpm.py | 24 | ||||
-rw-r--r-- | RepSys/commands/markrelease.py | 9 | ||||
-rw-r--r-- | RepSys/commands/rpmlog.py | 6 | ||||
-rw-r--r-- | RepSys/commands/submit.py | 13 |
4 files changed, 32 insertions, 20 deletions
diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py index f2def54..a212b52 100644 --- a/RepSys/commands/getsrpm.py +++ b/RepSys/commands/getsrpm.py @@ -26,6 +26,7 @@ Options: -s FILE Run script with "FILE TOPDIR SPECFILE" command -n Rename the package to include the revision number -l Use subversion log to build rpm %changelog + -T FILE Template to be used to generate the %changelog -h Show this message Examples: @@ -41,7 +42,7 @@ def mode_callback(option, opt, val, parser, mode): try: opts.version, opts.release = val.split("-", 1) except ValueError: - raise Error, "wrong version, use something like 2.2-1cl" + raise Error, "wrong version, use something like 2.2-1mdk" elif mode == "revision": opts.revision = val @@ -51,20 +52,25 @@ def parse_options(): parser.defaults["version"] = None parser.defaults["release"] = None parser.defaults["revision"] = None - parser.add_option("-c", action="callback", callback=mode_callback, - callback_kwargs={"mode": "current"}) - parser.add_option("-p", action="callback", callback=mode_callback, - callback_kwargs={"mode": "pristine"}) - parser.add_option("-r", action="callback", callback=mode_callback, - callback_kwargs={"mode": "revision"}) - parser.add_option("-v", action="callback", callback=mode_callback, - callback_kwargs={"mode": "version"}) + parser.defaults["submit"] = False + callback_options = dict(action="callback", callback=mode_callback, + type="string", dest="__ignore") + parser.add_option("-c", callback_kwargs={"mode": "current"}, nargs=0, + **callback_options) + parser.add_option("-p", callback_kwargs={"mode": "pristine"}, nargs=0, + **callback_options) + parser.add_option("-r", callback_kwargs={"mode": "revision"}, nargs=1, + **callback_options) + parser.add_option("-v", callback_kwargs={"mode": "version"}, nargs=1, + **callback_options) parser.add_option("-t", dest="targetdirs", action="append", default=[]) parser.add_option("-s", dest="scripts", action="append", default=[]) parser.add_option("-P", dest="packager", default="") parser.add_option("-n", dest="revname", action="store_true") parser.add_option("-l", dest="svnlog", action="store_true") + parser.add_option("-T", dest="template", type="string", default=None) opts, args = parser.parse_args() + del opts.__ignore if len(args) != 1: raise Error, "invalid arguments" opts.pkgdirurl = default_parent(args[0]) diff --git a/RepSys/commands/markrelease.py b/RepSys/commands/markrelease.py index 628e02d..9e52a31 100644 --- a/RepSys/commands/markrelease.py +++ b/RepSys/commands/markrelease.py @@ -39,13 +39,14 @@ def version_callback(option, opt, val, parser): try: opts.version, opts.release = val.split("-", 1) except ValueError: - raise Error, "wrong version, use something like 1:2.2-1cl" + raise Error, "wrong version, use something like 1:2.2-1mdk" def parse_options(): parser = OptionParser(help=HELP) parser.defaults["version"] = None parser.defaults["release"] = None - parser.add_option("-v", action="callback", type="string", callback=version_callback) + parser.add_option("-v", action="callback", callback=version_callback, + nargs=1, type="string", dest="__ignore") parser.add_option("-r", dest="revision") parser.add_option("-f", dest="filename") parser.add_option("-n", dest="appendname", action="store_true") @@ -58,7 +59,7 @@ def parse_options(): filename = opts.filename appendname = opts.appendname - del opts.filename, opts.appendname + del opts.filename, opts.appendname, opts.__ignore if filename: if not os.path.isfile(filename): @@ -87,7 +88,7 @@ def parse_options(): raise Error, "no revision provided" elif not opts.version: raise Error, "no version provided" - get_auth() + #get_auth() return opts def main(): diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py index 24eddfe..7ea1ac0 100644 --- a/RepSys/commands/rpmlog.py +++ b/RepSys/commands/rpmlog.py @@ -15,6 +15,7 @@ Usage: repsys rpmlog [OPTIONS] REPPKGDIRURL Options: -r REV Collect logs from given revision to revision 0 -n NUM Output only last NUM entries + -T FILE %changelog template file to be used -h Show this message Examples: @@ -25,14 +26,15 @@ def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-r", dest="revision") parser.add_option("-n", dest="size", type="int") + parser.add_option("-T", "--template", dest="template", type="string") opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" opts.pkgdirurl = default_parent(args[0]) return opts -def rpmlog(pkgdirurl, revision, size): - sys.stdout.write(svn2rpm(pkgdirurl, revision, size)) +def rpmlog(pkgdirurl, revision, size, template): + sys.stdout.write(svn2rpm(pkgdirurl, revision, size, template=template)) def main(): do_command(parse_options, rpmlog) diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 1c3bf8b..3840296 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -1,9 +1,8 @@ #!/usr/bin/python from RepSys import Error, config from RepSys.command import * -from RepSys.util import execcmd from RepSys.rpmutil import get_spec, get_submit_info -from RepSys.util import get_auth +from RepSys.util import get_auth, execcmd import urllib import getopt import sys @@ -70,7 +69,6 @@ def submit(pkgdirurl, revision, target, list=0): user, passwd = urllib.splitpasswd(user) if passwd: raise Error, "do not use a password in your command line" - if type == "https": user, passwd = get_auth(username=user) #soap = NINZ.client.Binding(host=host, @@ -101,12 +99,17 @@ def submit(pkgdirurl, revision, target, list=0): except xmlrpclib.Error, e: raise Error, "remote error: "+str(e) else: - status, output = execcmd("ssh %s /usr/share/repsys/create-srpm '%s' %s %s" % (host, pkgdirurl, revision, target)) + if list: + raise Error, "unable to list targets from svn+ssh:// URLs" + command = "ssh %s /usr/share/repsys/create-srpm '%s' %s %s" % ( + host, pkgdirurl, revision, target) + status, output = execcmd(command) if status == 0: print "Package submitted!" else: sys.exit(status) - + + def main(): do_command(parse_options, submit) |