diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-25 04:15:50 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-25 04:15:50 +0000 |
commit | c8f9e92d1da597fbc8c64dee026bcde55c5bfa1e (patch) | |
tree | debd3378c95e8be062ef1acac9e3c2d70d2175ce /pym | |
parent | 437e8e808ceed3a23fa1a83b9d60f9e8edbb749e (diff) | |
download | portage-c8f9e92d1da597fbc8c64dee026bcde55c5bfa1e.tar.gz portage-c8f9e92d1da597fbc8c64dee026bcde55c5bfa1e.tar.bz2 portage-c8f9e92d1da597fbc8c64dee026bcde55c5bfa1e.zip |
Bug #223417 - Make the vardbapi.cpv_all() use_cache parameter useful
for forcing direct os.listdir() calls. This is more of an issue now
that these listdir() calls are frequently triggered when merging
packages (due to things like blocker and preserve-libs handling).
(trunk r10390)
svn path=/main/branches/2.1.2/; revision=10406
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 85b9bf670..cf38107df 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6764,8 +6764,25 @@ class vardbapi(dbapi): return returnme def cpv_all(self, use_cache=1): + """ + Set use_cache=0 to bypass the portage.cachedir() cache in cases + when the accuracy of mtime staleness checks should not be trusted + (generally this is only necessary in critical sections that + involve merge or unmerge of packages). + """ returnme = [] basepath = os.path.join(self.root, VDB_PATH) + os.path.sep + + if use_cache: + from portage import listdir + else: + def listdir(p, **kwargs): + try: + return [x for x in os.listdir(p) \ + if os.path.isdir(os.path.join(p, x))] + except EnvironmentError: + return [] + for x in listdir(basepath, EmptyOnError=1, ignorecvs=1, dirsonly=1): if self._excluded_dirs.match(x) is not None: continue |