aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/commands
diff options
context:
space:
mode:
Diffstat (limited to 'RepSys/commands')
-rw-r--r--RepSys/commands/authoremail.py3
-rw-r--r--RepSys/commands/changed.py6
-rw-r--r--RepSys/commands/ci.py12
-rw-r--r--RepSys/commands/co.py20
-rw-r--r--RepSys/commands/create.py8
-rw-r--r--RepSys/commands/editlog.py6
-rw-r--r--RepSys/commands/getspec.py9
-rw-r--r--RepSys/commands/getsrpm.py33
-rw-r--r--RepSys/commands/markrelease.py8
-rw-r--r--RepSys/commands/patchspec.py5
-rw-r--r--RepSys/commands/putsrpm.py66
-rw-r--r--RepSys/commands/rpmlog.py36
-rw-r--r--RepSys/commands/submit.py148
-rw-r--r--RepSys/commands/switch.py7
-rw-r--r--RepSys/commands/sync.py4
15 files changed, 256 insertions, 115 deletions
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..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
@@ -8,9 +9,12 @@ 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
+ -M Do not use the mirror (use the main repository)
-h Show this message
Examples:
@@ -25,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/ci.py b/RepSys/commands/ci.py
index 9ffa3bd..8d373b5 100644
--- a/RepSys/commands/ci.py
+++ b/RepSys/commands/ci.py
@@ -5,12 +5,16 @@ 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
+ -m MSG Use the MSG as the log message
+ -F FILE Read log message from FILE
Examples:
repsys ci
@@ -20,6 +24,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]
diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py
index cadcf56..5349049 100644
--- a/RepSys/commands/co.py
+++ b/RepSys/commands/co.py
@@ -8,12 +8,24 @@ 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.
+
+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
"""
@@ -21,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 56af1ef..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
@@ -8,11 +9,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():
@@ -20,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 367238f..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,14 +25,13 @@ 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
def editlog(pkgdirurl, revision):
svn = SVN()
- svn.propedit("svn:log", pkgdirurl, revision=SVN.makerev(revision),
- revprop=True)
+ svn.propedit("svn:log", pkgdirurl, rev=revision)
def main():
do_command(parse_options, editlog)
diff --git a/RepSys/commands/getspec.py b/RepSys/commands/getspec.py
index 1079a81..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
@@ -8,12 +9,16 @@ 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 ".")
+ -M Do not use the mirror (use the main repository)
-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():
@@ -22,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 d76aca7..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
@@ -16,20 +17,26 @@ 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
- -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
+ -M Do not use the mirror (use the main repository)
+ -h Show this message
+ --strict Check if the given revision contains changes in REPPKGURL
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
@@ -69,11 +76,13 @@ 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:
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 440775b..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
@@ -21,6 +22,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
@@ -55,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 155ff4f..9a4881b 100644
--- a/RepSys/commands/patchspec.py
+++ b/RepSys/commands/patchspec.py
@@ -5,12 +5,15 @@
from RepSys import Error
from RepSys.rpmutil import patch_spec
from RepSys.command import *
+from RepSys.layout import package_url
import getopt
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
@@ -25,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..5256cba 100644
--- a/RepSys/commands/putsrpm.py
+++ b/RepSys/commands/putsrpm.py
@@ -1,60 +1,54 @@
#!/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
from RepSys.rpmutil import put_srpm
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 = default_parent(args[0])
- 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)
diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py
index 7ea1ac0..11fe36d 100644
--- a/RepSys/commands/rpmlog.py
+++ b/RepSys/commands/rpmlog.py
@@ -3,23 +3,33 @@
# 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, layout
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 = """\
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
-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
+ -M Do not use the mirror (use the main repository)
-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():
@@ -27,14 +37,28 @@ 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])
+ opts.pkgdirurl = layout.package_url(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()
+ 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,
+ size=size, sort=sort, template=template, oldlog=oldlog)
+ sys.stdout.writelines(newlog)
def main():
do_command(parse_options, rpmlog)
diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py
index 5c95526..88ff596 100644
--- a/RepSys/commands/submit.py
+++ b/RepSys/commands/submit.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-from RepSys import Error, config
+from RepSys import Error, config, layout
from RepSys.command import *
from RepSys.rpmutil import get_spec, get_submit_info
from RepSys.util import get_auth, execcmd, get_helper
@@ -7,19 +7,29 @@ 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.
+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
+
+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
@@ -28,53 +38,101 @@ 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
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 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 2008.1/my-packages@11011
+ repsys submit --define section=main/testing -t 2008.1
"""
+DEFAULT_TARGET = "Cooker"
+
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.defaults["revision"] = None
+ 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,
default=None)
- parser.add_option("--define", action="append")
+ 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:
- 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)
+ name, url, rev = get_submit_info(".")
+ args = ["%s@%s" % (url, str(rev))]
+ print "Submitting %s at revision %s" % (name, rev)
+ 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:
- print "Cancelled."
- sys.exit(1)
- elif len(args) > 2:
- raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ 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 <name> <rev> syntax
+ try:
+ rev = int(args[1])
+ except ValueError:
+ # ok, it is a package name, let it pass
+ pass
+ else:
+ raise Error, "the format <name> <revision> is deprecated, "\
+ "use <name>@<revision> instead"
+ # 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, distro=opts.distro, mirrored=False)
+ for nameurl in args]
+ 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
+ del opts.distro
return opts
-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 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, 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):
+ 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(urls, target, define=[], submithost=None):
if submithost is None:
submithost = config.get("submit", "host")
if submithost is None:
@@ -86,13 +144,20 @@ 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)
+ 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!"
@@ -100,7 +165,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)
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.
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]