summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskvidal <skvidal>2006-05-14 04:49:57 +0000
committerskvidal <skvidal>2006-05-14 04:49:57 +0000
commit62c61f1041258f763a020ea007f421bba558201d (patch)
tree9ab672b2c9aa00e0dcd7e6c292c4ba8f205f4e61
parent2a84506fa40715b94207379e3b3caf030b010c69 (diff)
downloadmock-62c61f1041258f763a020ea007f421bba558201d.tar.gz
mock-62c61f1041258f763a020ea007f421bba558201d.tar.xz
mock-62c61f1041258f763a020ea007f421bba558201d.zip
commit Hans Ulrich Niedermann and Andreas Thienemann patch for the crack-y
more buildreq feature.
-rw-r--r--mock.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/mock.py b/mock.py
index 8d28939..24c38f3 100644
--- a/mock.py
+++ b/mock.py
@@ -289,7 +289,7 @@ class Root:
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 @@ class Root:
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 @@ class Root:
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 @@ def main():
""" % 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"