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

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