Note that this is kind of valid now, in that there is nothing
technically wrong with having foo-1.i686 and foo-2.x86_64 installed.
However _by far_ the most common case is for the user to not want this,
but yum to solve for it, due to missing %{_isa} etc.
 Also "yum check duplicates" will flag it as an error already.
---
 yum/__init__.py |   34 ++++++++++++++++++++++++++++++++++
 yum/config.py   |    1 +
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index a13ad96..b4640bf 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -961,6 +961,40 @@ class YumBase(depsolve.Depsolve):
         if self.tsInfo.pkgSack is not None: # rm Transactions don't have 
pkgSack
             self.tsInfo.pkgSack.dropCachedData()
 
+        txmbrs = []
+        if rescode == 2 and self.conf.protected_multilib and 
self.arch.multilib:
+            txmbrs = self.tsInfo.getMembersWithState(None, TS_INSTALL_STATES)
+        vers = {}
+        for txmbr in txmbrs:
+            #  In theory we could skip noarch packages here, but it's really
+            # fast and there are some edge cases where it'll help.
+            if txmbr.name not in vers:
+                vers[txmbr.name] = [txmbr.po]
+                continue
+            vers[txmbr.name].append(txmbr.po)
+
+        fine = []
+        xrestring = []
+        for pkgname in vers:
+            if len(vers[pkgname]) <= 1:
+                # We have to go govelling through the rpmdb data to get
+                for pkg in self.rpmdb.searchNames([pkgname]):
+                    if self.tsInfo.getMembersWithState(pkg.pkgtup,
+                                                       TS_REMOVE_STATES):
+                        continue
+                    vers[pkgname].append(pkg)
+
+            # If all the versions are equal, we should be fine.
+            first = vers[pkgname][0]
+            for other in vers[pkgname][1:]:
+                if first.verEQ(other):
+                    continue
+                msg = _('Protected multilib versions: %s != %s')
+                xrestring.append(msg % (first, other))
+        if xrestring:
+            rescode = 1
+            restring = xrestring
+
         #  This is a version of the old "protect-packages" plugin, it allows
         # you to erase duplicates and do remove+install.
         #  But we don't allow you to turn it off!:)
diff --git a/yum/config.py b/yum/config.py
index aecef44..14eb992 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -738,6 +738,7 @@ class YumConf(StartupConf):
 
     protected_packages = ListOption("yum, glob:/etc/yum/protected.d/*.conf",
                                     parse_default=True)
+    protected_multilib = BoolOption(True)
     exit_on_lock = BoolOption(False)
     
     loadts_ignoremissing = BoolOption(False)
-- 
1.7.2.3

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to