From 846c9e0ef180aa5411803eb1906896dc5e2fc5b9 Mon Sep 17 00:00:00 2001 From: Mageia SVN-Git Migration Date: Tue, 4 Jan 2011 16:09:44 +0000 Subject: Synthesized commit during git-svn import combining previous Mandriva history with Magiea. This commit consitsts of the following subversion commits: ------------------------------------------------------------------------ r202 | boklm | 2011-01-04 16:09:44 +0000 (Tue, 04 Jan 2011) | 1 line add repsys ------------------------------------------------------------------------ --- RepSys/commands/__init__.py | 0 RepSys/commands/authoremail.py | 0 RepSys/commands/changed.py | 4 ++- RepSys/commands/ci.py | 0 RepSys/commands/co.py | 16 ++++++++- RepSys/commands/create.py | 0 RepSys/commands/del.py | 30 +++++++++++++++++ RepSys/commands/editlog.py | 0 RepSys/commands/getspec.py | 4 ++- RepSys/commands/getsrpm.py | 10 +++++- RepSys/commands/log.py | 62 ++++++++++++++++++++++++++++++++++ RepSys/commands/markrelease.py | 0 RepSys/commands/patchspec.py | 0 RepSys/commands/putsrpm.py | 1 + RepSys/commands/rpmlog.py | 4 ++- RepSys/commands/submit.py | 76 ++++++++++++++++++++++++++++++++---------- RepSys/commands/switch.py | 6 ++-- RepSys/commands/sync.py | 9 +++-- RepSys/commands/up.py | 22 ++++++++++++ RepSys/commands/upload.py | 28 ++++++++++++++++ 20 files changed, 243 insertions(+), 29 deletions(-) mode change 100644 => 100755 RepSys/commands/__init__.py mode change 100644 => 100755 RepSys/commands/authoremail.py mode change 100644 => 100755 RepSys/commands/changed.py mode change 100644 => 100755 RepSys/commands/ci.py mode change 100644 => 100755 RepSys/commands/co.py mode change 100644 => 100755 RepSys/commands/create.py create mode 100755 RepSys/commands/del.py mode change 100644 => 100755 RepSys/commands/editlog.py mode change 100644 => 100755 RepSys/commands/getspec.py mode change 100644 => 100755 RepSys/commands/getsrpm.py create mode 100755 RepSys/commands/log.py mode change 100644 => 100755 RepSys/commands/markrelease.py mode change 100644 => 100755 RepSys/commands/patchspec.py mode change 100644 => 100755 RepSys/commands/putsrpm.py mode change 100644 => 100755 RepSys/commands/rpmlog.py mode change 100644 => 100755 RepSys/commands/submit.py mode change 100644 => 100755 RepSys/commands/switch.py mode change 100644 => 100755 RepSys/commands/sync.py create mode 100755 RepSys/commands/up.py create mode 100755 RepSys/commands/upload.py (limited to 'RepSys/commands') diff --git a/RepSys/commands/__init__.py b/RepSys/commands/__init__.py old mode 100644 new mode 100755 diff --git a/RepSys/commands/authoremail.py b/RepSys/commands/authoremail.py old mode 100644 new mode 100755 diff --git a/RepSys/commands/changed.py b/RepSys/commands/changed.py old mode 100644 new mode 100755 index 7d05604..66c1a53 --- a/RepSys/commands/changed.py +++ b/RepSys/commands/changed.py @@ -1,5 +1,5 @@ #!/usr/bin/python -from RepSys import Error +from RepSys import Error, disable_mirror from RepSys.command import * from RepSys.layout import package_url from RepSys.rpmutil import check_changed @@ -26,6 +26,8 @@ def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-a", dest="all", action="store_true") parser.add_option("-s", dest="show", action="store_true") + parser.add_option("-M", "--no-mirror", action="callback", + callback=disable_mirror) opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" diff --git a/RepSys/commands/ci.py b/RepSys/commands/ci.py old mode 100644 new mode 100755 diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py old mode 100644 new mode 100755 index 5349049..81e4140 --- a/RepSys/commands/co.py +++ b/RepSys/commands/co.py @@ -1,5 +1,5 @@ #!/usr/bin/python -from RepSys import Error +from RepSys import Error, disable_mirror from RepSys.command import * from RepSys.rpmutil import checkout import getopt @@ -19,7 +19,11 @@ Options: -d The distribution branch to checkout from -b The package branch -r REV Revision to checkout + -S Do not download sources from the binaries repository + -L Do not make symlinks of the binaries downloaded in SOURCES/ + -s Only checkout the SPECS/ directory -M Do not use the mirror (use the main repository) + --check Check integrity of files fetched from the binary repository -h Show this message Examples: @@ -33,8 +37,18 @@ Examples: def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-r", dest="revision") + parser.add_option("-S", dest="use_binrepo", default=True, + action="store_false") + parser.add_option("--check", dest="binrepo_check", default=False, + action="store_true") + parser.add_option("-L", dest="binrepo_link", default=True, + action="store_false") parser.add_option("--distribution", "-d", dest="distro", default=None) parser.add_option("--branch", "-b", dest="branch", default=None) + parser.add_option("-s", "--spec", dest="spec", default=False, + action="store_true") + parser.add_option("-M", "--no-mirror", action="callback", + callback=disable_mirror) opts, args = parser.parse_args() if len(args) not in (1, 2): raise Error, "invalid arguments" diff --git a/RepSys/commands/create.py b/RepSys/commands/create.py old mode 100644 new mode 100755 diff --git a/RepSys/commands/del.py b/RepSys/commands/del.py new file mode 100755 index 0000000..2c6902e --- /dev/null +++ b/RepSys/commands/del.py @@ -0,0 +1,30 @@ +from RepSys import Error +from RepSys.command import * +from RepSys.rpmutil import binrepo_delete + +HELP = """\ +Usage: repsys del [OPTIONS] [PATH] + +Remove a given file from the binary sources repository. + +Changes in the sources file will be left uncommited. + +Options: + -c automatically commit the 'sources' file + -h help + +""" + +def parse_options(): + parser = OptionParser(help=HELP) + parser.add_option("-c", dest="commit", default=False, + action="store_true") + opts, args = parser.parse_args() + if len(args): + opts.paths = args + else: + raise Error, "you need to provide a path" + return opts + +def main(): + do_command(parse_options, binrepo_delete) diff --git a/RepSys/commands/editlog.py b/RepSys/commands/editlog.py old mode 100644 new mode 100755 diff --git a/RepSys/commands/getspec.py b/RepSys/commands/getspec.py old mode 100644 new mode 100755 index 6a8f7ea..a357ef9 --- a/RepSys/commands/getspec.py +++ b/RepSys/commands/getspec.py @@ -1,5 +1,5 @@ #!/usr/bin/python -from RepSys import Error +from RepSys import Error, disable_mirror from RepSys.command import * from RepSys.layout import package_url from RepSys.rpmutil import get_spec @@ -24,6 +24,8 @@ Examples: def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-t", dest="targetdir", default=".") + parser.add_option("-M", "--no-mirror", action="callback", + callback=disable_mirror) opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py old mode 100644 new mode 100755 index 8cbe1f1..1767bb7 --- a/RepSys/commands/getsrpm.py +++ b/RepSys/commands/getsrpm.py @@ -3,7 +3,7 @@ # This program will extract given version/revision of the named package # from the Conectiva Linux repository system. # -from RepSys import Error, config +from RepSys import Error, config, disable_mirror from RepSys.command import * from RepSys.layout import package_url from RepSys.rpmutil import get_srpm @@ -32,6 +32,8 @@ Options: -T FILE Template to be used to generate the %changelog -M Do not use the mirror (use the main repository) -h Show this message + -S Do not download sources from the binary repository + --check Check integrity of files fetched from the binary repository --strict Check if the given revision contains changes in REPPKGURL Examples: @@ -76,6 +78,12 @@ 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("-S", dest="use_binrepo", default=True, + action="store_false") + parser.add_option("--check", dest="binrepo_check", default=False, + action="store_true") + parser.add_option("-M", "--no-mirror", action="callback", + callback=disable_mirror) parser.add_option("--strict", dest="strict", default=False, action="store_true") opts, args = parser.parse_args() diff --git a/RepSys/commands/log.py b/RepSys/commands/log.py new file mode 100755 index 0000000..28df27d --- /dev/null +++ b/RepSys/commands/log.py @@ -0,0 +1,62 @@ +#!/usr/bin/python +from RepSys import config, mirror, disable_mirror +from RepSys.command import * +from RepSys.layout import package_url, checkout_url +from RepSys.rpmutil import sync +from RepSys.util import execcmd +import sys +import os + +HELP = """\ +Usage: repsys log [OPTIONS] [PACKAGE] + +Shows the SVN log for a given package. + +Options: + -h Show this message + -v Show changed paths + -l LIMIT Limit of log entries to show + -r REV Show a specific revision + -M Do not use the mirror (use the main repository) + +Examples: + repsys log mutt + repsys log 2009.1/mutt +""" + +def parse_options(): + parser = OptionParser(help=HELP) + parser.add_option("-v", dest="verbose", action="store_true", + default=False) + parser.add_option("-l", "--limit", dest="limit", type="int", + default=None) + parser.add_option("-r", dest="revision", type="string", default=None) + parser.add_option("-M", "--no-mirror", action="callback", + callback=disable_mirror) + opts, args = parser.parse_args() + if len(args): + opts.pkgdirurl = package_url(args[0]) + else: + parser.error("log requires a package name") + return opts + +def svn_log(pkgdirurl, verbose=False, limit=None, revision=None): + mirror.info(pkgdirurl) + url = checkout_url(pkgdirurl) + svncmd = config.get("global", "svn-command", "svn") + args = [svncmd, "log", url] + if verbose: + args.append("-v") + if limit: + args.append("-l") + args.append(limit) + if revision: + args.append("-r") + args.append(revision) + if os.isatty(sys.stdin.fileno()): + args.append("| less") + rawcmd = " ".join(args) + execcmd(rawcmd, show=True) + +def main(): + do_command(parse_options, svn_log) diff --git a/RepSys/commands/markrelease.py b/RepSys/commands/markrelease.py old mode 100644 new mode 100755 diff --git a/RepSys/commands/patchspec.py b/RepSys/commands/patchspec.py old mode 100644 new mode 100755 diff --git a/RepSys/commands/putsrpm.py b/RepSys/commands/putsrpm.py old mode 100644 new mode 100755 index 751fa0b..efe1a15 --- a/RepSys/commands/putsrpm.py +++ b/RepSys/commands/putsrpm.py @@ -22,6 +22,7 @@ Options: -c URL The URL of the base directory where the changelog will be placed -s Don't strip the changelog from the spec + (nor import it into misc/) -n Don't try to rename the spec file -h Show this message diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py old mode 100644 new mode 100755 index 11fe36d..238b675 --- 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, layout +from RepSys import Error, layout, disable_mirror from RepSys.command import * from RepSys.svn import SVN from RepSys.log import get_changelog, split_spec_changelog @@ -43,6 +43,8 @@ def parse_options(): action="store_true") parser.add_option("-s", dest="sort", default=False, action="store_true") + parser.add_option("-M", "--no-mirror", action="callback", + callback=disable_mirror) opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py old mode 100644 new mode 100755 index 88ff596..2924329 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -1,5 +1,6 @@ #!/usr/bin/python -from RepSys import Error, config, layout +from RepSys import Error, config, layout, mirror +from RepSys.svn import SVN from RepSys.command import * from RepSys.rpmutil import get_spec, get_submit_info from RepSys.util import get_auth, execcmd, get_helper @@ -8,6 +9,7 @@ import getopt import sys import re import subprocess +import uuid import xmlrpclib @@ -37,6 +39,8 @@ Options: argument) -s The host in which the package URL will be submitted (defaults to the host in the URL) + -a Submit all URLs at once (depends on server-side support) + -i SID Use the submit identifier SID -h Show this message --distro The distribution branch where the packages come from --define Defines one variable to be used by the submit scripts @@ -63,6 +67,9 @@ 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("-i", dest="sid", type="string", nargs=1, + default=None) + parser.add_option("-a", dest="atonce", action="store_true", default=False) parser.add_option("--distro", dest="distro", type="string", default=None) parser.add_option("--define", action="append", default=[]) @@ -96,8 +103,33 @@ def parse_options(): if expanded != args: print "Submitting: %s" % " ".join(expanded) args = expanded - opts.urls = [layout.package_url(nameurl, distro=opts.distro, mirrored=False) + # generate URLs for package names: + opts.urls = [mirror.strip_username( + layout.package_url(nameurl, distro=opts.distro, mirrored=False)) for nameurl in args] + # find the revision if not specified: + newurls = [] + for url in opts.urls: + if not "@" in url: + print "Fetching revision..." + courl = layout.checkout_url(url) + log = SVN().log(courl, limit=1) + if not log: + raise Error, "can't find a revision for %s" % courl + ci = log[0] + print "URL:", url + print "Commit:", + print "%d | %s" % (ci.revision, ci.author), + if ci.lines: + line = " ".join(ci.lines).strip() + if len(line) > 57: + line = line[:57] + "..." + print "| %s" % line, + print + url = url + "@" + str(ci.revision) + newurls.append(url) + opts.urls[:] = newurls + # choose a target if not specified: 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 @@ -132,7 +164,7 @@ def list_targets(option, opt, val, parser): execcmd(command, show=True) sys.exit(0) -def submit(urls, target, define=[], submithost=None): +def submit(urls, target, define=[], submithost=None, atonce=False, sid=None): if submithost is None: submithost = config.get("submit", "host") if submithost is None: @@ -145,25 +177,33 @@ def submit(urls, target, define=[], submithost=None): # runs a create-srpm in the server through ssh, which will make a # copy of the rpm in the export directory createsrpm = get_helper("create-srpm") - args = ["ssh", submithost, createsrpm, "-t", target] - for entry in define: - args.append("--define") - args.append(entry) + baseargs = ["ssh", submithost, createsrpm, "-t", target] + if not sid: + sid = uuid.uuid4() + define.append("sid=%s" % sid) + for entry in reversed(define): + baseargs.append("--define") + baseargs.append(entry) + cmdsargs = [] 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: - print "Package submitted!" + baseargs.append("-r") + baseargs.append(str(rev)) + baseargs.append(url) + cmdsargs.append(baseargs) + elif atonce: + cmdsargs.append(baseargs + urls) else: - sys.stderr.write(output) - sys.exit(status) + cmdsargs.extend((baseargs + [url]) for url in urls) + for cmdargs in cmdsargs: + command = subprocess.list2cmdline(cmdargs) + status, output = execcmd(command) + if status == 0: + print "Package submitted!" + else: + sys.stderr.write(output) + sys.exit(status) def main(): do_command(parse_options, submit) diff --git a/RepSys/commands/switch.py b/RepSys/commands/switch.py old mode 100644 new mode 100755 index 5cbe2d7..998ae2c --- a/RepSys/commands/switch.py +++ b/RepSys/commands/switch.py @@ -7,8 +7,8 @@ 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 +If URL is not provided, it will use the option repository 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. @@ -19,7 +19,7 @@ Options: Examples: repsys switch - repsys switch https://mirrors.localnetwork/svn/packages/cooker + repsys switch https://mirrors.localnetwork/svn/packages/ """ def parse_options(): diff --git a/RepSys/commands/sync.py b/RepSys/commands/sync.py old mode 100644 new mode 100755 index a51db22..b4bdaba --- a/RepSys/commands/sync.py +++ b/RepSys/commands/sync.py @@ -5,12 +5,13 @@ 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. +Will add or remove from the working copy those files added or removed +in the spec file. -"No changes are commited." +It will not commit the changes. Options: + -c Commit the changes, as in ci --dry-run Print results without changing the working copy --download -d Try to download the source files not found @@ -24,6 +25,8 @@ def parse_options(): parser = OptionParser(help=HELP) parser.add_option("--dry-run", dest="dryrun", default=False, action="store_true") + parser.add_option("-c", dest="ci", default=False, + action="store_true") parser.add_option("-d", "--download", dest="download", default=False, action="store_true") opts, args = parser.parse_args() diff --git a/RepSys/commands/up.py b/RepSys/commands/up.py new file mode 100755 index 0000000..02a1a9f --- /dev/null +++ b/RepSys/commands/up.py @@ -0,0 +1,22 @@ +from RepSys import Error +from RepSys.command import * +from RepSys.rpmutil import update + +HELP = """\ +Usage: repsys up [PATH] + +Update the package working copy and synchronize all binaries. + +Options: + -h help +""" + +def parse_options(): + parser = OptionParser(help=HELP) + opts, args = parser.parse_args() + if args: + opts.target = args[0] + return opts + +def main(): + do_command(parse_options, update) diff --git a/RepSys/commands/upload.py b/RepSys/commands/upload.py new file mode 100755 index 0000000..6af50ea --- /dev/null +++ b/RepSys/commands/upload.py @@ -0,0 +1,28 @@ +from RepSys import Error +from RepSys.command import * +from RepSys.rpmutil import upload + +HELP = """\ +Usage: repsys upload [OPTIONS] [PATH] + +Upload a given file to the binary sources repository. + +It will also update the contents of the 'binrepo.lst' file and leave it +uncommited. + +If the path is a directory, all the contents of the directory will be +uploaded or removed. + +Options: + -h help + +""" + +def parse_options(): + parser = OptionParser(help=HELP) + opts, args = parser.parse_args() + opts.paths = args + return opts + +def main(): + do_command(parse_options, upload) -- cgit v1.2.1