diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 9d2d2299..6db32dda 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -125,7 +125,7 @@ class Lorax(BaseLoraxClass): logger.addHandler(fh) def run(self, ybo, product, version, release, variant="", bugurl="", - isfinal=False, workdir=None, outputdir=None): + isfinal=False, workdir=None, outputdir=None, buildarch=None): assert self._configured @@ -163,8 +163,11 @@ class Lorax(BaseLoraxClass): self.inroot = ybo.conf.installroot logger.debug("using install root: {0}".format(self.inroot)) + if not buildarch: + buildarch = get_buildarch(ybo) + logger.info("setting up build architecture") - self.arch = ArchData(get_buildarch(ybo)) + self.arch = ArchData(buildarch) for attr in ('buildarch', 'basearch', 'libdir'): logger.debug("self.arch.%s = %s", attr, getattr(self.arch,attr)) @@ -252,8 +255,7 @@ def get_buildarch(ybo): buildarch = anaconda.arch break if not buildarch: - # fallback to the system architecture - logger.warning("using system architecture") - buildarch = os.uname()[4] + logger.critical("no anaconda package in the repository") + sys.exit(1) return buildarch diff --git a/src/sbin/lorax b/src/sbin/lorax index be7160c5..7dc3bf77 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -70,6 +70,8 @@ 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("--buildarch", default=None, + help="build architecture", metavar="STRING") # add the option groups to the parser parser.add_option_group(required) @@ -121,7 +123,7 @@ def main(args): lorax.configure(conf_file=opts.config) lorax.run(yb, opts.product, opts.version, opts.release, opts.variant, opts.bugurl, opts.is_beta, - workdir=tempdir, outputdir=outputdir) + workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch) def get_yum_base_object(installroot, repositories, mirrorlists=[],