]> git.donarmstrong.com Git - debhelper.git/blob - dh_clean
r231: Initial Import
[debhelper.git] / dh_clean
1 #!/usr/bin/perl -w
2 #
3 # Clean up $TMP and other tepmorary files generated by the
4 # build process.
5
6 BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
7 use Dh_Lib;
8 init();
9
10 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
11         $TMP=tmpdir($PACKAGE);
12         $EXT=pkgext($PACKAGE);
13
14         if (! $dh{D_FLAG}) {
15                 doit("rm","-f","debian/$EXT\substvars",
16                         "debian/$EXT\postinst.debhelper",
17                         "debian/$EXT\postrm.debhelper",
18                         "debian/$EXT\preinst.debhelper",
19                         "debian/$EXT\prerm.debhelper");
20         }
21         
22         doit ("rm","-rf",$TMP);
23 }
24
25 if (! $dh{D_FLAG}) {
26         if (@ARGV) {
27                 doit("rm","-f","--",@ARGV);
28         }
29
30         if (! $dh{K_FLAG}) {
31                 doit("rm","-f","debian/files");
32         }
33
34         # Remove other temp files.
35         # (The \s+ is important, \s won't work because find would get null
36         # parameters). Note that you _don't_ quote wildcards used by find
37         # in here.
38         doit(split(/\s+/,"find . -type f -a
39                 ( -name #*# -o -name *~ -o -name DEADJOE
40                  -o -name *.orig -o -name *.rej -o -name *.bak
41                  -o -name .*.orig -o -name .*.rej -o -name .SUMS
42                  -o -name TAGS -o -name core -o ( -path */.deps/* -a -name *.P )
43                 ) -exec rm -f {} ;"));
44 }
45
46 doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp';