mock mock.py,1.43,1.44

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Fri May 12 20:56:32 UTC 2006


Author: skvidal

Update of /cvs/fedora/mock
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13379

Modified Files:
	mock.py 
Log Message:
commit michael brown's multiple srpms on the command line patch




Index: mock.py
===================================================================
RCS file: /cvs/fedora/mock/mock.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- mock.py	8 May 2006 16:39:53 -0000	1.43
+++ mock.py	12 May 2006 20:56:30 -0000	1.44
@@ -810,36 +810,46 @@
     else:
         if args[0] == 'rebuild':
             if len(args) > 1:
-                srpm = args[1]
+                srpms = args[1:]
             else:
                 error("No package specified to rebuild command.")
                 sys.exit(50)
         else:
-            srpm = args[0]
+            srpms = args[0:]
 
-        ts = rpmUtils.transaction.initReadOnlyTransaction()
-        try:
-            hdr = rpmUtils.miscutils.hdrFromPackage(ts, srpm)
-        except rpmUtils.RpmUtilsError, e:
-            error("Specified srpm %s cannot be found/opened" % srpm)
-            sys.exit(50)
-    
-        if hdr[rpm.RPMTAG_SOURCEPACKAGE] != 1:
-            error("Specified srpm isn't a srpm!  Can't go on")
-            sys.exit(50)
+        for srpm in srpms:
+            ts = rpmUtils.transaction.initReadOnlyTransaction()
+            try:
+                hdr = rpmUtils.miscutils.hdrFromPackage(ts, srpm)
+            except rpmUtils.RpmUtilsError, e:
+                error("Specified srpm %s cannot be found/opened" % srpm)
+                sys.exit(50)
     
+            if hdr[rpm.RPMTAG_SOURCEPACKAGE] != 1:
+                error("Specified srpm isn't a srpm!  Can't go on")
+                sys.exit(50)
+
+        # Prep build root
+        my = None  # if Root() fails, my will be undefined so we force it to None
         try:
-            my = None  # if Root() fails, my will be undefined so we force it to None
             my = Root(config_opts)
             os.umask(0022) # set a umask- protects from paranoid whackjobs with an 002 umask
-            my.prep()
-            my.build(srpm)
         except Error, e:
             error(e)
             if my:
                 my.close()
             sys.exit(e.resultcode)
-    
+       
+        for srpm in srpms:
+            try:
+                my.prep()
+                my.build(srpm)
+            except Error, e:
+                error(e)
+                if my:
+                    my.close()
+                sys.exit(e.resultcode)
+        
         my.close()
         print "Results and/or logs in: %s" % my.resultdir
 




More information about the fedora-extras-commits mailing list