depgraph: case insensitive search for unsatisfied
authorZac Medico <zmedico@gentoo.org>
Mon, 28 Feb 2011 17:58:27 +0000 (09:58 -0800)
committerZac Medico <zmedico@gentoo.org>
Mon, 28 Feb 2011 17:58:27 +0000 (09:58 -0800)
This will fix bug #356555.

pym/_emerge/depgraph.py

index 7e55c776e80961518d2e9f5f90531f9845668dae..b9c308bca4c8b75538a96ac9151bba208095eeb7 100644 (file)
@@ -2738,7 +2738,7 @@ class depgraph(object):
                else:
                        writemsg_stdout("\nemerge: there are no ebuilds to satisfy "+green(xinfo)+".\n", noiselevel=-1)
                        if isinstance(myparent, AtomArg):
-                               cp = myparent.atom.cp
+                               cp = myparent.atom.cp.lower()
                                cat, pkg = portage.catsplit(cp)
                                if cat == "null":
                                        cat = None
@@ -2752,6 +2752,12 @@ class depgraph(object):
                                if "--usepkg" in self._frozen_config.myopts:
                                        all_cp.update(bindb.cp_all())
 
+                               orig_cp_map = {}
+                               for cp in all_cp:
+                                       cp_lower = cp.lower()
+                                       orig_cp_map.setdefault(cp_lower, []).append(cp)
+                               all_cp = set(orig_cp_map)
+
                                if cat:
                                        matches = difflib.get_close_matches(cp, all_cp)
                                else:
@@ -2764,6 +2770,11 @@ class depgraph(object):
                                        for pkg_match in pkg_matches:
                                                matches.extend(pkg_to_cp[pkg_match])
 
+                               matches_orig_case = []
+                               for cp in matches:
+                                       matches_orig_case.extend(orig_cp_map[cp])
+                               matches = matches_orig_case
+
                                if len(matches) == 1:
                                        writemsg_stdout("\nemerge: Maybe you meant " + matches[0] + "?\n"
                                                , noiselevel=-1)