Make recursive grablines() ignore the same directories as
authorZac Medico <zmedico@gentoo.org>
Mon, 23 Aug 2010 07:23:15 +0000 (00:23 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 23 Aug 2010 07:23:15 +0000 (00:23 -0700)
portage.listdir(), and do the same for update_config_files().

pym/portage/update.py
pym/portage/util/__init__.py
pym/portage/util/listdir.py

index cbb154041e52e85dd89dae5d5065c2ee85e781d9..62dbf93f090f0c9a5b728e75ef007f5420bea29a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import codecs
@@ -17,6 +17,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
        'remove_slot',
        'portage.util:ConfigProtect,grabfile,new_protect_filename,' + \
                'normalize_path,write_atomic,writemsg',
+       'portage.util.listdir:_ignorecvs_dirs',
        'portage.versions:ververify'
 )
 
@@ -227,7 +228,7 @@ def update_config_files(config_root, protect, protect_mask, update_iter, match_c
                                        except UnicodeDecodeError:
                                                dirs.remove(y_enc)
                                                continue
-                                       if y.startswith("."):
+                                       if y.startswith(".") or y in _ignorecvs_dirs:
                                                dirs.remove(y_enc)
                                for y in files:
                                        try:
index b5ae524b0385ce5540ce539a27a89ba90d49b567..279a12137ac5b77790a75e5624db616aed88d736 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2004-2009 Gentoo Foundation
+# Copyright 2004-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['apply_permissions', 'apply_recursive_permissions',
@@ -23,6 +23,9 @@ import sys
 import traceback
 
 import portage
+portage.proxy.lazyimport.lazyimport(globals(),
+       'portage.util.listdir:_ignorecvs_dirs'
+)
 from portage import StringIO
 from portage import os
 from portage import pickle
@@ -328,7 +331,7 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=Fals
 def grablines(myfilename,recursive=0):
        mylines=[]
        if recursive and os.path.isdir(myfilename):
-               if os.path.basename(myfilename) in ["RCS", "CVS", "SCCS"]:
+               if os.path.basename(myfilename) in _ignorecvs_dirs:
                        return mylines
                dirlist = os.listdir(myfilename)
                dirlist.sort()
index ab7ffddf58c230c7a2eb3b20287832c69332738f..f73c9702556634b29a89b4b645f43efcfd90d71d 100644 (file)
@@ -11,6 +11,7 @@ from portage import os
 from portage.exception import DirectoryNotFound, PermissionDenied, PortageException
 from portage.util import normalize_path, writemsg
 
+_ignorecvs_dirs = ('CVS', 'RCS', 'SCCS', '.svn', '.git')
 dircache = {}
 cacheHit = 0
 cacheMiss = 0
@@ -85,8 +86,6 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli
        writemsg("cacheddirStats: H:%d/M:%d/S:%d\n" % (cacheHit, cacheMiss, cacheStale),10)
        return ret_list, ret_ftype
 
-_ignorecvs_dirs = ('CVS', 'SCCS', '.svn', '.git')
-
 def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelist=[], followSymlinks=True,
        EmptyOnError=False, dirsonly=False):
        """