From 3c632697bd604933d3284acdc79eb3178ddd77ef Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 27 Sep 2006 13:45:38 +0000 Subject: merge 1.6.2b changes --- RepSys/commands/submit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 6e9eb0f..380391a 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -39,6 +39,7 @@ def parse_options(): parser.add_option("-t", dest="target", default="Cooker") parser.add_option("-l", dest="list", action="store_true") parser.add_option("-r", dest="revision", type="string", nargs=1) + parser.add_option("--define", action="append") opts, args = parser.parse_args() if not args: name, rev = get_submit_info(".") @@ -63,7 +64,7 @@ def parse_options(): raise Error, "provide -l or a revision number" return opts -def submit(pkgdirurl, revision, target, list=0): +def submit(pkgdirurl, revision, target, list=0, define=[]): #if not NINZ: # raise Error, "you must have NINZ installed to use this command" type, rest = urllib.splittype(pkgdirurl) @@ -113,10 +114,13 @@ def submit(pkgdirurl, revision, target, list=0): createsrpm = get_helper("create-srpm") command = "ssh %s %s '%s' -r %s -t %s" % ( host, createsrpm, pkgdirurl, revision, target) + if define: + command += " " + " ".join([ "--define " + x for x in define ]) status, output = execcmd(command) if status == 0: print "Package submitted!" else: + sys.stderr.write(output) sys.exit(status) -- cgit v1.2.1 From ff0c060f077628368f121800bd7da63330879061 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 13 Nov 2006 16:36:22 +0000 Subject: make get_srpm() verbose only when called from the getsrpm command --- RepSys/commands/getsrpm.py | 1 + 1 file changed, 1 insertion(+) (limited to 'RepSys/commands') diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py index a212b52..d76aca7 100644 --- a/RepSys/commands/getsrpm.py +++ b/RepSys/commands/getsrpm.py @@ -74,6 +74,7 @@ def parse_options(): if len(args) != 1: raise Error, "invalid arguments" opts.pkgdirurl = default_parent(args[0]) + opts.verbose = 1 return opts def main(): -- cgit v1.2.1 From a5ae5fc7033a0d13d999713620a2816b5aa3bc21 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 13 Nov 2006 20:20:17 +0000 Subject: Fixed undeclared name "pkgdirurl" in "co" subcommand. Replaced url by pkgdirurl, as in the rest of the code. --- RepSys/commands/co.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py index 0c9d2dc..f2b4d64 100644 --- a/RepSys/commands/co.py +++ b/RepSys/commands/co.py @@ -23,7 +23,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) not in (1, 2): raise Error, "invalid arguments" - opts.url = default_parent(args[0]) + opts.pkgdirurl = default_parent(args[0]) if len(args) == 2: opts.path = args[1] else: -- cgit v1.2.1 From a7c361fa2cc9546d95583ffd3d60fe78381f44f2 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 30 Nov 2006 13:07:14 +0000 Subject: Fixed wrong variable name on "changed". --- RepSys/commands/changed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/changed.py b/RepSys/commands/changed.py index c99f3ae..d3094a8 100644 --- a/RepSys/commands/changed.py +++ b/RepSys/commands/changed.py @@ -25,7 +25,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" - opts.url = default_parent(args[0]) + opts.pkgdirurl = default_parent(args[0]) opts.verbose = 1 # Unconfigurable return opts -- cgit v1.2.1 From 8a6a78b1e7de47da015c666dd44b29fa86a105a7 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 16 Jan 2007 18:50:46 +0000 Subject: Added the option "host" to the submit section. It allows to submit to one host the package placed in another subversion host. The option "-s" in the command-line also can do it. --- RepSys/commands/submit.py | 87 +++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 55 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 380391a..5c95526 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -18,12 +18,18 @@ import xmlrpclib HELP = """\ Usage: repsys submit [OPTIONS] [URL [REVISION]] +Submits the package from URL to the submit host. + Options: -t TARGET Submit given package URL to given target -l Just list available targets -r REV Provides a revision number (when not providing as an argument) + -s The host in which the package URL will be submitted + (defaults to the host in the URL) -h Show this message + --define Defines one variable to be used by the submit scripts + in the submit host Examples: repsys submit @@ -39,6 +45,8 @@ def parse_options(): parser.add_option("-t", dest="target", default="Cooker") parser.add_option("-l", dest="list", action="store_true") parser.add_option("-r", dest="revision", type="string", nargs=1) + parser.add_option("-s", dest="submithost", type="string", nargs=1, + default=None) parser.add_option("--define", action="append") opts, args = parser.parse_args() if not args: @@ -64,64 +72,33 @@ def parse_options(): raise Error, "provide -l or a revision number" return opts -def submit(pkgdirurl, revision, target, list=0, define=[]): +def submit(pkgdirurl, revision, target, list=0, define=[], submithost=None): #if not NINZ: # raise Error, "you must have NINZ installed to use this command" - type, rest = urllib.splittype(pkgdirurl) - host, path = urllib.splithost(rest) - user, host = urllib.splituser(host) - host, port = urllib.splitport(host) - if type != "https" and type != "svn+ssh": - raise Error, "you must use https:// or svn+ssh:// urls" - if user: - 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, - # url="https://%s/scripts/cnc/soap" % host, - # ssl=1, - # auth=(NINZ.client.AUTH.httpbasic, - # user, passwd)) - if port: - port = ":"+port - else: - port = "" - iface = xmlrpclib.ServerProxy("https://%s:%s@%s%s/scripts/cnc/xmlrpc" - % (user, passwd, host, port)) - try: - if list: - targets = iface.submit_targets() - if not targets: - raise Error, "no targets available" - sys.stdout.writelines(['"%s"\n' % x for x in targets]) - else: - iface.submit_package(pkgdirurl, revision, target) - print "Package submitted!" - #except NINZ.client.SoapError, e: - except xmlrpclib.ProtocolError, e: - raise Error, "remote error: "+str(e.errmsg) - except xmlrpclib.Fault, e: - raise Error, "remote error: "+str(e.faultString) - except xmlrpclib.Error, e: - raise Error, "remote error: "+str(e) + if submithost is None: + submithost = config.get("submit", "host") + if submithost is None: + # extract the submit host from the svn host + type, rest = urllib.splittype(pkgdirurl) + host, path = urllib.splithost(rest) + user, host = urllib.splituser(host) + submithost, port = urllib.splitport(host) + del type, user, port, path, rest + # runs a create-srpm in the server through ssh, which will make a + # copy of the rpm in the export directory + if list: + raise Error, "unable to list targets from svn+ssh:// URLs" + createsrpm = get_helper("create-srpm") + command = "ssh %s %s '%s' -r %s -t %s" % ( + submithost, createsrpm, pkgdirurl, revision, target) + if define: + command += " " + " ".join([ "--define " + x for x in define ]) + status, output = execcmd(command) + if status == 0: + print "Package submitted!" else: - # runs a create-srpm in the server through ssh, which will make a - # copy of the rpm in the export directory - if list: - raise Error, "unable to list targets from svn+ssh:// URLs" - createsrpm = get_helper("create-srpm") - command = "ssh %s %s '%s' -r %s -t %s" % ( - host, createsrpm, pkgdirurl, revision, target) - if define: - command += " " + " ".join([ "--define " + x for x in define ]) - status, output = execcmd(command) - if status == 0: - print "Package submitted!" - else: - sys.stderr.write(output) - sys.exit(status) + sys.stderr.write(output) + sys.exit(status) def main(): -- cgit v1.2.1 From 2e0c7def5895fea29177718abb690b75bc21695e Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Wed, 2 May 2007 19:41:47 +0000 Subject: Added initial support to mirrors, as requested by mrl. It was added an option "mirror" to repsys.conf, that will contain an URL to the mirror repository. Also added the subcommand "ci", which will relocate one working copy to the master repository before effectively commiting. --- RepSys/commands/ci.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 RepSys/commands/ci.py (limited to 'RepSys/commands') diff --git a/RepSys/commands/ci.py b/RepSys/commands/ci.py new file mode 100644 index 0000000..9ffa3bd --- /dev/null +++ b/RepSys/commands/ci.py @@ -0,0 +1,29 @@ +#!/usr/bin/python +from RepSys.command import * +from RepSys.rpmutil import commit + +HELP = """\ +Usage: repsys ci [TARGET] + +Will commit a change. The difference between an ordinary "svn ci" and +"repsys ci" is that it relocates the working copy to the default repository +in case the option "mirror" is set in repsys.conf. + +Options: + -h Show this message + +Examples: + repsys ci + repsys ci SPECS/package.spec SPECS/package-patch.patch +""" + +def parse_options(): + parser = OptionParser(help=HELP) + parser.add_option("-m", dest="message", default=None) + opts, args = parser.parse_args() + if len(args): + opts.target = args[0] + return opts + +def main(): + do_command(parse_options, commit) -- cgit v1.2.1 From 928b0bed6fff9a002fcd10533fd1fa464e1bc10b Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 3 May 2007 21:03:27 +0000 Subject: Added one cheap copy of the sync subcommand from mdvsys. It required two sensitive changes: - in order to parse the spec file, "rpm" module was used, so this is the brand new package dependency; and - as RepSys already had one "rpm" module, we had to rename it to "simplerpm" in order to allow access to the module from python-rpm (I think py2.4 is still used a lot so we can't use absolute imports) --- RepSys/commands/markrelease.py | 2 +- RepSys/commands/sync.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 RepSys/commands/sync.py (limited to 'RepSys/commands') diff --git a/RepSys/commands/markrelease.py b/RepSys/commands/markrelease.py index 9e52a31..440775b 100644 --- a/RepSys/commands/markrelease.py +++ b/RepSys/commands/markrelease.py @@ -9,7 +9,7 @@ # from RepSys import Error from RepSys.command import * -from RepSys.rpm import SRPM +from RepSys.simplerpm import SRPM from RepSys.rpmutil import mark_release from RepSys.util import get_auth import getopt diff --git a/RepSys/commands/sync.py b/RepSys/commands/sync.py new file mode 100644 index 0000000..42ede8d --- /dev/null +++ b/RepSys/commands/sync.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +from RepSys.command import * +from RepSys.rpmutil import sync + +HELP = """\ +Usage: repsys sync + +Will add or removed from the working copy new files added or removed +from the spec file. + +"No changes are commited." + +Options: + --dry-run Print results without changing the working copy + -h Show this message + +Examples: + repsys sync +""" + +def parse_options(): + parser = OptionParser(help=HELP) + parser.add_option("--dry-run", dest="dryrun", default=False, + action="store_true") + opts, args = parser.parse_args() + if len(args): + opts.target = args[0] + return opts + +def main(): + do_command(parse_options, sync) -- cgit v1.2.1 From 5f1a15b9c7b253c0267d05613683ac1fb5f88e6c Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 5 Jun 2007 19:17:27 +0000 Subject: Improved (and fixed) the support to mirrors and "switch" subcommand - added the switch subcommand to quickly switch between the default and the mirrored repositories - fixed bug of generating bogus mirror URLs - make "ci" smarter by only relocation if something has been changed in the working copy and it is not already relocated. --- RepSys/commands/switch.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 RepSys/commands/switch.py (limited to 'RepSys/commands') diff --git a/RepSys/commands/switch.py b/RepSys/commands/switch.py new file mode 100644 index 0000000..dcbdd17 --- /dev/null +++ b/RepSys/commands/switch.py @@ -0,0 +1,32 @@ +#!/usr/bin/python +from RepSys.command import * +from RepSys.rpmutil import switch + +HELP = """\ +Usage: repsys switch [URL] + +Relocates the working copy to the base location URL. If URL is not +provided, it will use the option default_parent from repsys.conf as +default, or, if the current working copy is already based in +default_parent, it will use the location from the mirror option from +repsys.conf. + +If the current work is based in another URL, it will use default_parent. + +Options: + -h Show this message + +Examples: + repsys switch + repsys switch https://mirrors.localnetwork/svn/packages/cooker +""" + +def parse_options(): + parser = OptionParser(help=HELP) + opts, args = parser.parse_args() + if len(args): + opts.mirrorurl = args[0] + return opts + +def main(): + do_command(parse_options, switch) -- cgit v1.2.1 From f7ab5b0c279fe21bfbb65082a512eccabcad5001 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 12 Jun 2007 18:59:27 +0000 Subject: Don't use mirror in 'co' when the user provides one URL --- RepSys/commands/co.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py index f2b4d64..693897a 100644 --- a/RepSys/commands/co.py +++ b/RepSys/commands/co.py @@ -23,7 +23,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) not in (1, 2): raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = args[0] if len(args) == 2: opts.path = args[1] else: -- cgit v1.2.1 From c8428377393fab3b0549229cdcc349f34500bc15 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 8 Nov 2007 17:21:09 +0000 Subject: Added option -o to 'co' to disable the use of mirror when checking out --- RepSys/commands/co.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'RepSys/commands') diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py index 693897a..cadcf56 100644 --- a/RepSys/commands/co.py +++ b/RepSys/commands/co.py @@ -10,6 +10,7 @@ Usage: repsys co [OPTIONS] URL [LOCALPATH] Options: -r REV Revision to checkout + -o Do not use the mirror (use official server) -h Show this message Examples: @@ -20,6 +21,8 @@ Examples: def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-r", dest="revision") + parser.add_option("-o", dest="use_mirror", default=True, + action="store_false") opts, args = parser.parse_args() if len(args) not in (1, 2): raise Error, "invalid arguments" -- cgit v1.2.1 From 0fe6300c34bb791ccfb1050b04fbb9afd162b322 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 13 Nov 2007 05:11:28 +0000 Subject: Make package and revision optional options for submit, again This mode has been broken for a long time due to a change in subversion output. The confirmation of the revision being used was removed, as already used by mdvsys. Instead, notify the user and allow him to interrupt the process. --- RepSys/commands/submit.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 5c95526..25d5831 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -20,6 +20,9 @@ Usage: repsys submit [OPTIONS] [URL [REVISION]] Submits the package from URL to the submit host. +If no URL and revision are specified, the latest changed revision in +the package working copy of the current directory will be used. + Options: -t TARGET Submit given package URL to given target -l Just list available targets @@ -51,15 +54,8 @@ def parse_options(): opts, args = parser.parse_args() if not args: name, rev = get_submit_info(".") - try: - yn = raw_input("Submit '%s', revision %d (y/N)? " % (name, rev)) - except KeyboardInterrupt: - yn = "n" - if yn.lower() in ("y", "yes"): - args = name, str(rev) - else: - print "Cancelled." - sys.exit(1) + args = name, str(rev) + print "submitting %s at revision %s..." % args elif len(args) > 2: raise Error, "invalid arguments" opts.pkgdirurl = default_parent(args[0]) -- cgit v1.2.1 From 007212afccceca682e0f98f2871398a3ff35db03 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 5 Feb 2008 20:47:14 +0000 Subject: Added option -F to repsys ci, as in svn ci --- RepSys/commands/ci.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'RepSys/commands') diff --git a/RepSys/commands/ci.py b/RepSys/commands/ci.py index 9ffa3bd..b6a54f6 100644 --- a/RepSys/commands/ci.py +++ b/RepSys/commands/ci.py @@ -11,6 +11,8 @@ in case the option "mirror" is set in repsys.conf. Options: -h Show this message + -m MSG Use the MSG as the log message + -F FILE Read log message from FILE Examples: repsys ci @@ -20,6 +22,8 @@ Examples: def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-m", dest="message", default=None) + parser.add_option("-F", dest="logfile", type="string", + default=None) opts, args = parser.parse_args() if len(args): opts.target = args[0] -- cgit v1.2.1 From 936d5717d1b4afc17b04afbe02ad7aff8770722d Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 5 Feb 2008 20:51:43 +0000 Subject: Small changes in help messages: - Added URL of the repository system Quickstart - Make the help message of ci clearer - Removed reference to --help-plugins - Added a simple description for repsys in main help - Added short description of interesting subcommands in main help - Updated CHANGES - Reformeatted the 'switch' message to make it easier to read - Improved the help message of 'submit', added reference to the status page - Better help message for rpmlog - Added help message for patchspec - Better help message for markrelease - Added a help message for getsrpm - Added help message for getspec - Better help message for 'create' + changed example URL - Added a clearer help message for co - Added some text explaining 'changed' - Better authoremail help - Clearer message about uncommenting config option - Removed all configuration options that are not needed by one external - Putsrpm is not working, remove from help message - Added another usage example for submit --- RepSys/commands/authoremail.py | 3 +++ RepSys/commands/changed.py | 2 ++ RepSys/commands/ci.py | 8 +++++--- RepSys/commands/co.py | 6 ++++++ RepSys/commands/create.py | 5 ++++- RepSys/commands/getspec.py | 5 ++++- RepSys/commands/getsrpm.py | 4 ++++ RepSys/commands/markrelease.py | 5 +++++ RepSys/commands/patchspec.py | 2 ++ RepSys/commands/rpmlog.py | 5 ++++- RepSys/commands/submit.py | 9 +++++++++ RepSys/commands/switch.py | 7 ++++--- 12 files changed, 52 insertions(+), 9 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/authoremail.py b/RepSys/commands/authoremail.py index aee7b58..f5b8b70 100644 --- a/RepSys/commands/authoremail.py +++ b/RepSys/commands/authoremail.py @@ -7,6 +7,9 @@ import getopt HELP = """\ Usage: repsys authoremail [OPTIONS] AUTHOR +Shows the e-mail of an SVN author. It is just a simple interface to access +the [authors] section of repsys.conf. + Options: -h Show this message diff --git a/RepSys/commands/changed.py b/RepSys/commands/changed.py index d3094a8..62b20b6 100644 --- a/RepSys/commands/changed.py +++ b/RepSys/commands/changed.py @@ -8,6 +8,8 @@ import sys HELP = """\ Usage: repsys changed [OPTIONS] URL +Shows if there are pending changes since the last package release. + Options: -a Check all packages in given URL -s Show differences diff --git a/RepSys/commands/ci.py b/RepSys/commands/ci.py index b6a54f6..8d373b5 100644 --- a/RepSys/commands/ci.py +++ b/RepSys/commands/ci.py @@ -5,9 +5,11 @@ from RepSys.rpmutil import commit HELP = """\ Usage: repsys ci [TARGET] -Will commit a change. The difference between an ordinary "svn ci" and -"repsys ci" is that it relocates the working copy to the default repository -in case the option "mirror" is set in repsys.conf. +Will commit recent modifications in the package. + +The difference between an ordinary "svn ci" and "repsys ci" is that it +relocates the working copy to the default repository in case the option +"mirror" is set in repsys.conf. Options: -h Show this message diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py index cadcf56..830b7e7 100644 --- a/RepSys/commands/co.py +++ b/RepSys/commands/co.py @@ -8,12 +8,18 @@ import sys HELP = """\ Usage: repsys co [OPTIONS] URL [LOCALPATH] +Checkout the package source from the Mandriva repository. + +If the 'mirror' option is enabled, the package is obtained from the mirror +repository. + Options: -r REV Revision to checkout -o Do not use the mirror (use official server) -h Show this message Examples: + repsys co pkgname repsys co http://repos/svn/cnc/snapshot/foo repsys co http://repos/svn/cnc/snapshot/foo foo-pkg """ diff --git a/RepSys/commands/create.py b/RepSys/commands/create.py index 56af1ef..a8709f0 100644 --- a/RepSys/commands/create.py +++ b/RepSys/commands/create.py @@ -8,11 +8,14 @@ import sys HELP = """\ Usage: repsys create [OPTIONS] URL +Creates the minimal structure of a package in the repository. + Options: -h Show this message Examples: - repsys create http://repos/svn/cnc/snapshot/newpkg + repsys create newpkg + repsys create svn+ssh://svn.mandriva.com/svn/packages/cooker/newpkg """ def parse_options(): diff --git a/RepSys/commands/getspec.py b/RepSys/commands/getspec.py index 1079a81..5e44074 100644 --- a/RepSys/commands/getspec.py +++ b/RepSys/commands/getspec.py @@ -8,12 +8,15 @@ import sys HELP = """\ Usage: repsys getspec [OPTIONS] REPPKGURL +Prints the .spec file of a given package. + Options: -t DIR Use DIR as target for spec file (default is ".") -h Show this message Examples: - repsys getspec http://repos/svn/cnc/snapshot/foo + repsys getspec pkgname + repsys getspec svn+ssh://svn.mandriva.com/svn/packages/cooker/pkgname """ def parse_options(): diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py index d76aca7..f1ebfe1 100644 --- a/RepSys/commands/getsrpm.py +++ b/RepSys/commands/getsrpm.py @@ -16,6 +16,8 @@ import os HELP = """\ Usage: repsys getsrpm [OPTIONS] REPPKGURL +Generates the source RPM (.srpm) file of a given package. + Options: -c Use files in current/ directory (default) -p Use files in pristine/ directory @@ -30,6 +32,8 @@ Options: -h Show this message Examples: + repsys getsrpm python + repsys getsrpm -l python repsys getsrpm http://foo.bar/svn/cnc/snapshot/python repsys getsrpm -p http://foo.bar/svn/cnc/releases/8cl/python repsys getsrpm -r 1001 file:///svn/cnc/snapshot/python diff --git a/RepSys/commands/markrelease.py b/RepSys/commands/markrelease.py index 440775b..1707f39 100644 --- a/RepSys/commands/markrelease.py +++ b/RepSys/commands/markrelease.py @@ -21,6 +21,11 @@ HELP = """\ Usage: repsys markrelease [OPTIONS] REPPKGURL +This subcommand creates a 'tag' for a given revision of a given package. + +The tag will be stored in the directory releases/ inside the package +structure. + Options: -f FILE Try to extract information from given file -r REV Revision which will be used to make the release copy tag diff --git a/RepSys/commands/patchspec.py b/RepSys/commands/patchspec.py index 155ff4f..8330cc3 100644 --- a/RepSys/commands/patchspec.py +++ b/RepSys/commands/patchspec.py @@ -11,6 +11,8 @@ import sys HELP = """\ Usage: repsys patchspec [OPTIONS] REPPKGURL PATCHFILE +It will try to patch a spec file from a given package url. + Options: -l LOG Use LOG as log message -h Show this message diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py index 7ea1ac0..5ba5fdd 100644 --- a/RepSys/commands/rpmlog.py +++ b/RepSys/commands/rpmlog.py @@ -12,6 +12,8 @@ import sys HELP = """\ Usage: repsys rpmlog [OPTIONS] REPPKGDIRURL +Prints the RPM changelog of a given package. + Options: -r REV Collect logs from given revision to revision 0 -n NUM Output only last NUM entries @@ -19,7 +21,8 @@ Options: -h Show this message Examples: - repsys rpmlog https://repos/snapshot/python + repsys rpmlog python + repsys rpmlog http://svn.mandriva.com/svn/packages/cooker/python """ def parse_options(): diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 25d5831..bd6e01c 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -20,6 +20,14 @@ Usage: repsys submit [OPTIONS] [URL [REVISION]] Submits the package from URL to the submit host. +The submit host will try to build the package, and upon successful +completion will 'tag' the package and upload it to the official +repositories. + +The status of the submit can visualized at: + +http://kenobi.mandriva.com/bs/output.php + If no URL and revision are specified, the latest changed revision in the package working copy of the current directory will be used. @@ -40,6 +48,7 @@ Examples: repsys submit https://repos/svn/mdv/cooker/foo 14800 repsys submit -r 14800 https://repos/svn/mdv/cooker/foo repsys submit -l https://repos + repsys submit --define section=main/testing -t 2008.0 """ def parse_options(): diff --git a/RepSys/commands/switch.py b/RepSys/commands/switch.py index dcbdd17..5cbe2d7 100644 --- a/RepSys/commands/switch.py +++ b/RepSys/commands/switch.py @@ -5,9 +5,10 @@ from RepSys.rpmutil import switch HELP = """\ Usage: repsys switch [URL] -Relocates the working copy to the base location URL. If URL is not -provided, it will use the option default_parent from repsys.conf as -default, or, if the current working copy is already based in +Relocates the working copy to the base location URL. + +If URL is not provided, it will use the option default_parent from +repsys.conf as default, or, if the current working copy is already based in default_parent, it will use the location from the mirror option from repsys.conf. -- cgit v1.2.1 From fb388c2b7d01c98b0456ce97cf163f5394710b10 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Tue, 5 Feb 2008 20:53:09 +0000 Subject: Added --strict option to getsrpm + equivalent configuration option This option makes repsys to fail if the revision provided by the user does not contain any changed path inside the package URL. This should prevent mistakes such as submitting update packages using the Cooker URL. --- RepSys/commands/getsrpm.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py index f1ebfe1..f9a63d2 100644 --- a/RepSys/commands/getsrpm.py +++ b/RepSys/commands/getsrpm.py @@ -19,17 +19,18 @@ Usage: repsys getsrpm [OPTIONS] REPPKGURL Generates the source RPM (.srpm) file of a given package. Options: - -c Use files in current/ directory (default) - -p Use files in pristine/ directory - -v VER Use files from the version specified by VER (e.g. 2.2.1-2cl) - -r REV Use files from current directory, in revision REV (e.g. 1001) - -t DIR Put SRPM file in directory DIR when done (default is ".") - -P USER Define the RPM packager inforamtion to USER - -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 + -c Use files in current/ directory (default) + -p Use files in pristine/ directory + -v VER Use files from the version specified by VER (e.g. 2.2.1-2cl) + -r REV Use files from current directory, in revision REV (e.g. 1001) + -t DIR Put SRPM file in directory DIR when done (default is ".") + -P USER Define the RPM packager inforamtion to USER + -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 + --strict Check if the given revision contains changes in REPPKGURL Examples: repsys getsrpm python @@ -73,6 +74,8 @@ def parse_options(): 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) + parser.add_option("--strict", dest="strict", default=False, + action="store_true") opts, args = parser.parse_args() del opts.__ignore if len(args) != 1: -- cgit v1.2.1 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. --- RepSys/commands/submit.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'RepSys/commands') 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" -- cgit v1.2.1 From 1e929f67375b699cdcac0b1557d115eed7035ae8 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Fri, 8 Feb 2008 00:43:26 +0000 Subject: Added option -d to sync, to download the missing files It also added a configuration option download-command, in the [global] section to define which command will be used to download. The default is wget. --- RepSys/commands/sync.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'RepSys/commands') diff --git a/RepSys/commands/sync.py b/RepSys/commands/sync.py index 42ede8d..a51db22 100644 --- a/RepSys/commands/sync.py +++ b/RepSys/commands/sync.py @@ -12,6 +12,8 @@ from the spec file. Options: --dry-run Print results without changing the working copy + --download -d + Try to download the source files not found -h Show this message Examples: @@ -22,6 +24,8 @@ def parse_options(): parser = OptionParser(help=HELP) parser.add_option("--dry-run", dest="dryrun", default=False, action="store_true") + parser.add_option("-d", "--download", dest="download", default=False, + action="store_true") opts, args = parser.parse_args() if len(args): opts.target = args[0] -- cgit v1.2.1 From e8dc997b06d5e5b50ba4f51dc74cd68ca8f6d612 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 3 Mar 2008 21:11:46 +0000 Subject: Added options -o, -p, -s to rpmlog These options are just direct flags to the new function get_changelog() --- RepSys/commands/rpmlog.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py index 5ba5fdd..561b0fd 100644 --- a/RepSys/commands/rpmlog.py +++ b/RepSys/commands/rpmlog.py @@ -3,10 +3,13 @@ # This program will convert the output of "svn log" to be suitable # for usage in an rpm %changelog session. # -from RepSys import Error +from RepSys import Error, RepSysTree from RepSys.command import * -from RepSys.log import svn2rpm +from RepSys.svn import SVN +from RepSys.log import get_changelog, split_spec_changelog +from cStringIO import StringIO import getopt +import os import sys HELP = """\ @@ -18,6 +21,9 @@ 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 + -o Append old package changelog + -p Append changelog found in .spec file + -s Sort changelog entries, even from the old log -h Show this message Examples: @@ -30,14 +36,30 @@ def parse_options(): parser.add_option("-r", dest="revision") parser.add_option("-n", dest="size", type="int") parser.add_option("-T", "--template", dest="template", type="string") + parser.add_option("-o", dest="oldlog", default=False, + action="store_true") + parser.add_option("-p", dest="usespec", default=False, + action="store_true") + parser.add_option("-s", dest="sort", default=False, + action="store_true") 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, template): - sys.stdout.write(svn2rpm(pkgdirurl, revision, size, template=template)) +def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort): + another = None + if usespec: + svn = SVN() + pkgname = RepSysTree.pkgname(pkgdirurl) + specurl = os.path.join(pkgdirurl, "current/SPECS", pkgname + + ".spec") + rawspec = svn.cat(specurl, rev=revision) + spec, another = split_spec_changelog(StringIO(rawspec)) + newlog = get_changelog(pkgdirurl, another=another, rev=revision, + size=size, sort=sort, template=template, oldlog=oldlog) + sys.stdout.writelines(newlog) def main(): do_command(parse_options, rpmlog) -- cgit v1.2.1 From 4e8097313bb091915febf708eaa1b3134873cc08 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 3 Mar 2008 21:13:34 +0000 Subject: Added small note about bad path hardcoded in rpmlog --- RepSys/commands/rpmlog.py | 1 + 1 file changed, 1 insertion(+) (limited to 'RepSys/commands') diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py index 561b0fd..3cdcc02 100644 --- a/RepSys/commands/rpmlog.py +++ b/RepSys/commands/rpmlog.py @@ -53,6 +53,7 @@ def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort): if usespec: svn = SVN() pkgname = RepSysTree.pkgname(pkgdirurl) + #FIXME don't hardcode current/, it may already be in the URL specurl = os.path.join(pkgdirurl, "current/SPECS", pkgname + ".spec") rawspec = svn.cat(specurl, rev=revision) -- cgit v1.2.1 From d8ba6ea3b5d5dc7a80050cf4955e7588609a1d21 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:23:33 +0000 Subject: Pulled a couple of get_submit_info fixes --- RepSys/commands/submit.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index f1726dc..f2f1cdb 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -62,9 +62,11 @@ def parse_options(): parser.add_option("--define", action="append") opts, args = parser.parse_args() if not args: - name, rev = get_submit_info(".") - args = name, str(rev) - print "submitting %s at revision %s..." % args + name, url, rev = get_submit_info(".") + args = url, str(rev) + #FIXME bad place for output + print "Submitting %s at revision %s" % (name, rev) + print "URL: " + url elif len(args) > 2: raise Error, "invalid arguments" opts.pkgdirurl = default_parent(args[0]) -- cgit v1.2.1 From 3e8f299463066309321f5356831e6fd45e371660 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:23:41 +0000 Subject: Allow submitting packages at once It adds a new syntax for repsys submit, in which each package version can be specified using the NAME@REV format. It also required to change create-srpm to accept the new format. It should still be compatible with older clients. --- RepSys/commands/submit.py | 74 +++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index f2f1cdb..2869ff4 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -1,22 +1,18 @@ #!/usr/bin/python from RepSys import Error, config from RepSys.command import * -from RepSys.rpmutil import get_spec, get_submit_info +from RepSys.rpmutil import get_spec, get_submit_info, svn_url_rev from RepSys.util import get_auth, execcmd, get_helper import urllib import getopt import sys import re - -#try: -# import NINZ.client -#except ImportError: -# NINZ = None +import subprocess import xmlrpclib HELP = """\ -Usage: repsys submit [OPTIONS] [URL [REVISION]] +Usage: repsys submit [OPTIONS] [URL[@REVISION] ...] Submits the package from URL to the submit host. @@ -28,8 +24,8 @@ The status of the submit can visualized at: http://kenobi.mandriva.com/bs/output.php -If no URL and revision are specified, the latest changed revision in -the package working copy of the current directory will be used. +If no URL and revision are specified, the latest changed revision in the +package working copy of the current directory will be used. Options: -t TARGET Submit given package URL to given target @@ -44,39 +40,46 @@ Options: Examples: repsys submit - repsys submit foo 14800 - repsys submit https://repos/svn/mdv/cooker/foo 14800 - repsys submit -r 14800 https://repos/svn/mdv/cooker/foo + repsys submit foo + repsys submit foo@14800 bar baz@11001 + repsys submit https://repos/svn/mdv/cooker/foo repsys submit -l https://repos - repsys submit --define section=main/testing -t 2008.0 + repsys submit --define section=main/testing -t 2008.1 """ def parse_options(): parser = OptionParser(help=HELP) - parser.defaults["revision"] = "" + parser.defaults["revision"] = None parser.add_option("-t", dest="target", default="Cooker") 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) - parser.add_option("--define", action="append") + parser.add_option("--define", action="append", default=[]) opts, args = parser.parse_args() if not args: name, url, rev = get_submit_info(".") - args = url, str(rev) - #FIXME bad place for output + args = ["%s@%s" % (url, str(rev))] print "Submitting %s at revision %s" % (name, rev) - print "URL: " + url - elif len(args) > 2: - raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + print "URL: %s" % url + if opts.revision is not None: + # backwards compatibility with the old -r usage + if len(args) == 1: + args[0] = args[0] + "@" + opts.revision + else: + raise Error, "can't use -r REV with more than one package name" + del opts.revision if len(args) == 2: - opts.revision = re.compile(r".*?(\d+).*").sub(r"\1", args[1]) - elif len(args) == 1 and opts.revision: - # accepts -r 3123 http://foo/bar - pass - elif not opts.list: - raise Error, "provide -l or a revision number" + # prevent from using the old syntax + try: + rev = int(args[1]) + except ValueError: + # ok, it is a package name, let it pass + pass + else: + raise Error, "the format is deprecated, "\ + "use @ instead" + opts.urls = [default_parent(nameurl) for nameurl in args] return opts def list_targets(option, opt, val, parser): @@ -89,9 +92,7 @@ def list_targets(option, opt, val, parser): 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" +def submit(urls, target, define=[], submithost=None): if submithost is None: submithost = config.get("submit", "host") if submithost is None: @@ -103,13 +104,13 @@ def submit(pkgdirurl, revision, target, list=0, define=[], submithost=None): del type, user, port, path, rest # runs a create-srpm in the server through ssh, which will make a # copy of the rpm in the export directory - if list: - raise Error, "unable to list targets from svn+ssh:// URLs" createsrpm = get_helper("create-srpm") - command = "ssh %s %s '%s' -r %s -t %s" % ( - submithost, createsrpm, pkgdirurl, revision, target) - if define: - command += " " + " ".join([ "--define " + x for x in define ]) + args = ["ssh", submithost, createsrpm, "-t", target] + for entry in define: + args.append("--define") + args.append(entry) + args.extend(urls) + command = subprocess.list2cmdline(args) status, output = execcmd(command) if status == 0: print "Package submitted!" @@ -117,7 +118,6 @@ def submit(pkgdirurl, revision, target, list=0, define=[], submithost=None): sys.stderr.write(output) sys.exit(status) - def main(): do_command(parse_options, submit) -- cgit v1.2.1 From 5c7f585c08c8ffb944095ae031fbf82a54ba13bc Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:24:21 +0000 Subject: Allow specifying distro branches without using complete URLs Added the configuration option "repository", which will have the URL to the root of the repository. The change also allowed using mirrors in all the read-only commands. --- RepSys/commands/changed.py | 4 +++- RepSys/commands/co.py | 14 +++++++++++--- RepSys/commands/create.py | 3 ++- RepSys/commands/editlog.py | 3 ++- RepSys/commands/getspec.py | 4 +++- RepSys/commands/getsrpm.py | 4 +++- RepSys/commands/markrelease.py | 3 ++- RepSys/commands/patchspec.py | 3 ++- RepSys/commands/putsrpm.py | 3 ++- RepSys/commands/rpmlog.py | 10 ++++------ RepSys/commands/submit.py | 14 +++++++++++--- 11 files changed, 45 insertions(+), 20 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/changed.py b/RepSys/commands/changed.py index 62b20b6..7d05604 100644 --- a/RepSys/commands/changed.py +++ b/RepSys/commands/changed.py @@ -1,6 +1,7 @@ #!/usr/bin/python from RepSys import Error from RepSys.command import * +from RepSys.layout import package_url from RepSys.rpmutil import check_changed import getopt import sys @@ -13,6 +14,7 @@ Shows if there are pending changes since the last package release. Options: -a Check all packages in given URL -s Show differences + -M Do not use the mirror (use the main repository) -h Show this message Examples: @@ -27,7 +29,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = package_url(args[0]) opts.verbose = 1 # Unconfigurable return opts diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py index 830b7e7..5349049 100644 --- a/RepSys/commands/co.py +++ b/RepSys/commands/co.py @@ -13,13 +13,19 @@ Checkout the package source from the Mandriva repository. If the 'mirror' option is enabled, the package is obtained from the mirror repository. +You can specify the distro branch to checkout from by using distro/pkgname. + Options: + -d The distribution branch to checkout from + -b The package branch -r REV Revision to checkout - -o Do not use the mirror (use official server) + -M Do not use the mirror (use the main repository) -h Show this message Examples: repsys co pkgname + repsys co -d 2009.0 pkgname + repsys co 2009.0/pkgame repsys co http://repos/svn/cnc/snapshot/foo repsys co http://repos/svn/cnc/snapshot/foo foo-pkg """ @@ -27,11 +33,13 @@ Examples: def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-r", dest="revision") - parser.add_option("-o", dest="use_mirror", default=True, - action="store_false") + parser.add_option("--distribution", "-d", dest="distro", default=None) + parser.add_option("--branch", "-b", dest="branch", default=None) opts, args = parser.parse_args() if len(args) not in (1, 2): raise Error, "invalid arguments" + # here we don't use package_url in order to notify the user we are + # using the mirror opts.pkgdirurl = args[0] if len(args) == 2: opts.path = args[1] diff --git a/RepSys/commands/create.py b/RepSys/commands/create.py index a8709f0..ded8abe 100644 --- a/RepSys/commands/create.py +++ b/RepSys/commands/create.py @@ -1,6 +1,7 @@ #!/usr/bin/python from RepSys import Error from RepSys.command import * +from RepSys.layout import package_url from RepSys.rpmutil import create_package import getopt import sys @@ -23,7 +24,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = package_url(args[0], mirrored=False) opts.verbose = 1 # Unconfigurable return opts diff --git a/RepSys/commands/editlog.py b/RepSys/commands/editlog.py index 1962ed8..9d1afc5 100644 --- a/RepSys/commands/editlog.py +++ b/RepSys/commands/editlog.py @@ -1,6 +1,7 @@ #!/usr/bin/python from RepSys import Error from RepSys.command import * +from RepSys.layout import package_url from RepSys.svn import SVN import re @@ -24,7 +25,7 @@ def parse_options(): pkgdirurl, revision = "", args[0] else: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(pkgdirurl) + opts.pkgdirurl = package_url(pkgdirurl, mirrored=False) opts.revision = re.compile(r".*?(\d+).*").sub(r"\1", revision) return opts diff --git a/RepSys/commands/getspec.py b/RepSys/commands/getspec.py index 5e44074..6a8f7ea 100644 --- a/RepSys/commands/getspec.py +++ b/RepSys/commands/getspec.py @@ -1,6 +1,7 @@ #!/usr/bin/python from RepSys import Error from RepSys.command import * +from RepSys.layout import package_url from RepSys.rpmutil import get_spec import getopt import sys @@ -12,6 +13,7 @@ Prints the .spec file of a given package. Options: -t DIR Use DIR as target for spec file (default is ".") + -M Do not use the mirror (use the main repository) -h Show this message Examples: @@ -25,7 +27,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = package_url(args[0]) return opts def main(): diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py index f9a63d2..8cbe1f1 100644 --- a/RepSys/commands/getsrpm.py +++ b/RepSys/commands/getsrpm.py @@ -5,6 +5,7 @@ # from RepSys import Error, config from RepSys.command import * +from RepSys.layout import package_url from RepSys.rpmutil import get_srpm import tempfile import shutil @@ -29,6 +30,7 @@ Options: -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 + -M Do not use the mirror (use the main repository) -h Show this message --strict Check if the given revision contains changes in REPPKGURL @@ -80,7 +82,7 @@ def parse_options(): del opts.__ignore if len(args) != 1: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = package_url(args[0]) opts.verbose = 1 return opts diff --git a/RepSys/commands/markrelease.py b/RepSys/commands/markrelease.py index 1707f39..057cf1d 100644 --- a/RepSys/commands/markrelease.py +++ b/RepSys/commands/markrelease.py @@ -9,6 +9,7 @@ # from RepSys import Error from RepSys.command import * +from RepSys.layout import package_url from RepSys.simplerpm import SRPM from RepSys.rpmutil import mark_release from RepSys.util import get_auth @@ -60,7 +61,7 @@ def parse_options(): if len(args) != 1: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = package_url(args[0], mirrored=False) filename = opts.filename appendname = opts.appendname diff --git a/RepSys/commands/patchspec.py b/RepSys/commands/patchspec.py index 8330cc3..9a4881b 100644 --- a/RepSys/commands/patchspec.py +++ b/RepSys/commands/patchspec.py @@ -5,6 +5,7 @@ from RepSys import Error from RepSys.rpmutil import patch_spec from RepSys.command import * +from RepSys.layout import package_url import getopt import sys @@ -27,7 +28,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 2: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = package_url(args[0], mirrored=False) opts.patchfile = args[1] return opts diff --git a/RepSys/commands/putsrpm.py b/RepSys/commands/putsrpm.py index 21ad234..0717cd6 100644 --- a/RepSys/commands/putsrpm.py +++ b/RepSys/commands/putsrpm.py @@ -9,6 +9,7 @@ # from RepSys import Error from RepSys.command import * +from RepSys.layout import package_url from RepSys.rpmutil import put_srpm import getopt import sys, os @@ -34,7 +35,7 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 2: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = package_url(args[0], mirrored=False) opts.srpmfile = args[1] return opts diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py index 3cdcc02..11fe36d 100644 --- a/RepSys/commands/rpmlog.py +++ b/RepSys/commands/rpmlog.py @@ -3,7 +3,7 @@ # This program will convert the output of "svn log" to be suitable # for usage in an rpm %changelog session. # -from RepSys import Error, RepSysTree +from RepSys import Error, layout from RepSys.command import * from RepSys.svn import SVN from RepSys.log import get_changelog, split_spec_changelog @@ -24,6 +24,7 @@ Options: -o Append old package changelog -p Append changelog found in .spec file -s Sort changelog entries, even from the old log + -M Do not use the mirror (use the main repository) -h Show this message Examples: @@ -45,17 +46,14 @@ def parse_options(): opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" - opts.pkgdirurl = default_parent(args[0]) + opts.pkgdirurl = layout.package_url(args[0]) return opts def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort): another = None if usespec: svn = SVN() - pkgname = RepSysTree.pkgname(pkgdirurl) - #FIXME don't hardcode current/, it may already be in the URL - specurl = os.path.join(pkgdirurl, "current/SPECS", pkgname + - ".spec") + specurl = layout.package_spec_url(pkgdirurl) rawspec = svn.cat(specurl, rev=revision) spec, another = split_spec_changelog(StringIO(rawspec)) newlog = get_changelog(pkgdirurl, another=another, rev=revision, diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 2869ff4..334a424 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -1,7 +1,8 @@ #!/usr/bin/python from RepSys import Error, config from RepSys.command import * -from RepSys.rpmutil import get_spec, get_submit_info, svn_url_rev +from RepSys.layout import package_url, distro_branch +from RepSys.rpmutil import get_spec, get_submit_info from RepSys.util import get_auth, execcmd, get_helper import urllib import getopt @@ -41,16 +42,19 @@ Options: Examples: repsys submit repsys submit foo + repsys submit 2009.1/foo repsys submit foo@14800 bar baz@11001 repsys submit https://repos/svn/mdv/cooker/foo repsys submit -l https://repos repsys submit --define section=main/testing -t 2008.1 """ +DEFAULT_TARGET = "Cooker" + def parse_options(): parser = OptionParser(help=HELP) parser.defaults["revision"] = None - parser.add_option("-t", dest="target", default="Cooker") + parser.add_option("-t", dest="target", default=None) 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, @@ -79,7 +83,11 @@ def parse_options(): else: raise Error, "the format is deprecated, "\ "use @ instead" - opts.urls = [default_parent(nameurl) for nameurl in args] + opts.urls = [package_url(nameurl, mirrored=False) for nameurl in args] + if opts.target is None: + target = distro_branch(opts.urls[0]) or DEFAULT_TARGET + print "Implicit target: %s" % target + opts.target = target return opts def list_targets(option, opt, val, parser): -- cgit v1.2.1 From 36e54d749e487a4105744e72d3346e777200ed4c Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:24:35 +0000 Subject: Initially working "submit-groups" code It is possible to specify a group of packages and a revision to be submitted. --- RepSys/commands/submit.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 334a424..79129f1 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -1,7 +1,6 @@ #!/usr/bin/python -from RepSys import Error, config +from RepSys import Error, config, layout from RepSys.command import * -from RepSys.layout import package_url, distro_branch from RepSys.rpmutil import get_spec, get_submit_info from RepSys.util import get_auth, execcmd, get_helper import urllib @@ -21,6 +20,9 @@ The submit host will try to build the package, and upon successful completion will 'tag' the package and upload it to the official repositories. +The package name can refer to an alias to a group of packages defined in +the section submit-groups of the configuration file. + The status of the submit can visualized at: http://kenobi.mandriva.com/bs/output.php @@ -46,6 +48,7 @@ Examples: repsys submit foo@14800 bar baz@11001 repsys submit https://repos/svn/mdv/cooker/foo repsys submit -l https://repos + repsys submit -t 2008.1 my-python-packages@11011 repsys submit --define section=main/testing -t 2008.1 """ @@ -83,13 +86,30 @@ def parse_options(): else: raise Error, "the format is deprecated, "\ "use @ instead" - opts.urls = [package_url(nameurl, mirrored=False) for nameurl in args] + # expand group aliases + expanded = [] + for nameurl in args: + expanded.extend(expand_group(nameurl)) + if expanded != args: + print "Submitting: %s" % " ".join(expanded) + args = expanded + opts.urls = [layout.package_url(nameurl, mirrored=False) for nameurl in args] if opts.target is None: - target = distro_branch(opts.urls[0]) or DEFAULT_TARGET + target = layout.distro_branch(opts.urls[0]) or DEFAULT_TARGET print "Implicit target: %s" % target opts.target = target return opts +def expand_group(group): + name, rev = layout.split_url_revision(group) + found = config.get("submit-groups", name) + packages = [group] + if found: + packages = found.split() + if rev: + packages = [("%s@%s" % package) for package in packages] + return packages + def list_targets(option, opt, val, parser): host = config.get("submit", "host") if host is None: -- cgit v1.2.1 From 5335dc3383f43a037c548158b3cd6bc385eb5770 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:24:41 +0000 Subject: Allow using the format / for submit groups It will expand / for each package name of the group (using the same of course.) We must allow it as the option -d (which would be used for --distro) would be confused with --define, so we'd better use the standard format that is available for all other commands. --- RepSys/commands/submit.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 79129f1..c4a0c05 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -102,12 +102,19 @@ def parse_options(): def expand_group(group): name, rev = layout.split_url_revision(group) + distro = None + if "/" in name: + distro, name = name.rsplit("/", 1) found = config.get("submit-groups", name) packages = [group] if found: packages = found.split() if rev: - packages = [("%s@%s" % package) for package in packages] + packages = [("%s@%s" % (package, rev)) + for package in packages] + if distro: + packages = ["%s/%s" % (distro, package) + for package in packages] return packages def list_targets(option, opt, val, parser): -- cgit v1.2.1 From 57d98ad144636d796103d1624fd9a130ad8fc33c Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:24:48 +0000 Subject: Ok, we have added a --distro option in order to allow the user specifying the distro name without worrying about the format. Just for completeness. --- RepSys/commands/submit.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index c4a0c05..44a4284 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -38,6 +38,7 @@ Options: -s The host in which the package URL will be submitted (defaults to the host in the URL) -h Show this message + --distro The distribution branch where the packages come from --define Defines one variable to be used by the submit scripts in the submit host @@ -62,6 +63,8 @@ def parse_options(): parser.add_option("-r", dest="revision", type="string", nargs=1) parser.add_option("-s", dest="submithost", type="string", nargs=1, default=None) + parser.add_option("--distro", dest="distro", type="string", + default=None) parser.add_option("--define", action="append", default=[]) opts, args = parser.parse_args() if not args: @@ -93,7 +96,9 @@ def parse_options(): if expanded != args: print "Submitting: %s" % " ".join(expanded) args = expanded - opts.urls = [layout.package_url(nameurl, mirrored=False) for nameurl in args] + opts.urls = [layout.package_url(nameurl, distro=opts.distro, mirrored=False) + for nameurl in args] + del opts.distro if opts.target is None: target = layout.distro_branch(opts.urls[0]) or DEFAULT_TARGET print "Implicit target: %s" % target -- cgit v1.2.1 From 84042a07cc5903105a4689f82ccf802964d5b714 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:24:54 +0000 Subject: In the usage example don't use -t because the user may think it is referring to the source distro --- RepSys/commands/submit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 44a4284..e6b1cc4 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -49,7 +49,7 @@ Examples: repsys submit foo@14800 bar baz@11001 repsys submit https://repos/svn/mdv/cooker/foo repsys submit -l https://repos - repsys submit -t 2008.1 my-python-packages@11011 + repsys submit 2008.1/my-python-packages@11011 repsys submit --define section=main/testing -t 2008.1 """ -- cgit v1.2.1 From 17440c0872591bb090f72b3ea31ca43c799351ba Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:25:02 +0000 Subject: Don't say 'implicit target' when the user uses --distro, it is being explicit --- RepSys/commands/submit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index e6b1cc4..e3b2b85 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -98,11 +98,11 @@ def parse_options(): args = expanded opts.urls = [layout.package_url(nameurl, distro=opts.distro, mirrored=False) for nameurl in args] - del opts.distro - if opts.target is None: + if opts.target is None and distro is None: target = layout.distro_branch(opts.urls[0]) or DEFAULT_TARGET print "Implicit target: %s" % target opts.target = target + del opts.distro return opts def expand_group(group): -- cgit v1.2.1 From 5d9cf5d6c8da267be11d3a39d297c2e9b2b9cf8a Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:25:39 +0000 Subject: Remove the reference to 'python' in the usage example, as chances are high people will not understant it anyway and it would just make it hard to make out what it means --- RepSys/commands/submit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index e3b2b85..36a8ef6 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -49,7 +49,7 @@ Examples: repsys submit foo@14800 bar baz@11001 repsys submit https://repos/svn/mdv/cooker/foo repsys submit -l https://repos - repsys submit 2008.1/my-python-packages@11011 + repsys submit 2008.1/my-packages@11011 repsys submit --define section=main/testing -t 2008.1 """ -- cgit v1.2.1 From 73bef7b3b7a6c1d7c2c2d1b0dfad52e7d7bfa9ab Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:25:46 +0000 Subject: Oops, typo --- RepSys/commands/submit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 36a8ef6..aefe1ff 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -98,7 +98,7 @@ def parse_options(): args = expanded opts.urls = [layout.package_url(nameurl, distro=opts.distro, mirrored=False) for nameurl in args] - if opts.target is None and distro is None: + if opts.target is None and opts.distro is None: target = layout.distro_branch(opts.urls[0]) or DEFAULT_TARGET print "Implicit target: %s" % target opts.target = target -- cgit v1.2.1 From 2118671715facec324814a3e834cabaf97fc3f34 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 10 Nov 2008 16:01:37 +0000 Subject: Make submit compatible with older repsys versions on the server-side Don't use the new pkg@rev format when the user tries to submit only one package. --- RepSys/commands/submit.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index aefe1ff..88ff596 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -149,7 +149,14 @@ def submit(urls, target, define=[], submithost=None): for entry in define: args.append("--define") args.append(entry) - args.extend(urls) + if len(urls) == 1: + # be compatible with server-side repsys versions older than 1.6.90 + url, rev = layout.split_url_revision(urls[0]) + args.append(url) + args.append("-r") + args.append(str(rev)) + else: + args.extend(urls) command = subprocess.list2cmdline(args) status, output = execcmd(command) if status == 0: -- cgit v1.2.1 From e0d6e1b694ef10563a34c53fae9450d8d97efa67 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 10 Nov 2008 20:47:25 +0000 Subject: Fixed putsrpm, old structure but new colors Make it work again and added an alias to "import", as in mdvsys. --- RepSys/commands/putsrpm.py | 65 +++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 36 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/putsrpm.py b/RepSys/commands/putsrpm.py index 0717cd6..5256cba 100644 --- a/RepSys/commands/putsrpm.py +++ b/RepSys/commands/putsrpm.py @@ -1,12 +1,4 @@ #!/usr/bin/python -# -# This program will append a release to the Conectiva Linux package -# repository system. It's meant to be a startup system to include -# pre-packaged SRPMS in the repository, thus, you should not commit -# packages over an ongoing package structure (with changes in current/ -# directory and etc). Also, notice that packages must be included in -# cronological order. -# from RepSys import Error from RepSys.command import * from RepSys.layout import package_url @@ -15,47 +7,48 @@ import getopt import sys, os HELP = """\ -*** WARNING --- You probably SHOULD NOT use this program! --- WARNING *** +Usage: repsys putsrpm [OPTIONS] SOURCERPMS -Usage: repsys putsrpm [OPTIONS] REPPKGURL +Will import source RPMs into the SVN repository. + +If the package was already imported, it will add the new files and remove +those not present in the source RPM. Options: - -n Append package name to provided URL - -l LOG Use log when commiting changes + -m LOG Log message used when commiting changes + -t Create version-release tag on releases/ + -b NAME The distribution branch to place it + -d URL The URL of base directory where packages will be placed + -c URL The URL of the base directory where the changelog will be + placed + -s Don't strip the changelog from the spec -h Show this message Examples: - repsys putsrpm file://svn/cnc/snapshot/foo /cnc/d/SRPMS/foo-1.0.src.rpm + repsys putsrpm pkg/SRPMS/pkg-2.0-1.src.rpm + repsys putsrpm -b 2009.1 foo-1.1-1.src.rpm """ def parse_options(): parser = OptionParser(help=HELP) - parser.add_option("-l", dest="log", default="") - parser.add_option("-n", dest="appendname", action="store_true") + parser.add_option("-l", dest="logmsg", default="") + parser.add_option("-t", dest="markrelease", action="store_true", + default=False) + parser.add_option("-s", dest="striplog", action="store_false", + default=True) + parser.add_option("-b", dest="branch", type="string", default=None) + parser.add_option("-d", dest="baseurl", type="string", default=None) + parser.add_option("-c", dest="baseold", type="string", default=None) opts, args = parser.parse_args() - if len(args) != 2: - raise Error, "invalid arguments" - opts.pkgdirurl = package_url(args[0], mirrored=False) - opts.srpmfile = args[1] + opts.srpmfiles = args return opts -def put_srpm_cmd(pkgdirurl, srpmfile, appendname=0, log=""): - if os.path.isdir(srpmfile): - dir = srpmfile - for entry in os.listdir(dir): - if entry[-8:] == ".src.rpm": - sys.stderr.write("Putting %s... " % entry) - sys.stderr.flush() - entrypath = os.path.join(dir, entry) - try: - put_srpm(pkgdirurl, entrypath, appendname, log) - sys.stderr.write("done\n") - except Error, e: - sys.stderr.write("error: %s\n" % str(e)) - else: - put_srpm(pkgdirurl, srpmfile, appendname, log) - - +def put_srpm_cmd(srpmfiles, markrelease=False, striplog=True, branch=None, + baseurl=None, baseold=None, logmsg=None): + for path in srpmfiles: + put_srpm(path, markrelease, striplog, branch, baseurl, baseold, + logmsg) + def main(): do_command(parse_options, put_srpm_cmd) -- cgit v1.2.1