For bug #179870, add support for cpv:slot in match_from_list() and use it to make...
authorZac Medico <zmedico@gentoo.org>
Tue, 29 May 2007 11:26:33 +0000 (11:26 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 29 May 2007 11:26:33 +0000 (11:26 -0000)
svn path=/main/trunk/; revision=6657

pym/portage/__init__.py
pym/portage/dep.py

index 242bfb1b78abf74bf7d577b68625b7128d546db8..b6fa9535df6c17125fc274b290558c33b074815f 100644 (file)
@@ -1737,7 +1737,10 @@ class config:
                oldpuse = self.puse
                self.puse = ""
                if self.pusedict.has_key(cp):
-                       self.pusekey = best_match_to_list(self.mycpv, self.pusedict[cp].keys())
+                       cpv_slot = self.mycpv
+                       if mydb:
+                               cpv_slot += ":" + mydb.aux_get(self.mycpv, ["SLOT"])[0]
+                       self.pusekey = best_match_to_list(cpv_slot, self.pusedict[cp].keys())
                        if self.pusekey:
                                self.puse = " ".join(self.pusedict[cp][self.pusekey])
                if oldpuse != self.puse:
index 98dda59f21f9b9e86abac0af2b1893ea12300b47..3f6b2a0ce3d3e6fea0c026545d71b3bd95bac454 100644 (file)
@@ -654,19 +654,7 @@ def match_from_list(mydep, candidate_list):
 
        if operator is None:
                for x in candidate_list:
-                       xs = pkgsplit(x)
-                       if xs is None:
-                               xcpv = dep_getcpv(x)
-                               if slot is not None:
-                                       xslot = dep_getslot(x)
-                                       if xslot is not None and xslot != slot:
-                                               """  This function isn't given enough information to
-                                               reject atoms based on slot unless *both* compared atoms
-                                               specify slots."""
-                                               continue
-                               if xcpv != mycpv:
-                                       continue
-                       elif xs[0] != mycpv:
+                       if dep_getkey(x) != mycpv:
                                continue
                        mylist.append(x)
 
@@ -729,5 +717,14 @@ def match_from_list(mydep, candidate_list):
        else:
                raise KeyError("Unknown operator: %s" % mydep)
 
+       if slot is not None:
+               candidate_list = mylist
+               mylist = []
+               for x in candidate_list:
+                       xslot = dep_getslot(x)
+                       if xslot is not None and xslot != slot:
+                               continue
+                       mylist.append(x)
+
        _match_from_list_cache[cache_key] = mylist
        return mylist