]> git.donarmstrong.com Git - debhelper.git/blob - dh_prep
Merge branch 'dh_overrides'
[debhelper.git] / dh_prep
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_prep - perform 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 =over 4
27
28 =item B<-X>I<item> B<--exclude=>I<item>
29
30 Exclude files that contain "item" anywhere in their filename from being
31 deleted, even if they would normally be deleted. You may use this option
32 multiple times to build up a list of things to exclude.
33
34 =back
35
36 =cut
37
38 init();
39
40 foreach my $package (@{$dh{DOPACKAGES}}) {
41         my $tmp=tmpdir($package);
42         my $ext=pkgext($package);
43
44         doit("rm","-f","debian/${ext}substvars")
45                 unless excludefile("debian/${ext}substvars");
46                 
47         # These are all debhelper temp files, and so it is safe to 
48         # wildcard them.
49         complex_doit("rm -f debian/$ext*.debhelper");
50         
51         doit ("rm","-rf",$tmp."/")
52                 unless excludefile($tmp);
53 }
54
55 doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1) &&
56                                    ! excludefile("debian/tmp");
57
58 =head1 SEE ALSO
59
60 L<debhelper(7)>
61
62 This program is a part of debhelper.
63
64 =head1 AUTHOR
65
66 Joey Hess <joeyh@debian.org>
67
68 =cut