Add reqular expression matching for eclean. Bug 114365
authorfuzzyray <fuzzyray@gentoo.org>
Mon, 19 Dec 2005 18:25:04 +0000 (18:25 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Mon, 19 Dec 2005 18:25:04 +0000 (18:25 -0000)
svn path=/; revision=268

trunk/ChangeLog
trunk/src/eclean/ChangeLog
trunk/src/eclean/eclean

index ede1f64a75e2c3c15840b754d954c61a6e45d34d..ea45431ce50762bb14acb691b56becbeb2ae5589 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-19 Paul Varner <fuzzyray@gentoo.org>
+       * eclean: Add regular expression matching for exclude files (Bug 114365)
+
+2005-12-13 Paul Varner <fuzzyray@gentoo.org>
+       * equery: Fix USE flag parsing. (Bug 115294)
+
 2005-12-07 Paul Varner <fuzzyray@gentoo.org>
        * revdep-rebuild: Fix revdep-rebuild to work with findutils-4.2.27.
        (bug 111203)
@@ -77,8 +83,8 @@
        be missed. (bug 97171)
 
 2005-06-07 Paul Varner <fuzzyray@gentoo.org>
-       * revdep-rebuild: Delete temporary files if the environment does not match the previous
-                         environment (bug 95274)
+       * revdep-rebuild: Delete temporary files if the environment does not 
+       match the previous environment (bug 95274)
 
 2005-06-05 Paul Varner <fuzzyray@gentoo.org>
        * revdep-rebuild: Imported revdep-rebuild release from bug 62644
index ad8a0ef64e319c4ecf6b749d3bde1f7767fb4be6..36d9a28d514cb1e3636787de5c9f14e40b398de1 100644 (file)
@@ -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
index 0b0b6ce44c73d29870c35bb55da0b971e8c43602..c631ceadf56b57cc7588ed38c0a075c1669da1a8 100644 (file)
@@ -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