[lorax] Allow specifying buildarch on the command line (#771382)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 src/pylorax/__init__.py |   12 +++++++-----
 src/sbin/lorax          |    4 +++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 9d2d229..6db32dd 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 328827e..adf1b1b 100755
--- a/src/sbin/lorax
+++ b/src/sbin/lorax
@@ -67,6 +67,8 @@ def main(args):
             help="config file", metavar="STRING")
     optional.add_option("--proxy", default=None,
             help="repo proxy url:port", metavar="STRING")
+    optional.add_option("--buildarch", default=None,
+            help="build architecture", metavar="STRING")
 
     # add the option groups to the parser
     parser.add_option_group(required)
@@ -118,7 +120,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=[],
-- 
1.7.5.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux