]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdirs
dh_installdirs(1): Remove unnecessary caveat about slashes.
[debhelper.git] / dh_installdirs
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installdirs - create subdirectories in package build directories
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [S<I<dir ...>>]
15
16 =head1 DESCRIPTION
17
18 dh_installdirs is a debhelper program that is responsible for creating
19 subdirectories in package build directories.
20
21 A file named debian/package.dirs can list directories to be created.
22
23 Any directory names specified as parameters will be created in the package
24 build directory of the first package dh_installdirs is told to act on. By
25 default, this is the first binary package in debian/control, but if you use
26 -p, -i, or -a flags, it will be the first package specified by those flags.
27
28 =head1 OPTIONS
29
30 =over 4
31
32 =item B<-A>, B<--all>
33
34 Create any directories specified by command line parameters in ALL packages
35 acted on, not just the first.
36
37 =item I<dir ...>
38
39 Create these directories in the package build directory of the first
40 package acted on. (Or in all packages if -A is specified.)
41
42 =back
43
44 =cut
45
46 init();
47
48 foreach my $package (@{$dh{DOPACKAGES}}) {
49         my $tmp=tmpdir($package);
50         my $file=pkgfile($package,"dirs");
51
52         if (! -e $tmp) {
53                 doit("install","-d",$tmp);
54         }
55
56         my @dirs;
57
58         if ($file) {
59                 @dirs=filearray($file)
60         }
61
62         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
63                 push @dirs, @ARGV;
64         }       
65
66         if (@dirs) {
67                 # Stick the $tmp onto the front of all the dirs.
68                 # This is necessary, for 2 reasons, one to make them 
69                 # be in the right directory, but more importantly, it 
70                 # protects against the danger of absolute dirs being
71                 # specified.
72                 @dirs=map {
73                                 $_="$tmp/$_";
74                                 tr:/:/:s; # just beautification.
75                                 $_
76                           } @dirs;
77
78                 # Create dirs.
79                 doit("install","-d",@dirs);
80         }
81 }
82
83 =head1 SEE ALSO
84
85 L<debhelper(7)>
86
87 This program is a part of debhelper.
88
89 =head1 AUTHOR
90
91 Joey Hess <joeyh@debian.org>
92
93 =cut