diff options
author | skvidal <skvidal> | 2006-05-14 04:49:57 +0000 |
---|---|---|
committer | skvidal <skvidal> | 2006-05-14 04:49:57 +0000 |
commit | 62c61f1041258f763a020ea007f421bba558201d (patch) | |
tree | 9ab672b2c9aa00e0dcd7e6c292c4ba8f205f4e61 | |
parent | 2a84506fa40715b94207379e3b3caf030b010c69 (diff) | |
download | mock-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.py | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -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" |