aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2005-12-07 10:17:47 +0000
committerFrederic Lepied <flepied@mandriva.com>2005-12-07 10:17:47 +0000
commiteebb71581256161108f46f313bc17068274a8546 (patch)
tree62e84944e109b68ae5bd88957b9d680cdcd44ecb
parentb78f49330af66b0698b8f901477d3a4587d3ed5e (diff)
downloadmgarepo-eebb71581256161108f46f313bc17068274a8546.tar
mgarepo-eebb71581256161108f46f313bc17068274a8546.tar.gz
mgarepo-eebb71581256161108f46f313bc17068274a8546.tar.bz2
mgarepo-eebb71581256161108f46f313bc17068274a8546.tar.xz
mgarepo-eebb71581256161108f46f313bc17068274a8546.zip
added support for svn+ssh access method.
-rw-r--r--RepSys/commands/submit.py69
1 files changed, 39 insertions, 30 deletions
diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py
index ff442c1..1c3bf8b 100644
--- a/RepSys/commands/submit.py
+++ b/RepSys/commands/submit.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
from RepSys import Error, config
from RepSys.command import *
+from RepSys.util import execcmd
from RepSys.rpmutil import get_spec, get_submit_info
from RepSys.util import get_auth
import urllib
@@ -33,7 +34,7 @@ Examples:
def parse_options():
parser = OptionParser(help=HELP)
parser.defaults["revision"] = ""
- parser.add_option("-t", dest="target", default="Snapshot")
+ parser.add_option("-t", dest="target", default="Cooker")
parser.add_option("-l", dest="list", action="store_true")
opts, args = parser.parse_args()
if not args:
@@ -63,41 +64,49 @@ def submit(pkgdirurl, revision, target, list=0):
host, path = urllib.splithost(rest)
user, host = urllib.splituser(host)
host, port = urllib.splitport(host)
- if type != "https":
- raise Error, "you must use https:// urls"
+ 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"
- 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])
+
+ 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:
- iface.submit_package(pkgdirurl, revision, target)
+ 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)
+ else:
+ status, output = execcmd("ssh %s /usr/share/repsys/create-srpm '%s' %s %s" % (host, pkgdirurl, revision, target))
+ if status == 0:
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)
-
+ else:
+ sys.exit(status)
+
def main():
do_command(parse_options, submit)