new option --scl which will allows you to build srpm for software collection

This commit is contained in:
Miroslav Suchý 2013-04-12 15:48:21 +02:00
parent bdcaf75b6a
commit 637d8ec3fa
3 changed files with 24 additions and 1 deletions

View file

@ -80,6 +80,8 @@ class Builder(ConfigObject):
False)
self.rpmbuild_options = self._get_optional_arg(kwargs,
'rpmbuild_options', None)
self.scl = self._get_optional_arg(kwargs,
'scl', '')
# Allow a builder arg to override the test setting passed in, used by
# releasers in their config sections.
@ -232,9 +234,24 @@ class Builder(ConfigObject):
else:
debug("*NOT* using dist at all")
rpmbuild_options = self.rpmbuild_options
cmd = "rpm --eval '%scl'"
output = run_command(cmd).rstrip()
if self.scl:
if (output != self.scl) and (output != "%scl"):
print "Warning: Meta package of software collection %s installed, but --scl defines %s" % (output, self.scl)
print " Redefining scl macro to %s for this package." % self.scl
rpmbuild_options += " --define 'scl %s'" % self.scl
else:
if output != "%scl":
print "Warning: Meta package of software collection %s installed, but --scl is not present." % output
print " Undefining scl macro for this package."
# can be replaced by "--undefined scl" when el6 and fc17 is retired
rpmbuild_options += " --eval '%undefine scl'"
cmd = ('LC_ALL=C rpmbuild --define "_source_filedigest_algorithm md5" --define'
' "_binary_filedigest_algorithm md5" %s %s %s --nodeps -bs %s' % (
self.rpmbuild_options, self._get_rpmbuild_dir_options(),
rpmbuild_options, self._get_rpmbuild_dir_options(),
define_dist, self.spec_file))
output = run_command(cmd)
print(output)

View file

@ -355,6 +355,9 @@ class BuildModule(BaseCliModule):
self.parser.add_option("--rpmbuild-options", dest='rpmbuild_options',
default='',
metavar="OPTIONS", help="Options to pass to rpmbuild.")
self.parser.add_option("--scl", dest='scl',
default='',
metavar="COLLECTION", help="Build package for software collection.")
def main(self, argv):
BaseCliModule.main(self, argv)
@ -392,6 +395,7 @@ class BuildModule(BaseCliModule):
'offline': self.options.offline,
'auto_install': self.options.auto_install,
'rpmbuild_options': self.options.rpmbuild_options,
'scl': self.options.scl,
}
builder = create_builder(package_name, build_tag,

View file

@ -164,6 +164,8 @@ path or one of the pre-configured shortcuts. Only useful if you need to override
--builder-arg='BUILDER_ARGS'::
Custom arguments specific to a particular builder. (key=value)
--scl='COLLECTION'::
Build package for software collection. This is mostly usefull for building src.rpm, because for rpm you want to define this option for specific tag in tito.props
`tito release [options] TARGETS`