Index: pym/portage_dep.py =================================================================== --- pym/portage_dep.py (revision 6657) +++ pym/portage_dep.py (revision 6660) @@ -337,6 +337,12 @@ return mydep[colon+1:] return None +def remove_slot(mydep): + colon = mydep.rfind(":") + if colon != -1: + mydep = mydep[:colon] + return mydep + _invalid_atom_chars_regexp = re.compile("[()|?]") def isvalidatom(atom, allow_blockers=False): @@ -568,24 +574,13 @@ 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) elif operator == "=": # Exact match - mylist = [cpv for cpv in candidate_list if cpvequal(cpv, mycpv)] + mylist = [cpv for cpv in candidate_list if \ + cpvequal(remove_slot(cpv), mycpv)] elif operator == "=*": # glob match # XXX: Nasty special casing for leading zeros @@ -597,7 +592,7 @@ myver = "0"+myver mycpv = mysplit[0]+"/"+mysplit[1]+"-"+myver for x in candidate_list: - xs = catpkgsplit(x) + xs = catpkgsplit(remove_slot(x)) myver = xs[2].lstrip("0") if not myver or not myver[0].isdigit(): myver = "0"+myver @@ -607,7 +602,7 @@ elif operator == "~": # version, any revision, match for x in candidate_list: - xs = catpkgsplit(x) + xs = catpkgsplit(remove_slot(x)) if xs is None: raise InvalidData(x) if not cpvequal(xs[0]+"/"+xs[1]+"-"+xs[2], mycpv_cps[0]+"/"+mycpv_cps[1]+"-"+mycpv_cps[2]): @@ -620,7 +615,7 @@ mysplit = ["%s/%s" % (cat, pkg), ver, rev] for x in candidate_list: try: - result = pkgcmp(pkgsplit(x), mysplit) + result = pkgcmp(pkgsplit(remove_slot(x)), mysplit) except ValueError: # pkgcmp may return ValueError during int() conversion writemsg("\nInvalid package name: %s\n" % x, noiselevel=-1) raise @@ -643,5 +638,14 @@ 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 Index: pym/portage.py =================================================================== --- pym/portage.py (revision 6657) +++ pym/portage.py (revision 6660) @@ -1724,7 +1724,10 @@ 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: