]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_clean
initial version of dh, with option parsing and sequences in place
[debhelper.git] / dh_clean
index d4c5943a102437fe211c828d45b297a31d8530d0..88bc885f5956c524fea0c8efb275cf97d4e955c9 100755 (executable)
--- a/dh_clean
+++ b/dh_clean
@@ -20,7 +20,10 @@ package is built. It removes the package build directories, and removes some
 other files including debian/files, and any detritus left behind by other
 debhelper commands. It also removes common files that should not appear in a
 debian diff:
-  #*# *~ DEADJOE *.orig *.rej *.SUMS TAGS core .deps/* *.P
+  #*# *~ DEADJOE *.orig *.rej *.SUMS TAGS .deps/* *.P
+
+It does not run "make clean" to clean up after the build process. Use
+L<dh_auto_clean(1)> to do that.
 
 =head1 OPTIONS
 
@@ -70,7 +73,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                complex_doit("rm -f debian/$ext*.debhelper");
        }
        
-       doit ("rm","-rf",$tmp)
+       doit ("rm","-rf",$tmp."/")
                unless excludefile($tmp);
 }
 
@@ -87,26 +90,21 @@ if (! $dh{D_FLAG}) {
        # See if some files that would normally be deleted are excluded.
        my $find_options='';
        if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
-               $find_options="-a ! ( $dh{EXCLUDE_FIND} )";
+               $find_options="! \\( $dh{EXCLUDE_FIND} \\) -a";
        }
 
        # Remove other temp files.
-       # (The \s+ is important, \s won't work because find would get null
-       # parameters). Note that you _don't_ quote wildcards used by find
-       # in here.
-       doit(split(/\s+/,"find . -type f -a
-               ( -name #*# -o -name .*~ -o -name *~ -o -name DEADJOE
-                -o -name *.orig -o -name *.rej -o -name *.bak
-                -o -name .*.orig -o -name .*.rej -o -name .SUMS
-                -o -name TAGS -o -name core -o ( -path */.deps/* -a -name *.P )
-               ) $find_options -exec rm -f {} ;"));
-
-       # Stupid autoconf cache directory.
-       doit("rm", "-rf", "autom4te.cache")
-               unless excludefile("autom4te.cache");
+       complex_doit("find . $find_options \\( \\( -type f -a \\
+               \\( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \\
+                -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \\
+                -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \\
+                -o -name TAGS -o \\( -path '*/.deps/*' -a -name '*.P' \\) \\
+               \\) -exec rm -f {} \\; \\) -o \\
+               \\( -type d -a -name autom4te.cache -prune -exec rm -rf {} \\; \\) \\)");
 }
 
-doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1);
+doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1) &&
+                                   ! excludefile("debian/tmp");
 
 =head1 SEE ALSO