~ubuntu-branches/ubuntu/oneiric/debhelper/oneiric-proposed

1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
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
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
14
B<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [S<I<dir> ...>]
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
15
16
=head1 DESCRIPTION
17
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
18
B<dh_installdirs> is a debhelper program that is responsible for creating
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
19
subdirectories in package build directories.
20
1.1.9 by Joey Hess, Steve Langasek, Joey Hess
[ Steve Langasek ]
21
=head1 FILES
22
23
=over 4
24
25
=item debian/I<package>.dirs
26
27
Lists directories to be created in I<package>.
28
29
=back
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
30
31
=head1 OPTIONS
32
33
=over 4
34
35
=item B<-A>, B<--all>
36
37
Create any directories specified by command line parameters in ALL packages
38
acted on, not just the first.
39
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
40
=item I<dir> ...
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
41
42
Create these directories in the package build directory of the first
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
43
package acted on. (Or in all packages if B<-A> is specified.)
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
44
45
=back
46
47
=cut
48
49
init();
50
51
foreach my $package (@{$dh{DOPACKAGES}}) {
52
	my $tmp=tmpdir($package);
53
	my $file=pkgfile($package,"dirs");
54
55
	if (! -e $tmp) {
56
		doit("install","-d",$tmp);
57
	}
58
59
	my @dirs;
60
61
	if ($file) {
62
		@dirs=filearray($file)
63
	}
64
65
	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
66
		push @dirs, @ARGV;
67
	}	
68
69
	if (@dirs) {
70
		# Stick the $tmp onto the front of all the dirs.
71
		# This is necessary, for 2 reasons, one to make them 
72
		# be in the right directory, but more importantly, it 
73
		# protects against the danger of absolute dirs being
74
		# specified.
75
		@dirs=map {
76
				$_="$tmp/$_";
77
				tr:/:/:s; # just beautification.
78
				$_
79
			  } @dirs;
80
81
		# Create dirs.
82
		doit("install","-d",@dirs);
83
	}
84
}
85
86
=head1 SEE ALSO
87
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
88
L<debhelper(7)>
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
89
90
This program is a part of debhelper.
91
92
=head1 AUTHOR
93
94
Joey Hess <joeyh@debian.org>
95
96
=cut