Validate ebuild names in portdbapi.cp_list() and raise an raise an informative Invali...
authorZac Medico <zmedico@gentoo.org>
Thu, 18 Jan 2007 20:54:40 +0000 (20:54 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 18 Jan 2007 20:54:40 +0000 (20:54 -0000)
svn path=/main/branches/2.1.2/; revision=5715

pym/portage.py
pym/portage_dep.py

index 53eac070aeb03a37d14e5d5d9f643d65228af842..92463ea979e25b4b497d01c54edf630231066a37 100644 (file)
@@ -5968,8 +5968,14 @@ class portdbapi(dbapi):
                        mytrees = self.porttrees
                for oroot in mytrees:
                        for x in listdir(oroot+"/"+mycp,EmptyOnError=1,ignorecvs=1):
-                               if x[-7:]==".ebuild":
-                                       d[mysplit[0]+"/"+x[:-7]] = None
+                               if x.endswith(".ebuild"):
+                                       pf = x[:-7]
+                                       ps = pkgsplit(pf)
+                                       if not ps:
+                                               writemsg("\nInvalid ebuild name: %s\n" % \
+                                                       os.path.join(oroot, mycp, x), noiselevel=-1)
+                                               continue
+                                       d[mysplit[0]+"/"+pf] = None
                return d.keys()
 
        def freeze(self):
index b13569822295691624234b31a5ff83cf5112c345..bf40452ac6c5158a54361e56fa198cd96c4430b9 100644 (file)
@@ -607,6 +607,8 @@ def match_from_list(mydep, candidate_list):
        elif operator == "~": # version, any revision, match
                for x in candidate_list:
                        xs = catpkgsplit(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]):
                                continue
                        if xs[2] != ver: