pld-builder.new: PLD_Builder/srpm_builder.py rather exit early if spec empty

glen glen at pld-linux.org
Thu Oct 13 03:17:45 CEST 2011


Author: glen                         Date: Thu Oct 13 01:17:45 2011 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
rather exit early if spec empty

---- Files affected:
pld-builder.new/PLD_Builder:
   srpm_builder.py (1.80 -> 1.81) 

---- Diffs:

================================================================
Index: pld-builder.new/PLD_Builder/srpm_builder.py
diff -u pld-builder.new/PLD_Builder/srpm_builder.py:1.80 pld-builder.new/PLD_Builder/srpm_builder.py:1.81
--- pld-builder.new/PLD_Builder/srpm_builder.py:1.80	Thu Oct 13 03:10:47 2011
+++ pld-builder.new/PLD_Builder/srpm_builder.py	Thu Oct 13 03:17:40 2011
@@ -90,7 +90,13 @@
         ftp.add(fname, "uploadinfo")
 
 def build_srpm(r, b):
+    if len(b.spec) == 0:
+        # should not really get here
+        util.append_to(b.logfile, "error: No .spec given but build src.rpm wanted")
+        return "FAIL"
+
     status.push("building %s" % b.spec)
+
     b.src_rpm = ""
     builder_opts = "-nu -nm --nodeps --http"
     if ("test-build" in r.flags) or b.branch and b.branch.startswith(config.tag_prefixes[0]):
@@ -126,17 +132,12 @@
         transfer_file(r, b)
 
     packagename = b.spec[:-5]
-    if len(packagename) == 0:
-        util.append_to(b.logfile, "error: No package name specified")
-        res = "FAIL_MISSING_PACKAGE"
-
-    if res == 0:
-        packagedir = "rpm/packages/%s" % packagename
-        chroot.run("rpmbuild --nodeps --nobuild --define '_topdir %%(echo $HOME/rpm)' --define '_specdir %%{_topdir}/%%{name}' --define '_sourcedir %%{_specdir}' " \
-                "--clean --rmspec --rmsource %s/%s" % \
-                (packagedir, b.spec), logfile = b.logfile)
-        chroot.run("rm -rf %s" % packagedir, logfile = b.logfile)
-        status.pop()
+    packagedir = "rpm/packages/%s" % packagename
+    chroot.run("rpmbuild --nodeps --nobuild --define '_topdir %%(echo $HOME/rpm)' --define '_specdir %%{_topdir}/%%{name}' --define '_sourcedir %%{_specdir}' " \
+            "--clean --rmspec --rmsource %s/%s" % \
+            (packagedir, b.spec), logfile = b.logfile)
+    chroot.run("rm -rf %s" % packagedir, logfile = b.logfile)
+    status.pop()
 
     if res:
         res = "FAIL"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/srpm_builder.py?r1=1.80&r2=1.81&f=u



More information about the pld-cvs-commit mailing list