From f372e877cb32a6c009e29ff9ddf1a14f8b2fd216 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 5 Nov 2016 15:38:08 +0100 Subject: Revert to 1.12.3 state --- MgaRepo/commands/authoremail.py | 1 + MgaRepo/commands/buildrpm.py | 43 ------------------------------- MgaRepo/commands/changed.py | 1 + MgaRepo/commands/ci.py | 1 + MgaRepo/commands/clone.py | 53 -------------------------------------- MgaRepo/commands/co.py | 1 + MgaRepo/commands/create.py | 1 + MgaRepo/commands/editlog.py | 1 + MgaRepo/commands/getspec.py | 1 + MgaRepo/commands/getsrpm.py | 4 +-- MgaRepo/commands/github.py | 56 ----------------------------------------- MgaRepo/commands/log.py | 13 +++------- MgaRepo/commands/maintdb.py | 4 ++- MgaRepo/commands/markrelease.py | 1 + MgaRepo/commands/obsolete.py | 1 + MgaRepo/commands/patchspec.py | 1 + MgaRepo/commands/putsrpm.py | 1 + MgaRepo/commands/rpmlog.py | 11 +++----- MgaRepo/commands/submit.py | 11 ++++---- MgaRepo/commands/switch.py | 1 + MgaRepo/commands/sync.py | 1 + 21 files changed, 30 insertions(+), 178 deletions(-) delete mode 100644 MgaRepo/commands/buildrpm.py delete mode 100644 MgaRepo/commands/clone.py delete mode 100644 MgaRepo/commands/github.py (limited to 'MgaRepo/commands') diff --git a/MgaRepo/commands/authoremail.py b/MgaRepo/commands/authoremail.py index 27ffaf5..fcb8a86 100644 --- a/MgaRepo/commands/authoremail.py +++ b/MgaRepo/commands/authoremail.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error, config from MgaRepo.command import * import sys diff --git a/MgaRepo/commands/buildrpm.py b/MgaRepo/commands/buildrpm.py deleted file mode 100644 index a9230e4..0000000 --- a/MgaRepo/commands/buildrpm.py +++ /dev/null @@ -1,43 +0,0 @@ -from MgaRepo.command import do_command -from MgaRepo.rpmutil import build_rpm -from optparse import * - -HELP = """\ -Usage: mgarepo buildrpm [OPTIONS] - -Builds the binary RPM(s) (.rpm) file(s) of a given package. - -Options: - -bX Build stage option, where X is stage, default is -bb - -I Don't automatically try install missing build dependencies - -L Disable rpmlint check of packages built - -P USER Define the RPM packager information to USER - -d Use DNF - -q Quiet build output - -s Jump to specific build stage (--short-circuit) - -l Use subversion log to build rpm %changelog - -F Do not use full name & email for packagers in %changelog - -- Options and arguments following will be passed to rpmbuild - -""" - -def parse_options(): - parser = OptionParser(HELP) - parser.add_option("-b", dest="build_cmd", default="a") - parser.add_option("-I", dest="installdeps", action="store_false", default=True) - parser.add_option("-L", dest="rpmlint", action="store_false", default=True) - parser.add_option("-P", dest="packager", default="") - parser.add_option("-d", "--dnf", dest="use_dnf", action="store_true", default=False) - parser.add_option("-q", "--quiet", dest="verbose", action="store_false", default=True) - parser.add_option("-s", "--short-circuit", dest="short_circuit", action="store_true", default=False) - parser.add_option("-l", dest="svnlog", action="store_true", default=False) - parser.add_option("-F", dest="fullnames", default=True, - action="store_false") - opts, args = parser.parse_args() - opts.rpmargs = parser.rargs - return opts - -def main(): - do_command(parse_options, build_rpm) - -# vim:et:ts=4:sw=4 diff --git a/MgaRepo/commands/changed.py b/MgaRepo/commands/changed.py index 493e9af..4ac16bc 100644 --- a/MgaRepo/commands/changed.py +++ b/MgaRepo/commands/changed.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error, disable_mirror from MgaRepo.command import * from MgaRepo.layout import package_url diff --git a/MgaRepo/commands/ci.py b/MgaRepo/commands/ci.py index 24e7923..e64ac4e 100644 --- a/MgaRepo/commands/ci.py +++ b/MgaRepo/commands/ci.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo.command import * from MgaRepo.rpmutil import commit diff --git a/MgaRepo/commands/clone.py b/MgaRepo/commands/clone.py deleted file mode 100644 index 88279db..0000000 --- a/MgaRepo/commands/clone.py +++ /dev/null @@ -1,53 +0,0 @@ -from MgaRepo import Error -from MgaRepo.command import * -from MgaRepo.rpmutil import clone -import getopt -import sys - -HELP = """\ -Usage: mgarepo co [OPTIONS] URL [LOCALPATH] - -Clone the package source from the Mageia 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 - -M Do not use the mirror (use the main repository) - -h Show this message - -F Do not convert svn usernames to full name & email - -Examples: - mgarepo co pkgname - mgarepo co -d 1 pkgname - mgarepo co 1/pkgame - mgarepo co http://repos/svn/cnc/snapshot/foo - mgarepo co http://repos/svn/cnc/snapshot/foo foo-pkg -""" - -def parse_options(): - parser = OptionParser(help=HELP) - parser.add_option("--distribution", "-d", dest="distro", default=None) - parser.add_option("--branch", "-b", dest="branch", default=None) - parser.add_option("-F", dest="fullnames", default=True, - action="store_false") - 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] - else: - opts.path = None - return opts - -def main(): - do_command(parse_options, clone) - -# vim:et:ts=4:sw=4 diff --git a/MgaRepo/commands/co.py b/MgaRepo/commands/co.py index b257f21..a6911cc 100644 --- a/MgaRepo/commands/co.py +++ b/MgaRepo/commands/co.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error, disable_mirror from MgaRepo.command import * from MgaRepo.rpmutil import checkout diff --git a/MgaRepo/commands/create.py b/MgaRepo/commands/create.py index a947fed..e9a89e8 100644 --- a/MgaRepo/commands/create.py +++ b/MgaRepo/commands/create.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error from MgaRepo.command import * from MgaRepo.layout import package_url diff --git a/MgaRepo/commands/editlog.py b/MgaRepo/commands/editlog.py index 9e82a38..163651d 100644 --- a/MgaRepo/commands/editlog.py +++ b/MgaRepo/commands/editlog.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error from MgaRepo.command import * from MgaRepo.layout import package_url diff --git a/MgaRepo/commands/getspec.py b/MgaRepo/commands/getspec.py index 884e919..e1ba4c4 100644 --- a/MgaRepo/commands/getspec.py +++ b/MgaRepo/commands/getspec.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error, disable_mirror from MgaRepo.command import * from MgaRepo.layout import package_url diff --git a/MgaRepo/commands/getsrpm.py b/MgaRepo/commands/getsrpm.py index caadfeb..82bd626 100644 --- a/MgaRepo/commands/getsrpm.py +++ b/MgaRepo/commands/getsrpm.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # # This program will extract given version/revision of the named package # from the Conectiva Linux repository system. @@ -29,7 +30,6 @@ 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 - -F Do not use full name & email for packagers in %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 @@ -76,8 +76,6 @@ 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("-F", dest="fullnames", default=True, - action="store_false") parser.add_option("-M", "--no-mirror", action="callback", callback=disable_mirror) parser.add_option("--strict", dest="strict", default=False, diff --git a/MgaRepo/commands/github.py b/MgaRepo/commands/github.py deleted file mode 100644 index 7d787e4..0000000 --- a/MgaRepo/commands/github.py +++ /dev/null @@ -1,56 +0,0 @@ -from MgaRepo import Error -from MgaRepo.command import * -from MgaRepo.GitHub import GitHub -import getopt -import sys - -HELP = """\ -Usage: mgarepo github [OPTIONS] URL - -Import a git-svn cloned repository to github - -Options: - -h Show this message - -Examples: - mgarepo github import existingpkg - mgarepo github import svn://svn.mageia.org/svn/packages/cauldron/existingpkg -""" -def github_clone(pkg, **kwargs): - github = GitHub() - github.clone_repository(pkg) - -def github_import(target=".", **kwargs): - github = GitHub() - github.import_package(target) - -def github_delete(pkg, **kwargs): - github = GitHub() - github.delete_repository(pkg) - -def parse_options(): - parser = OptionParser(help=HELP) - opts, args = parser.parse_args() - if len(args) < 1: - raise Error("invalid arguments") - opts.func = globals().get("github_"+args[0], None) - if args[0] == "import": - if len(args) > 1: - opts.target = args[1] - elif args[0] == "delete" or args[0] == "clone": - opts.pkg = args[1] - else: - raise Error("invalid arguments: %s" % str(args)) - return opts - -def dispatch_cmd(*args, **kwargs): - func = kwargs.pop("func", None) - if func: - func(**kwargs) - else: - raise Error("invalid command: %s %s" % (sys.argv[0], sys.argv[1])) - -def main(): - do_command(parse_options, dispatch_cmd) - -# vim:et:ts=4:sw=4 diff --git a/MgaRepo/commands/log.py b/MgaRepo/commands/log.py index 6d742de..2181125 100644 --- a/MgaRepo/commands/log.py +++ b/MgaRepo/commands/log.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import config, mirror, disable_mirror from MgaRepo.command import * from MgaRepo.layout import package_url, checkout_url @@ -5,8 +6,6 @@ from MgaRepo.rpmutil import sync from MgaRepo.util import execcmd import sys import os -import subprocess -import shlex HELP = """\ Usage: mgarepo log [OPTIONS] [PACKAGE] @@ -58,13 +57,9 @@ def svn_log(pkgdirurl, verbose=False, limit=None, revision=None, releases=None): args.append("-r") args.append(revision) if os.isatty(sys.stdin.fileno()): - pager = shlex.split(os.environ.get("PAGER", "less")) - p = subprocess.Popen(args, stdout=subprocess.PIPE) - p2 = subprocess.Popen(pager, stdin=p.stdout) - p2.wait() - p.wait() - else: - execcmd(args, show=True) + args.append("| less") + rawcmd = " ".join(args) + execcmd(rawcmd, show=True) def main(): do_command(parse_options, svn_log) diff --git a/MgaRepo/commands/maintdb.py b/MgaRepo/commands/maintdb.py index 0bd4d56..9a97be8 100644 --- a/MgaRepo/commands/maintdb.py +++ b/MgaRepo/commands/maintdb.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error, config from MgaRepo.command import * from MgaRepo.util import execcmd, get_helper @@ -32,7 +33,8 @@ def parse_options(): def maintdb(maintdb_args): host = config.get("maintdb", "host", "maintdb.mageia.org") maintdb_helper = get_helper("maintdb") - command = ["ssh", host, maintdb_helper] + maintdb_args + cmd_args = ' '.join(maintdb_args) + command = "ssh %s %s %s" % (host, maintdb_helper, cmd_args) execcmd(command, show=True) sys.exit(0) diff --git a/MgaRepo/commands/markrelease.py b/MgaRepo/commands/markrelease.py index 6fb5bbf..534d87f 100644 --- a/MgaRepo/commands/markrelease.py +++ b/MgaRepo/commands/markrelease.py @@ -1,3 +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 diff --git a/MgaRepo/commands/obsolete.py b/MgaRepo/commands/obsolete.py index 9477721..04d8240 100644 --- a/MgaRepo/commands/obsolete.py +++ b/MgaRepo/commands/obsolete.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # # This program will try to patch a spec file from a given package url. # diff --git a/MgaRepo/commands/patchspec.py b/MgaRepo/commands/patchspec.py index 2fd8da4..dfe54dc 100644 --- a/MgaRepo/commands/patchspec.py +++ b/MgaRepo/commands/patchspec.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # # This program will try to patch a spec file from a given package url. # diff --git a/MgaRepo/commands/putsrpm.py b/MgaRepo/commands/putsrpm.py index aa4043c..242423b 100644 --- a/MgaRepo/commands/putsrpm.py +++ b/MgaRepo/commands/putsrpm.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error from MgaRepo.command import * from MgaRepo.layout import package_url diff --git a/MgaRepo/commands/rpmlog.py b/MgaRepo/commands/rpmlog.py index 693fe8b..88dfc4b 100644 --- a/MgaRepo/commands/rpmlog.py +++ b/MgaRepo/commands/rpmlog.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # # This program will convert the output of "svn log" to be suitable # for usage in an rpm %changelog session. @@ -24,7 +25,6 @@ Options: -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) - -F Do not use full name & email for packagers where available -h Show this message Examples: @@ -45,15 +45,13 @@ def parse_options(): action="store_true") parser.add_option("-M", "--no-mirror", action="callback", callback=disable_mirror) - parser.add_option("-F", dest="fullnames", default=True, - action="store_false") opts, args = parser.parse_args() if len(args) != 1: raise Error("invalid arguments") opts.pkgdirurl = layout.package_url(args[0]) return opts -def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort, fullnames): +def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort): another = None if usespec: svn = SVN() @@ -61,10 +59,7 @@ def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort, fullnames 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, fullnames=fullnames) - # make sure stdout support unicode, otherwise it'll croak when encountered - if not "UTF-8" in sys.stdout.encoding: - sys.stdout = open(sys.stdout.fileno(), mode="w", encoding="UTF-8") + size=size, sort=sort, template=template, oldlog=oldlog) sys.stdout.writelines(newlog) def main(): diff --git a/MgaRepo/commands/submit.py b/MgaRepo/commands/submit.py index 665b98a..9f05dca 100644 --- a/MgaRepo/commands/submit.py +++ b/MgaRepo/commands/submit.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo import Error, config, layout, mirror from MgaRepo.svn import SVN from MgaRepo.command import * @@ -159,10 +160,9 @@ def list_targets(option, opt, val, parser): raise Error("no submit host defined in mgarepo.conf") createsrpm = get_helper("create-srpm") #TODO make it configurable - args = ["ssh", host, createsrpm, "--list"] - execcmd(args, show=true) - sys.exit(0) # it is invoked via optparse callback, thus we need to - # force ending the script + command = "ssh %s %s --list" % (host, createsrpm) + execcmd(command, show=True) + sys.exit(0) def submit(urls, target, define=[], submithost=None, atonce=False, sid=None): if submithost is None: @@ -197,7 +197,8 @@ def submit(urls, target, define=[], submithost=None, atonce=False, sid=None): else: cmdsargs.extend((baseargs + [url]) for url in urls) for cmdargs in cmdsargs: - status, output = execcmd(cmdargs) + command = subprocess.list2cmdline(cmdargs) + status, output = execcmd(command) if status == 0: print("Package submitted!") else: diff --git a/MgaRepo/commands/switch.py b/MgaRepo/commands/switch.py index 8a33969..ccca76e 100644 --- a/MgaRepo/commands/switch.py +++ b/MgaRepo/commands/switch.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo.command import * from MgaRepo.rpmutil import switch diff --git a/MgaRepo/commands/sync.py b/MgaRepo/commands/sync.py index a56a36e..54f5635 100644 --- a/MgaRepo/commands/sync.py +++ b/MgaRepo/commands/sync.py @@ -1,3 +1,4 @@ +#!/usr/bin/python from MgaRepo.command import * from MgaRepo.rpmutil import sync -- cgit v1.2.1