]> git.donarmstrong.com Git - debhelper.git/blob - dh_prep
dh_prep: New program, does the same as dh_clean -k (which will be deprecated later).
[debhelper.git] / dh_prep
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_prep - preform cleanups in preparation for building a binary package
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_prep> [S<I<debhelper options>>] [B<-X>I<item>]
15
16 =head1 DESCRIPTION
17
18 dh_prep is a debhelper program that performs some file cleanups in
19 preparation for building a package. (This is what dh_clean -k used to do.)
20 It removes the package build directories, debian/tmp, and some temp files
21 that are generated during the build. Putting this at the start of the build
22 process makes the build process idempotent.
23
24 =head1 OPTIONS
25
26 =item B<-X>I<item> B<--exclude=>I<item>
27
28 Exclude files that contain "item" anywhere in their filename from being
29 deleted, even if they would normally be deleted. You may use this option
30 multiple times to build up a list of things to exclude.
31
32 =back
33
34 =cut
35
36 init();
37
38 foreach my $package (@{$dh{DOPACKAGES}}) {
39         my $tmp=tmpdir($package);
40         my $ext=pkgext($package);
41
42         doit("rm","-f","debian/${ext}substvars")
43                 unless excludefile("debian/${ext}substvars");
44                 
45         # These are all debhelper temp files, and so it is safe to 
46         # wildcard them.
47         complex_doit("rm -f debian/$ext*.debhelper");
48         
49         doit ("rm","-rf",$tmp."/")
50                 unless excludefile($tmp);
51 }
52
53 doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1) &&
54                                    ! excludefile("debian/tmp");
55
56 =head1 SEE ALSO
57
58 L<debhelper(7)>
59
60 This program is a part of debhelper.
61
62 =head1 AUTHOR
63
64 Joey Hess <joeyh@debian.org>
65
66 =cut