Blame SOURCES/BZ-1564747-gracefully-handle-reinstall-self-conflicts.patch

5e9bef
diff --git a/yum/__init__.py b/yum/__init__.py
5e9bef
index 56f8c8c4..cf9b68bd 100644
5e9bef
--- a/yum/__init__.py
5e9bef
+++ b/yum/__init__.py
5e9bef
@@ -6745,7 +6745,23 @@ much more problems).
5e9bef
             #  Newer rpm (4.8.0+) has problem objects, older have just strings.
5e9bef
             #  Should probably move to using the new objects, when we can. For
5e9bef
             # now just be compatible.
5e9bef
-            results.append(to_str(prob))
5e9bef
+            msg = to_str(prob)
5e9bef
+
5e9bef
+            # RPM currently complains about self-conflicts on reinstalls, even
5e9bef
+            # though they are allowed otherwise, so just ignore them.
5e9bef
+            # Unfortunately, we have to parse the problem string in order to
5e9bef
+            # get the provide name (which should be the first token).
5e9bef
+            if prob.type == rpm.RPMPROB_CONFLICT:
5e9bef
+                tokens = msg.split()
5e9bef
+                pkgs = self.rpmdb.returnPackages(patterns=[prob.pkgNEVR])
5e9bef
+                if tokens and pkgs:
5e9bef
+                    name = tokens[0]
5e9bef
+                    pkg = pkgs[0]
5e9bef
+                    provs = self.rpmdb.getProvides(name).keys()
5e9bef
+                    if len(provs) == 1 and provs[0] == pkg:
5e9bef
+                        continue
5e9bef
+
5e9bef
+            results.append(msg)
5e9bef
 
5e9bef
         return results
5e9bef