summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-10-13 05:27:17 +0000
committerZac Medico <zmedico@gentoo.org>2007-10-13 05:27:17 +0000
commit3ab7f2893f32670bcab7bb4c5faf2cfcb9e90cf6 (patch)
tree48140f54799ca71c19de27f00442ba116f4911d3 /pym
parentf026e1e10ac37e6bff3192642bb822b11f1a0a95 (diff)
downloadportage-3ab7f2893f32670bcab7bb4c5faf2cfcb9e90cf6.tar.gz
portage-3ab7f2893f32670bcab7bb4c5faf2cfcb9e90cf6.tar.bz2
portage-3ab7f2893f32670bcab7bb4c5faf2cfcb9e90cf6.zip
In dblink.treewalk(), use os.walk() instead of portage.listdir()
in order to avoid cacheddir() bloat when listing the files to be merged from ${D}. svn path=/main/trunk/; revision=8096
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/vartree.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 9c1d186dc..a6eca8abe 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1688,6 +1688,9 @@ class dblink(object):
secondhand is a list of symlinks that have been skipped due to their target
not existing; we will merge these symlinks at a later time.
"""
+
+ srcroot = normalize_path(srcroot).rstrip(os.path.sep) + os.path.sep
+
if not os.path.isdir(srcroot):
writemsg("!!! Directory Not Found: D='%s'\n" % srcroot,
noiselevel=-1)
@@ -1738,25 +1741,24 @@ class dblink(object):
# has to be before the counter is written) - genone
counter = self.vartree.dbapi.counter_tick(self.myroot, mycpv=self.mycpv)
- myfilelist = None
- mylinklist = None
+ myfilelist = []
+ mylinklist = []
+ def onerror(e):
+ raise
+ for parent, dirs, files in os.walk(srcroot, onerror=onerror):
+ for f in files:
+ file_path = os.path.join(parent, f)
+ file_mode = os.lstat(file_path).st_mode
+ if stat.S_ISREG(file_mode):
+ myfilelist.append(file_path[len(srcroot):])
+ elif stat.S_ISLNK(file_mode):
+ mylinklist.append(file_path[len(srcroot):])
# Preserve old libs if they are still in use
if slot_matches and "preserve-libs" in self.settings.features:
- myfilelist = listdir(srcroot, recursive=1, filesonly=1, followSymlinks=False)
- mylinklist = filter(os.path.islink, [os.path.join(srcroot, x) for x in listdir(srcroot, recursive=1, filesonly=0, followSymlinks=False)])
- mylinklist = [x[len(srcroot):] for x in mylinklist]
self._preserve_libs(srcroot, destroot, myfilelist+mylinklist, counter)
# check for package collisions
- if myfilelist is None:
- myfilelist = listdir(srcroot, recursive=1,
- filesonly=1, followSymlinks=False)
- if mylinklist is None:
- mylinklist = filter(os.path.islink, [os.path.join(srcroot, x) \
- for x in listdir(srcroot, recursive=1,
- filesonly=0, followSymlinks=False)])
- mylinklist = [x[len(srcroot):] for x in mylinklist]
collisions = self._collision_protect(srcroot, destroot, others_in_slot,
myfilelist+mylinklist, mylinklist)