Always use vercmp for cpv comparisons
authorMarius Mauch <genone@gentoo.org>
Wed, 10 Jan 2007 08:08:18 +0000 (08:08 -0000)
committerMarius Mauch <genone@gentoo.org>
Wed, 10 Jan 2007 08:08:18 +0000 (08:08 -0000)
svn path=/main/trunk/; revision=5511

pym/portage.py
pym/portage_dep.py

index 3f3e378ae42182064b1e0258f1c34469ddec7ad5..21b8d181739e79ae33806fc4faa072a67d32b34c 100644 (file)
@@ -3818,6 +3818,18 @@ def getCPFromCPV(mycpv):
        """Calls pkgsplit on a cpv and returns only the cp."""
        return pkgsplit(mycpv)[0]
 
+def cpvequal(cpv1, cpv2):
+       split1 = catpkgsplit(cpv1)
+       split2 = catpkgsplit(cpv2)
+       
+       if not split1 or not split2:
+               raise portage_exception.PortageException("Invalid data, parameter was not a CPV")
+       
+       if split1[0] != split2[0]:
+               return False
+       
+       return (pkgcmp(split1[1:], split2[1:]) == 0)
+
 
 def dep_virtual(mysplit, mysettings):
        "Does virtual dependency conversion"
index ef6486f197510ce07c377e6efd35ac32c7a183c3..60b75e03a509456cbbc1b38e00b4c233ee88882d 100644 (file)
@@ -568,19 +568,18 @@ def match_from_list(mydep, candidate_list):
                        mylist.append(x)
 
        elif operator == "=": # Exact match
-               if mycpv in candidate_list:
-                       mylist = [mycpv]
+               mylist = [cpv for cpv in candidate_list if cpvequal(cpv, mycpv)]
 
        elif operator == "=*": # glob match
                # The old verion ignored _tag suffixes... This one doesn't.
                for x in candidate_list:
-                       if x[0:len(mycpv)] == mycpv:
+                       if cpvequal(x[0:len(mycpv)], mycpv):
                                mylist.append(x)
 
        elif operator == "~": # version, any revision, match
                for x in candidate_list:
                        xs = catpkgsplit(x)
-                       if xs[0:2] != mycpv_cps[0:2]:
+                       if not cpvequal(xs[0]+"/"+xs[1]+"-"+xs[2], mycpv_cps[0]+"/"+mycpv_cps[1]+"-"+mycpv_cps[2]):
                                continue
                        if xs[2] != ver:
                                continue