aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES6
-rw-r--r--Makefile1
-rw-r--r--RepSys/commands/submit.py6
-rw-r--r--RepSys/rpmutil.py4
-rwxr-xr-xcreate-srpm22
-rw-r--r--repsys.spec11
6 files changed, 41 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index aa9e004..b7df556 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+* 1.6.2b
+- make submit pass --define options to create-srpm script
+- print error message when create-srpm fails
+- make get_srpm return the srpms list
+- add upload-srpm support in create-srpm
+
* 1.6.2a
- moved revision-offset to [log] section and added a comment
diff --git a/Makefile b/Makefile
index 46ddead..1131888 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ RELEASE:=$(shell rpm -q --qf %{RELEASE} --specfile $(PACKAGE).spec)
TAG := $(shell echo "V$(VERSION)_$(RELEASE)" | tr -- '-.' '__')
FILES = ChangeLog Makefile MANIFEST.in PKG-INFO create-srpm getsrpm-mdk rebrand-mdk \
+ {default,revno}.chlog \
repsys repsys.conf repsys.spec setup.cfg setup.py RepSys/*.py RepSys/{cgi,commands}/*.py
# rules to build a test rpm
diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py
index 6e9eb0f..380391a 100644
--- a/RepSys/commands/submit.py
+++ b/RepSys/commands/submit.py
@@ -39,6 +39,7 @@ 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("--define", action="append")
opts, args = parser.parse_args()
if not args:
name, rev = get_submit_info(".")
@@ -63,7 +64,7 @@ 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=[]):
#if not NINZ:
# raise Error, "you must have NINZ installed to use this command"
type, rest = urllib.splittype(pkgdirurl)
@@ -113,10 +114,13 @@ def submit(pkgdirurl, revision, target, list=0):
createsrpm = get_helper("create-srpm")
command = "ssh %s %s '%s' -r %s -t %s" % (
host, 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:
+ sys.stderr.write(output)
sys.exit(status)
diff --git a/RepSys/rpmutil.py b/RepSys/rpmutil.py
index 83d0051..9c0018a 100644
--- a/RepSys/rpmutil.py
+++ b/RepSys/rpmutil.py
@@ -90,9 +90,13 @@ def get_srpm(pkgdirurl,
srpm = glob.glob(os.path.join(srpmsdir, "*.src.rpm"))[0]
if not targetdirs:
targetdirs = (".",)
+ targetsrpms = []
for targetdir in targetdirs:
+ targetsrpm = os.path.join(os.path.realpath(targetdir), os.path.basename(srpm))
+ targetsrpms.append(targetsrpm)
execcmd("cp -f", srpm, targetdir)
os.unlink(srpm)
+ return targetsrpms
finally:
if os.path.isdir(tmpdir):
shutil.rmtree(tmpdir)
diff --git a/create-srpm b/create-srpm
index 000afd2..ee98ccd 100755
--- a/create-srpm
+++ b/create-srpm
@@ -3,7 +3,7 @@
from RepSys import Error, config
from RepSys.rpmutil import get_srpm
from RepSys.cgiutil import get_targets
-from RepSys.util import mapurl
+from RepSys.util import mapurl, execcmd, get_helper
import sys
import os
import pwd
@@ -16,7 +16,7 @@ class CmdIface:
return config.get("users", author)
def submit_package(self, packageurl, packagerev, targetname,
- dontmapurl_=0):
+ dontmapurl_=0, define=[]):
pw = pwd.getpwuid(os.getuid())
username = pw[0]
packager = config.get("users", username) or pw[4]
@@ -46,13 +46,26 @@ class CmdIface:
newurl = packageurl
if not dontmapurl_:
newurl = mapurl(packageurl)
- get_srpm(newurl,
+ targetsrpms = get_srpm(newurl,
revision=packagerev,
targetdirs=target.target,
packager=packager,
revname=1,
svnlog=1,
scripts=target.scripts)
+
+ uploadsrpm = config.get("helper", "upload-srpm", None)
+ if uploadsrpm:
+ upload_command = [ uploadsrpm ]
+ if define:
+ for x in define:
+ upload_command.append("--define")
+ upload_command.append(x)
+ upload_command.append(targetname)
+ upload_command.append(targetsrpms[0])
+ status, output = execcmd(" ".join(upload_command))
+ if status != 0:
+ raise CmdError, "Failed to upload %s:\n%s" % (targetsrpms[0], output)
return 1
def submit_targets(self):
@@ -69,6 +82,7 @@ def parse_options():
parser.add_option("-M", "--nomapping", action="store_true",
dest="urlmap", default=False,
help="disable url mapping")
+ parser.add_option("--define", action="append")
opts, args = parser.parse_args()
if not args:
parser.error("you must supply a package url")
@@ -78,7 +92,7 @@ def parse_options():
def main():
iface = CmdIface()
opts, args = parse_options()
- iface.submit_package(args[0], opts.revision, opts.target, opts.urlmap)
+ iface.submit_package(args[0], opts.revision, opts.target, opts.urlmap, opts.define)
if __name__ == "__main__":
diff --git a/repsys.spec b/repsys.spec
index 6942f0b..e32d536 100644
--- a/repsys.spec
+++ b/repsys.spec
@@ -1,9 +1,9 @@
Name: repsys
-Version: 1.6.2a
-Release: 1mdk
+Version: 1.6.2b
+Release: %mkrel 1
Summary: Tools for Mandriva Linux repository access and management
Group: Development/Other
-Source: %{name}-%{repsys_version}.tar.bz2
+Source: %{name}-%{version}.tar.bz2
License: GPL
URL: http://qa.mandriva.com/twiki/bin/view/Main/RepositorySystem
Prefix: %{_prefix}
@@ -18,7 +18,7 @@ Requires: python-cheetah
Tools for Mandriva Linux repository access and management.
%prep
-%setup -q -n %{name}-%{repsys_version}
+%setup -q
%build
python setup.py build
@@ -44,6 +44,9 @@ rm -rf %{buildroot}
%{_bindir}/getsrpm-mdk
%{_datadir}/repsys/rebrand-mdk
%{_datadir}/repsys/create-srpm
+%{_datadir}/repsys/default.chlog
+%{_datadir}/repsys/revno.chlog
+%{py_sitedir}/RepSys
# MAKE THE CHANGES IN CVS: NO PATCH OR SOURCE ALLOWED