summaryrefslogtreecommitdiff
path: root/dh_installdirs
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2018-05-19 08:47:08 +0000
committerNiels Thykier <niels@thykier.net>2018-05-19 08:47:08 +0000
commit8f1588fb7270a718126cea2bf2615fcf5719aae6 (patch)
treed458a7633047a4fdabf1451e41113ab2aab3cf7b /dh_installdirs
parent3cc5e6aea41f1b3d890712e622b5a4d732211936 (diff)
dh_installdirs: Add --(no-)create-in-sourcedir plus --sourcedir=dir
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'dh_installdirs')
-rwxr-xr-xdh_installdirs47
1 files changed, 39 insertions, 8 deletions
diff --git a/dh_installdirs b/dh_installdirs
index 7254df16..97d31d47 100755
--- a/dh_installdirs
+++ b/dh_installdirs
@@ -14,7 +14,7 @@ our $VERSION = DH_BUILTIN_VERSION;
=head1 SYNOPSIS
-B<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [S<I<dir> ...>]
+B<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [B<--sourcedir=>I<dir>] [B<--create-in-sourcedir>] [S<I<dir> ...>]
=head1 DESCRIPTION
@@ -48,6 +48,23 @@ commands.
Create any directories specified by command line parameters in ALL packages
acted on, not just the first.
+=item B<--create-in-sourcedir>, B<--no-create-in-sourcedir>
+
+Whether to create the specified directories in the source directory
+(usually F<debian/tmp>) I<in addition to> in the package build directory
+(usually F<< debian/I<package> >>).
+
+The default is B<--no-create-in-sourcedir>.
+
+=item B<--sourcedir=>I<dir>
+
+Consider I<dir> the source directory for the packages acted on instead
+of the default (which is usually F<debian/tmp>).
+
+Please note that this option is dependent on the
+B<--create-in-sourcedir> option (when B<--no-create-in-sourcedir> is
+in effect, this option does nothing in B<dh_installdirs>).
+
=item I<dir> ...
Create these directories in the package build directory of the first
@@ -57,13 +74,19 @@ package acted on. (Or in all packages if B<-A> is specified.)
=cut
-init();
+my $create_in_sourcedir = 0;
+
+init(options => {
+ 'sourcedir=s' => \$dh{SOURCEDIR},
+ 'create-in-sourcedir!' => \$create_in_sourcedir,
+});
# PROMISE: DH NOOP WITHOUT dirs
foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmp=tmpdir($package);
my $file=pkgfile($package,"dirs");
+ my $srcdir = $dh{SOURCEDIR} // default_sourcedir($package);
install_dir($tmp) if compat(10);
@@ -83,14 +106,22 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
# be in the right directory, but more importantly, it
# protects against the danger of absolute dirs being
# specified.
- @dirs=map {
- $_="$tmp/$_";
- tr:/:/:s; # just beautification.
- $_
- } @dirs;
+ my @make_dirs;
+ push(@make_dirs, map {
+ my $dir = "$tmp/$_";
+ $dir =~ tr:/:/:s; # just beautification.
+ $dir;
+ } @dirs);
+ if ($create_in_sourcedir) {
+ push(@make_dirs, map {
+ my $dir = "${srcdir}/$_";
+ $dir =~ tr:/:/:s; # just beautification.
+ $dir;
+ } @dirs);
+ }
# Create dirs.
- install_dir(@dirs);
+ install_dir(@make_dirs);
}
}