diff options
| author | fuzzyray <fuzzyray@gentoo.org> | 2005-12-19 18:25:04 +0000 |
|---|---|---|
| committer | fuzzyray <fuzzyray@gentoo.org> | 2005-12-19 18:25:04 +0000 |
| commit | 351cd75a09c06182b3b1c6c1c654feb54f8053e8 (patch) | |
| tree | 3b5af05fb052ad85bb53e55f4185e5b189f26646 /trunk/src/eclean | |
| parent | a999d0d6f28395d5f7f0cf1dcbc6626f385e761c (diff) | |
| download | gentoolkit-351cd75a09c06182b3b1c6c1c654feb54f8053e8.tar.gz | |
Add reqular expression matching for eclean. Bug 114365
svn path=/; revision=268
Diffstat (limited to 'trunk/src/eclean')
| -rw-r--r-- | trunk/src/eclean/ChangeLog | 4 | ||||
| -rw-r--r-- | trunk/src/eclean/eclean | 24 |
2 files changed, 25 insertions, 3 deletions
diff --git a/trunk/src/eclean/ChangeLog b/trunk/src/eclean/ChangeLog index ad8a0ef..36d9a28 100644 --- a/trunk/src/eclean/ChangeLog +++ b/trunk/src/eclean/ChangeLog @@ -1,3 +1,7 @@ +2005-12-19 Paul Varner <fuzzyray@gentoo.org> + * Add support for reqular expression matching for file names in the + exclude files. + 2005-08-28 Thomas de Grenier de Latour (tgl) <degrenier@easyconnect.fr> * Version 0.4.1 * added support for some "eclean-dist" and "eclean-pkg" symlinks on eclean diff --git a/trunk/src/eclean/eclean b/trunk/src/eclean/eclean index 0b0b6ce..c631cea 100644 --- a/trunk/src/eclean/eclean +++ b/trunk/src/eclean/eclean @@ -450,7 +450,13 @@ def parseExcludeFile(filepath): else: raise ParseExcludeFileException("Invalid cat/pkg: "+mycp) except: pass #raise ParseExcludeFileException("Invalid line: "+line) - excl_dict['garbage'][line] = None + try: + excl_dict['garbage'][line] = re.compile(line) + except: + try: + excl_dict['garbage'][line] = re.compile(re.escape(line)) + except: + raise ParseExcludeFileException("Invalid file name/regular expression: "+line) return excl_dict @@ -551,8 +557,20 @@ def findDistfiles( \ continue if time_limit and (file_stat[stat.ST_MTIME] >= time_limit): continue - if 'garbage' in exclude_dict and file in exclude_dict['garbage']: - continue + if 'garbage' in exclude_dict: + # Try to match file name directly + if file in exclude_dict['garbage']: + file_match = True + # See if file matches via regular expression matching + else: + file_match = False + for file_entry in exclude_dict['garbage']: + if exclude_dict['garbage'][file_entry].match(file): + file_match = True + break + + if file_match: + continue # this is a candidate for cleaning clean_dict[file]=[filepath] # remove files owned by some protected packages |
