summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2006-03-18 19:59:28 +0000
committerAlec Warner <antarus@gentoo.org>2006-03-18 19:59:28 +0000
commitf1567a5e44d32b79838330d5b7e5350f609571a1 (patch)
tree566981057750944db9c6f8d1dda15c132246a488
parent124650b8c4e6a58ed63ac2df86b1e8b1fda99d6e (diff)
downloadportage-f1567a5e44d32b79838330d5b7e5350f609571a1.tar.gz
portage-f1567a5e44d32b79838330d5b7e5350f609571a1.tar.bz2
portage-f1567a5e44d32b79838330d5b7e5350f609571a1.zip
Minor speedup for findname2, suggested by Brian Harring
svn path=/main/trunk/; revision=2941
-rw-r--r--pym/portage.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 6e594a274..d713c429b 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -4733,23 +4733,25 @@ class portdbapi(dbapi):
return self.findname2(mycpv)[0]
def findname2(self,mycpv):
- "returns file location for this particular package and in_overlay flag"
+ """
+ Returns the location of the CPV, and what overlay it was in.
+ Searches overlays first, then PORTDIR; this allows us to return the first
+ matching file. As opposed to starting in portdir and then doing overlays
+ second, we would have to exhaustively search the overlays until we found
+ the file we wanted.
+ """
if not mycpv:
return "",0
mysplit=mycpv.split("/")
-
psplit=pkgsplit(mysplit[1])
- ret=None
+
+ mytrees = self.porttrees[:]
+ mytrees.reverse()
if psplit:
- for x in self.porttrees:
+ for x in mytrees:
file=x+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild"
if os.access(file, os.R_OK):
- # when found
- ret=[file, x]
- if ret:
- return ret[0], ret[1]
-
- # when not found
+ return[file, x]
return None, 0
def aux_get(self, mycpv, mylist):