For bug #183639, give a more informative message with the package.provided warning...
authorZac Medico <zmedico@gentoo.org>
Fri, 29 Jun 2007 14:10:21 +0000 (14:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 29 Jun 2007 14:10:21 +0000 (14:10 -0000)
svn path=/main/branches/2.1.2/; revision=7092

bin/emerge

index 1e76f98e37bfa10f5d8295526cbafc0b3d21c132..b6b12b27994407f9912304fac0a15906be9c6c79 100755 (executable)
@@ -1576,7 +1576,7 @@ class depgraph:
                        # package will not be merged and a warning will be displayed.
                        cp = portage.dep_getkey(depstring)
                        if cp in self._args_atoms and depstring in self._args_atoms[cp]:
-                               self._pprovided_args.append(arg)
+                               self._pprovided_args.append((arg, depstring))
 
                if myparent:
                        # The parent is added after it's own dep_check call so that it
@@ -2930,6 +2930,14 @@ class depgraph:
                                sys.stdout.write(text)
 
                if self._pprovided_args:
+                       arg_refs = {}
+                       for arg_atom in self._pprovided_args:
+                               arg, atom = arg_atom
+                               arg_refs[arg_atom] = []
+                               cp = portage.dep_getkey(atom)
+                               for set_name, pkg_set in self._sets.iteritems():
+                                       if cp in pkg_set and atom in pkg_set[cp]:
+                                               arg_refs[arg_atom].append(set_name)
                        msg = []
                        msg.append(bad("\nWARNING: "))
                        if len(self._pprovided_args) > 1:
@@ -2938,10 +2946,24 @@ class depgraph:
                        else:
                                msg.append("A requested package will not be " + \
                                        "merged because it is listed in\n")
-                       msg.append("         package.provided:\n\n")
-                       for arg in self._pprovided_args:
-                               msg.append("             " + arg + "\n")
+                       msg.append("package.provided:\n\n")
+                       problems_sets = set()
+                       for (arg, atom), refs in arg_refs.iteritems():
+                               ref_string = ""
+                               if refs:
+                                       problems_sets.update(refs)
+                                       refs.sort()
+                                       ref_string = ", ".join(["'%s'" % name for name in refs])
+                                       ref_string = " pulled in by " + ref_string
+                               msg.append("  %s%s\n" % (colorize("INFORM", arg), ref_string))
                        msg.append("\n")
+                       if "world" in problems_sets:
+                               msg.append("This problem can be solved in one of the following ways:\n\n")
+                               msg.append("  A) Use emaint to clean offending packages from world (if not installed).\n")
+                               msg.append("  B) Uninstall offending packages (cleans them from world).\n")
+                               msg.append("  C) Remove offending entries from package.provided.\n\n")
+                               msg.append("The best course of action depends on the reason that an offending\n")
+                               msg.append("package.provided entry exists.\n\n")
                        sys.stderr.write("".join(msg))
 
        def calc_changelog(self,ebuildpath,current,next):