]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_clean
add
[debhelper.git] / dh_clean
index 88bc885f5956c524fea0c8efb275cf97d4e955c9..78e43c36f6819499a90421f4eae12adda8ac6d28 100755 (executable)
--- a/dh_clean
+++ b/dh_clean
@@ -25,19 +25,16 @@ debian diff:
 It does not run "make clean" to clean up after the build process. Use
 L<dh_auto_clean(1)> to do that.
 
+The debian/clean file can list other files to be removed.
+
 =head1 OPTIONS
 
 =over 4
 
 =item B<-k>, B<--keep>
 
-Do not delete debian/files. When do you want to use this? Anytime you have a
-debian/rules that has 2 binary targets that build different .deb packages;
-for example, one target is binary-arch, and the other is binary-indep, or
-one target builds the shared library, and the other the -dev package. If you
-didn't use -k in these cases, then debian/files would be deleted in the
-middle, and your changes file will only contain the last binary package that
-was built.
+This causes L<dh_prep(1)> to be run instead of dh_clean, for backwards
+compatibility.
 
 =item B<-d>, B<--dirs-only>
 
@@ -59,6 +56,12 @@ Delete these files too.
 =cut
 
 init();
+inhibit_log();
+
+if ($dh{K_FLAG}) {
+       # dh_prep will be emulated (mostly) by the code below.
+       # TODO deprecation warning
+}
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
        my $tmp=tmpdir($package);
@@ -71,6 +74,10 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                # These are all debhelper temp files, and so it is safe to 
                # wildcard them.
                complex_doit("rm -f debian/$ext*.debhelper");
+               
+               if (! $dh{K_FLAG}) {
+                       doit("rm","-f","debian/${ext}debhelper.log");
+               }
        }
        
        doit ("rm","-rf",$tmp."/")
@@ -83,6 +90,12 @@ if (! $dh{D_FLAG}) {
        }
 
        if (! $dh{K_FLAG}) {
+               if (!compat(6) && -e "debian/clean") {
+                       my @clean=grep { ! excludefile($_) }
+                               filearray("debian/clean", ".");
+                       doit("rm","-f","--",@clean) if @clean;
+               }
+
                doit("rm","-f","debian/files")
                        unless excludefile("debian/files");
        }