diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index aafd0c95..6a9bbcb0 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -165,7 +165,7 @@ class Lorax(BaseLoraxClass): def run(self, dbo, product, version, release, variant="", bugurl="", isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None, domacboot=True, doupgrade=True, remove_temp=False, - installpkgs=None, + installpkgs=None, excludepkgs=None, size=2, add_templates=None, add_template_vars=None, @@ -176,6 +176,7 @@ class Lorax(BaseLoraxClass): assert self._configured installpkgs = installpkgs or [] + excludepkgs = excludepkgs or [] # get lorax version try: @@ -270,6 +271,7 @@ class Lorax(BaseLoraxClass): rb = RuntimeBuilder(product=self.product, arch=self.arch, dbo=dbo, templatedir=self.templatedir, installpkgs=installpkgs, + excludepkgs=excludepkgs, add_templates=add_templates, add_template_vars=add_template_vars) diff --git a/src/pylorax/cmdline.py b/src/pylorax/cmdline.py index 69b6ccb9..45991b71 100644 --- a/src/pylorax/cmdline.py +++ b/src/pylorax/cmdline.py @@ -65,6 +65,9 @@ def lorax_parser(): optional.add_argument("-i", "--installpkgs", default=[], action="append", metavar="PACKAGE", 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, help="build architecture", metavar="ARCH") optional.add_argument("--volid", default=None, diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index 7684dc16..7a200453 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -70,7 +70,7 @@ def generate_module_info(moddir, outfile=None): class RuntimeBuilder(object): '''Builds the anaconda runtime image.''' def __init__(self, product, arch, dbo, templatedir=None, - installpkgs=None, + installpkgs=None, excludepkgs=None, add_templates=None, add_template_vars=None): root = dbo.conf.installroot @@ -85,6 +85,7 @@ class RuntimeBuilder(object): self.add_templates = add_templates or [] self.add_template_vars = add_template_vars or {} self._installpkgs = installpkgs or [] + self._excludepkgs = excludepkgs or [] self._runner.defaults = self.vars self.dbo.reset() @@ -116,6 +117,8 @@ class RuntimeBuilder(object): self._install_branding() if len(self._installpkgs) > 0: self._runner.installpkg(*self._installpkgs) + if len(self._excludepkgs) > 0: + self._runner.removepkg(*self._excludepkgs) self._runner.run("runtime-install.tmpl") for tmpl in self.add_templates: self._runner.run(tmpl, **self.add_template_vars) diff --git a/src/sbin/lorax b/src/sbin/lorax index 5e998129..9791a27a 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -124,7 +124,7 @@ def main(): opts.variant, opts.bugurl, opts.isfinal, workdir=tempdir, outputdir=opts.outputdir, buildarch=opts.buildarch, volid=opts.volid, domacboot=opts.domacboot, doupgrade=opts.doupgrade, - installpkgs=opts.installpkgs, + installpkgs=opts.installpkgs, excludepkgs=opts.excludepkgs, size=opts.rootfs_size, add_templates=opts.add_templates, add_template_vars=parsed_add_template_vars,