[PATCH] Honor kickstart and command line switches to enable multilib.

David Lehman dlehman at redhat.com
Fri Aug 31 17:01:16 UTC 2012


The new option, which can be a boot arg or an option to kickstart's
packages section, is --multilib. What it does is set yum's
multilib_policy to "all". The default is "best".
---
 anaconda                           |    3 +++
 pyanaconda/packaging/yumpayload.py |   31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/anaconda b/anaconda
index 0ca74a6..e42299e 100755
--- a/anaconda
+++ b/anaconda
@@ -230,6 +230,7 @@ def parseOptions(argv=None, cmdline=None):
     op.add_option("--rescue", dest="rescue", action="store_true", default=False)
     op.add_option("--targetarch", "rpmarch", dest="targetArch", type="string")
     op.add_option("--armplatform", dest="armPlatform", type="string")
+    op.add_option("--multilib", dest="multiLib", action="store_true", default=False)
 
     op.add_option("-m", "--method", dest="method", default=None)
     op.add_option("--repo", dest="method", default=None)
@@ -898,6 +899,8 @@ if __name__ == "__main__":
         anaconda.storage.setupDiskImages()
         anaconda.simpleFilter = True
 
+    # sets yum's multilib_policy to "all" (as opposed to "best")
+    ksdata.packages.multiLib = multiLib
 
     if anaconda.displayMode == 'g':
         # comment out the next line to make exceptions non-fatal
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 0d8e5cf..d10e356 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -207,6 +207,9 @@ reposdir=%s
         if flags.noverifyssl:
             buf += "sslverify=0\n"
 
+        if self.data.packages.multiLib:
+            buf += "multilib_policy=all\n"
+
         if self.data.method.proxy:
             try:
                 proxy = ProxyString(self.data.method.proxy)
@@ -1239,6 +1242,34 @@ reposdir=%s
 
         self._removeTxSaveFile()
 
+        if self.data.packages.multiLib:
+            # write out the yum config with the new multilib_policy value
+            # FIXME: switch to using yum-config-manager once it stops expanding
+            #        all yumvars and writing out the expanded pairs to the conf
+            yb = yum.YumBase()
+            yum_conf_path = "/etc/yum.conf"
+            yb.preconf.fn = ROOT_PATH + yum_conf_path
+            yb.conf.multilib_policy = "all"
+
+            # this will appear in yum.conf, which is silly
+            yb.conf.config_file_path = yum_conf_path
+
+            # hack around yum having expanded $basearch in the cachedir value
+            cachedir = yb.conf.cachedir.replace("/%s/" % yb.arch.basearch,
+                                                "/$basearch/")
+            yb.conf.cachedir = cachedir
+            yum_conf = ROOT_PATH + yum_conf_path
+            if os.path.exists(yum_conf):
+                try:
+                    os.rename(yum_conf, yum_conf + ".anacbak")
+                except OSError as e:
+                    log.error("failed to back up yum.conf: %s" % e)
+
+            try:
+                yb.conf.write(open(yum_conf, "w"))
+            except Exception as e:
+                log.error("failed to write out yum.conf: %s" % e)
+
         super(YumPayload, self).postInstall()
 
 class RPMCallback(object):
-- 
1.7.7.6



More information about the anaconda-patches mailing list