]> git.donarmstrong.com Git - debhelper.git/blob - dh_prep
dh_prep(1): Clarify when it should be called. Closes: #544969
[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 binary package. (This is what dh_clean -k
20 used to do.) It removes the package build directories, debian/tmp,
21 and some temp files that are generated when building a binary package.
22
23 It is typically run at the top of the binary-arch and binary-indep targets,
24 or at the top of a target such as install that they depend on.
25
26 =head1 OPTIONS
27
28 =over 4
29
30 =item B<-X>I<item> B<--exclude=>I<item>
31
32 Exclude files that contain "item" anywhere in their filename from being
33 deleted, even if they would normally be deleted. You may use this option
34 multiple times to build up a list of things to exclude.
35
36 =back
37
38 =cut
39
40 init();
41
42 foreach my $package (@{$dh{DOPACKAGES}}) {
43         my $tmp=tmpdir($package);
44         my $ext=pkgext($package);
45
46         doit("rm","-f","debian/${ext}substvars")
47                 unless excludefile("debian/${ext}substvars");
48                 
49         # These are all debhelper temp files, and so it is safe to 
50         # wildcard them.
51         complex_doit("rm -f debian/$ext*.debhelper");
52         
53         doit ("rm","-rf",$tmp."/")
54                 unless excludefile($tmp);
55 }
56
57 doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1) &&
58                                    ! excludefile("debian/tmp");
59
60 =head1 SEE ALSO
61
62 L<debhelper(7)>
63
64 This program is a part of debhelper.
65
66 =head1 AUTHOR
67
68 Joey Hess <joeyh@debian.org>
69
70 =cut