Don't pass slotted packages into pkgsplit since it doesn't handle them.
authorZac Medico <zmedico@gentoo.org>
Tue, 29 May 2007 12:10:09 +0000 (12:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 29 May 2007 12:10:09 +0000 (12:10 -0000)
svn path=/main/trunk/; revision=6659

pym/portage/dep.py

index 3f6b2a0ce3d3e6fea0c026545d71b3bd95bac454..0bc90cc31a51cf3505b74e121197a657e4b05355 100644 (file)
@@ -393,6 +393,12 @@ def dep_getslot(mydep):
                return mydep[colon+1:]
        return None
 
+def remove_slot(mydep):
+       colon = mydep.rfind(":")
+       if colon != -1:
+               mydep = mydep[:colon]
+       return mydep
+
 def dep_getusedeps( depend ):
        """
        Pull a listing of USE Dependencies out of a dep atom.
@@ -659,7 +665,8 @@ def match_from_list(mydep, candidate_list):
                        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
@@ -671,7 +678,7 @@ def match_from_list(mydep, candidate_list):
                        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
@@ -681,7 +688,7 @@ def match_from_list(mydep, candidate_list):
 
        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]):
@@ -694,7 +701,7 @@ def match_from_list(mydep, candidate_list):
                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