summaryrefslogtreecommitdiff
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
parent3cc5e6aea41f1b3d890712e622b5a4d732211936 (diff)
downloaddebhelper-8f1588fb7270a718126cea2bf2615fcf5719aae6.tar.gz
dh_installdirs: Add --(no-)create-in-sourcedir plus --sourcedir=dir
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog6
-rwxr-xr-xdh_installdirs47
2 files changed, 45 insertions, 8 deletions
diff --git a/debian/changelog b/debian/changelog
index b4adcf9b..2fe5caee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -58,6 +58,12 @@ debhelper (11.3) UNRELEASED; urgency=medium
suggestion. (Closes: #491027)
* installinitramfs.pm: New sequence to enable dh_installinitramfs in
compat 11 and earlier.
+ * dh_installdirs: Add --(no-)create-in-sourcedir option to make
+ dh_installdirs create directories in the source directory in addition
+ in the package build directory. Furthermore, dh_installdirs now
+ accepts --sourcedir to overrule the default source directory (just
+ like e.g. dh_install). Thanks to Robert Luberda for the suggestion.
+ (Closes: #816332)
[ Dmitry Shachnev ]
* qmake.pm: Use ${DEB_HOST_GNU_TYPE}-qmake wrapper for
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);
}
}