Added option to remove packages (parallel to installpkgs)
This commit is contained in:
parent
5aa6fea8c3
commit
7ca356845b
@ -165,7 +165,7 @@ class Lorax(BaseLoraxClass):
|
|||||||
def run(self, dbo, product, version, release, variant="", bugurl="",
|
def run(self, dbo, product, version, release, variant="", bugurl="",
|
||||||
isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None,
|
isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None,
|
||||||
domacboot=True, doupgrade=True, remove_temp=False,
|
domacboot=True, doupgrade=True, remove_temp=False,
|
||||||
installpkgs=None,
|
installpkgs=None, excludepkgs=None,
|
||||||
size=2,
|
size=2,
|
||||||
add_templates=None,
|
add_templates=None,
|
||||||
add_template_vars=None,
|
add_template_vars=None,
|
||||||
@ -176,6 +176,7 @@ class Lorax(BaseLoraxClass):
|
|||||||
assert self._configured
|
assert self._configured
|
||||||
|
|
||||||
installpkgs = installpkgs or []
|
installpkgs = installpkgs or []
|
||||||
|
excludepkgs = excludepkgs or []
|
||||||
|
|
||||||
# get lorax version
|
# get lorax version
|
||||||
try:
|
try:
|
||||||
@ -270,6 +271,7 @@ class Lorax(BaseLoraxClass):
|
|||||||
rb = RuntimeBuilder(product=self.product, arch=self.arch,
|
rb = RuntimeBuilder(product=self.product, arch=self.arch,
|
||||||
dbo=dbo, templatedir=self.templatedir,
|
dbo=dbo, templatedir=self.templatedir,
|
||||||
installpkgs=installpkgs,
|
installpkgs=installpkgs,
|
||||||
|
excludepkgs=excludepkgs,
|
||||||
add_templates=add_templates,
|
add_templates=add_templates,
|
||||||
add_template_vars=add_template_vars)
|
add_template_vars=add_template_vars)
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ def lorax_parser():
|
|||||||
optional.add_argument("-i", "--installpkgs", default=[],
|
optional.add_argument("-i", "--installpkgs", default=[],
|
||||||
action="append", metavar="PACKAGE",
|
action="append", metavar="PACKAGE",
|
||||||
help="package glob to install before runtime-install.tmpl runs. (may be listed multiple times)")
|
help="package glob to install before runtime-install.tmpl runs. (may be listed multiple times)")
|
||||||
|
optional.add_argument("-e", "--excludepkgs", default=[],
|
||||||
|
action="append", metavar="PACKAGE",
|
||||||
|
help="package glob to remove before runtime-install.tmpl runs. (may be listed multiple times)")
|
||||||
optional.add_argument("--buildarch", default=None,
|
optional.add_argument("--buildarch", default=None,
|
||||||
help="build architecture", metavar="ARCH")
|
help="build architecture", metavar="ARCH")
|
||||||
optional.add_argument("--volid", default=None,
|
optional.add_argument("--volid", default=None,
|
||||||
|
@ -70,7 +70,7 @@ def generate_module_info(moddir, outfile=None):
|
|||||||
class RuntimeBuilder(object):
|
class RuntimeBuilder(object):
|
||||||
'''Builds the anaconda runtime image.'''
|
'''Builds the anaconda runtime image.'''
|
||||||
def __init__(self, product, arch, dbo, templatedir=None,
|
def __init__(self, product, arch, dbo, templatedir=None,
|
||||||
installpkgs=None,
|
installpkgs=None, excludepkgs=None,
|
||||||
add_templates=None,
|
add_templates=None,
|
||||||
add_template_vars=None):
|
add_template_vars=None):
|
||||||
root = dbo.conf.installroot
|
root = dbo.conf.installroot
|
||||||
@ -85,6 +85,7 @@ class RuntimeBuilder(object):
|
|||||||
self.add_templates = add_templates or []
|
self.add_templates = add_templates or []
|
||||||
self.add_template_vars = add_template_vars or {}
|
self.add_template_vars = add_template_vars or {}
|
||||||
self._installpkgs = installpkgs or []
|
self._installpkgs = installpkgs or []
|
||||||
|
self._excludepkgs = excludepkgs or []
|
||||||
self._runner.defaults = self.vars
|
self._runner.defaults = self.vars
|
||||||
self.dbo.reset()
|
self.dbo.reset()
|
||||||
|
|
||||||
@ -116,6 +117,8 @@ class RuntimeBuilder(object):
|
|||||||
self._install_branding()
|
self._install_branding()
|
||||||
if len(self._installpkgs) > 0:
|
if len(self._installpkgs) > 0:
|
||||||
self._runner.installpkg(*self._installpkgs)
|
self._runner.installpkg(*self._installpkgs)
|
||||||
|
if len(self._excludepkgs) > 0:
|
||||||
|
self._runner.removepkg(*self._excludepkgs)
|
||||||
self._runner.run("runtime-install.tmpl")
|
self._runner.run("runtime-install.tmpl")
|
||||||
for tmpl in self.add_templates:
|
for tmpl in self.add_templates:
|
||||||
self._runner.run(tmpl, **self.add_template_vars)
|
self._runner.run(tmpl, **self.add_template_vars)
|
||||||
|
@ -124,7 +124,7 @@ def main():
|
|||||||
opts.variant, opts.bugurl, opts.isfinal,
|
opts.variant, opts.bugurl, opts.isfinal,
|
||||||
workdir=tempdir, outputdir=opts.outputdir, buildarch=opts.buildarch,
|
workdir=tempdir, outputdir=opts.outputdir, buildarch=opts.buildarch,
|
||||||
volid=opts.volid, domacboot=opts.domacboot, doupgrade=opts.doupgrade,
|
volid=opts.volid, domacboot=opts.domacboot, doupgrade=opts.doupgrade,
|
||||||
installpkgs=opts.installpkgs,
|
installpkgs=opts.installpkgs, excludepkgs=opts.excludepkgs,
|
||||||
size=opts.rootfs_size,
|
size=opts.rootfs_size,
|
||||||
add_templates=opts.add_templates,
|
add_templates=opts.add_templates,
|
||||||
add_template_vars=parsed_add_template_vars,
|
add_template_vars=parsed_add_template_vars,
|
||||||
|
Loading…
Reference in New Issue
Block a user