aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/commands
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2007-06-04 15:03:57 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2007-06-04 15:03:57 +0000
commitb2ce8ef1c40f7c58f4bb4629b5b5e95ce8c252d2 (patch)
tree0d16405bf439725375a68146a342fa0f44f4b5fa /RepSys/commands
parentf23797f8de1cdc3bb555fb4267ce9eec4c6f3968 (diff)
downloadmgarepo-b2ce8ef1c40f7c58f4bb4629b5b5e95ce8c252d2.tar
mgarepo-b2ce8ef1c40f7c58f4bb4629b5b5e95ce8c252d2.tar.gz
mgarepo-b2ce8ef1c40f7c58f4bb4629b5b5e95ce8c252d2.tar.bz2
mgarepo-b2ce8ef1c40f7c58f4bb4629b5b5e95ce8c252d2.tar.xz
mgarepo-b2ce8ef1c40f7c58f4bb4629b5b5e95ce8c252d2.zip
Frontported changes from V1_6_X since april
Diffstat (limited to 'RepSys/commands')
-rw-r--r--RepSys/commands/changed.py2
-rw-r--r--RepSys/commands/ci.py29
-rw-r--r--RepSys/commands/co.py2
-rw-r--r--RepSys/commands/editlog.py3
-rw-r--r--RepSys/commands/markrelease.py2
-rw-r--r--RepSys/commands/submit.py85
-rw-r--r--RepSys/commands/sync.py31
7 files changed, 98 insertions, 56 deletions
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
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)
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:
diff --git a/RepSys/commands/editlog.py b/RepSys/commands/editlog.py
index a98b761..367238f 100644
--- a/RepSys/commands/editlog.py
+++ b/RepSys/commands/editlog.py
@@ -30,7 +30,8 @@ def parse_options():
def editlog(pkgdirurl, revision):
svn = SVN()
- svn.propedit("svn:log", pkgdirurl, revision=revision, revprop=True)
+ svn.propedit("svn:log", pkgdirurl, revision=SVN.makerev(revision),
+ revprop=True)
def main():
do_command(parse_options, editlog)
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/submit.py b/RepSys/commands/submit.py
index 6e9eb0f..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,9 @@ 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:
name, rev = get_submit_info(".")
@@ -63,61 +72,33 @@ 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=[], 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)
- status, output = execcmd(command)
- if status == 0:
- print "Package submitted!"
- else:
- sys.exit(status)
+ sys.stderr.write(output)
+ sys.exit(status)
def main():
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)