Allow specifying buildarch on the command line (#771382)
Some repos may contain anaconda packages for more architectures, so it's not possible to get the right buildarch. This patch allows optional specifying of the buildarch on the command line when running lorax. If the buildarch is not specified manually, lorax tries to get it from the anaconda package as before. If there's no anaconda package in the repository, don't fallback to the system architecture and continue, because this is pointless. We need the anaconda package.
This commit is contained in:
parent
31c60b119b
commit
1bbc546147
@ -125,7 +125,7 @@ class Lorax(BaseLoraxClass):
|
|||||||
logger.addHandler(fh)
|
logger.addHandler(fh)
|
||||||
|
|
||||||
def run(self, ybo, product, version, release, variant="", bugurl="",
|
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
|
assert self._configured
|
||||||
|
|
||||||
@ -163,8 +163,11 @@ class Lorax(BaseLoraxClass):
|
|||||||
self.inroot = ybo.conf.installroot
|
self.inroot = ybo.conf.installroot
|
||||||
logger.debug("using install root: {0}".format(self.inroot))
|
logger.debug("using install root: {0}".format(self.inroot))
|
||||||
|
|
||||||
|
if not buildarch:
|
||||||
|
buildarch = get_buildarch(ybo)
|
||||||
|
|
||||||
logger.info("setting up build architecture")
|
logger.info("setting up build architecture")
|
||||||
self.arch = ArchData(get_buildarch(ybo))
|
self.arch = ArchData(buildarch)
|
||||||
for attr in ('buildarch', 'basearch', 'libdir'):
|
for attr in ('buildarch', 'basearch', 'libdir'):
|
||||||
logger.debug("self.arch.%s = %s", attr, getattr(self.arch,attr))
|
logger.debug("self.arch.%s = %s", attr, getattr(self.arch,attr))
|
||||||
|
|
||||||
@ -252,8 +255,7 @@ def get_buildarch(ybo):
|
|||||||
buildarch = anaconda.arch
|
buildarch = anaconda.arch
|
||||||
break
|
break
|
||||||
if not buildarch:
|
if not buildarch:
|
||||||
# fallback to the system architecture
|
logger.critical("no anaconda package in the repository")
|
||||||
logger.warning("using system architecture")
|
sys.exit(1)
|
||||||
buildarch = os.uname()[4]
|
|
||||||
|
|
||||||
return buildarch
|
return buildarch
|
||||||
|
@ -70,6 +70,8 @@ def main(args):
|
|||||||
optional.add_option("-e", "--excludepkgs", default=[],
|
optional.add_option("-e", "--excludepkgs", default=[],
|
||||||
action="append", metavar="STRING",
|
action="append", metavar="STRING",
|
||||||
help="package glob to exclude (may be listed multiple times)")
|
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
|
# add the option groups to the parser
|
||||||
parser.add_option_group(required)
|
parser.add_option_group(required)
|
||||||
@ -121,7 +123,7 @@ def main(args):
|
|||||||
lorax.configure(conf_file=opts.config)
|
lorax.configure(conf_file=opts.config)
|
||||||
lorax.run(yb, opts.product, opts.version, opts.release,
|
lorax.run(yb, opts.product, opts.version, opts.release,
|
||||||
opts.variant, opts.bugurl, opts.is_beta,
|
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=[],
|
def get_yum_base_object(installroot, repositories, mirrorlists=[],
|
||||||
|
Loading…
Reference in New Issue
Block a user