Add --includepkg argument

Recently, Fedora has been trying to do a 3 product split.  As part of
that, lorax was changed to do "installpkg lorax-product-*" via
provides.

I think that approach is awkward; a much simpler approach is to simply
specify the product package as input to lorax on the command line, via
external rel-eng scripts.

This patch therefore adds --includepkg (and we should probably add an
option to remove the implicit lorax-product-* glob).
This commit is contained in:
Colin Walters 2014-11-25 22:30:11 -05:00 committed by Brian C. Lane
parent 7981f98c41
commit 52d962d613
3 changed files with 12 additions and 0 deletions

View File

@ -152,12 +152,15 @@ class Lorax(BaseLoraxClass):
def run(self, ybo, product, version, release, variant="", bugurl="",
isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None,
domacboot=True, doupgrade=True, remove_temp=False,
installpkgs=None,
size=2,
add_templates=None,
add_template_vars=None):
assert self._configured
installpkgs = installpkgs or []
# get lorax version
try:
import pylorax.version
@ -253,6 +256,7 @@ class Lorax(BaseLoraxClass):
# NOTE: rb.root = ybo.conf.installroot (== self.inroot)
rb = RuntimeBuilder(product=self.product, arch=self.arch,
yum=ybo, templatedir=templatedir,
installpkgs=installpkgs,
add_templates=add_templates,
add_template_vars=add_template_vars)

View File

@ -68,6 +68,7 @@ def generate_module_info(moddir, outfile=None):
class RuntimeBuilder(object):
'''Builds the anaconda runtime image.'''
def __init__(self, product, arch, yum, templatedir=None,
installpkgs=None,
add_templates=None,
add_template_vars=None):
root = yum.conf.installroot
@ -81,6 +82,7 @@ class RuntimeBuilder(object):
yum=yum, templatedir=templatedir)
self.add_templates = add_templates or []
self.add_template_vars = add_template_vars or {}
self._installpkgs = installpkgs or []
self._runner.defaults = self.vars
def _install_branding(self):
@ -107,6 +109,8 @@ class RuntimeBuilder(object):
def install(self):
'''Install packages and do initial setup with runtime-install.tmpl'''
self._install_branding()
if len(self._installpkgs) > 0:
self._runner.installpkg(*self._installpkgs)
self._runner.run("runtime-install.tmpl")
for tmpl in self.add_templates:
self._runner.run(tmpl, **self.add_template_vars)

View File

@ -119,6 +119,9 @@ def main(args):
optional.add_option("-e", "--excludepkgs", default=[],
action="append", metavar="STRING",
help="package glob to exclude (may be listed multiple times)")
optional.add_option("-i", "--installpkgs", default=[],
action="append", metavar="STRING",
help="package glob to install before runtime-install.tmpl runs. (may be listed multiple times)")
optional.add_option("--buildarch", default=None,
help="build architecture", metavar="STRING")
optional.add_option("--volid", default=None,
@ -205,6 +208,7 @@ def main(args):
opts.variant, opts.bugurl, opts.isfinal,
workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch,
volid=opts.volid, domacboot=opts.domacboot, doupgrade=opts.doupgrade,
installpkgs=opts.installpkgs,
add_templates=opts.add_templates,
add_template_vars=parsed_add_template_vars,
remove_temp=True)