mock mock.py,1.46,1.47

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Sun May 14 04:49:59 UTC 2006


Author: skvidal

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

Modified Files:
	mock.py 
Log Message:

commit Hans Ulrich Niedermann and  Andreas Thienemann patch for the crack-y 
more buildreq feature.




Index: mock.py
===================================================================
RCS file: /cvs/fedora/mock/mock.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- mock.py	14 May 2006 04:48:11 -0000	1.46
+++ mock.py	14 May 2006 04:49:57 -0000	1.47
@@ -289,7 +289,7 @@
         hdr = rpmUtils.miscutils.hdrFromPackage(ts, srpm)
         
         # get text buildreqs
-        buildreqs = self._text_requires_from_hdr(hdr)
+        buildreqs = self._text_requires_from_hdr(hdr, srpm)
         arg_string = ""
         for item in buildreqs:
             
@@ -495,7 +495,7 @@
         
         return (ret, output)
 
-    def _text_requires_from_hdr(self, hdr):
+    def _text_requires_from_hdr(self, hdr, srpm):
         """take a header and hand back a unique'd list of the requires as
            strings"""
            
@@ -513,6 +513,23 @@
             req = rpmUtils.miscutils.formatRequire(n, v, f)
             reqlist.append(req)
         
+        # Extract SRPM name components - still not nice, shouldn't this
+        # be somewhere in the "hdr" parameter?
+        fname = os.path.split(str(srpm))[1]
+        name, ver, rel, epoch, arch = rpmUtils.miscutils.splitFilename(fname)
+
+        # Add the 'more_buildreqs' for this SRPM (if defined)
+        for this_srpm in ['-'.join([name,ver,rel]),
+                          '-'.join([name,ver]),
+                          '-'.join([name]),]:
+            if self.config['more_buildreqs'].has_key(this_srpm):
+                more_reqs = self.config['more_buildreqs'][this_srpm]
+                if type(more_reqs) in (type(u''), type(''),):
+                    more_reqs = [more_reqs] # be nice if we get a string
+                for req in more_reqs:
+                    reqlist.append(req)
+                break
+        
         return rpmUtils.miscutils.unique(reqlist)
     
     def _prep_install(self):
@@ -722,6 +739,7 @@
     
 """ % config_opts['chroothome']
     
+    config_opts['more_buildreqs'] = {}
     config_opts['files']['/etc/resolv.conf'] = "nameserver 192.168.1.1\n"
     config_opts['files']['/etc/hosts'] = "127.0.0.1 localhost localhost.localdomain\n"
     




More information about the scm-commits mailing list