summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2009-08-26 17:12:34 -0400
committerJoey Hess <joey@kitenet.net>2009-08-26 17:12:34 -0400
commit1089dbaaa1ccc4b7bade09555e67ae126bf776f2 (patch)
tree5760bcdf6417af4dc89769b0d690935ffa20c753
parentdc140665f3ae022f682a43c044c18c0fa0d0e5be (diff)
parent055eb0b4ef0efee17b1328fbbf012af4110968d4 (diff)
Merge branch 'master' of ssh://git.debian.org/git/debhelper/debhelper
-rw-r--r--debian/changelog7
-rwxr-xr-xdh27
-rwxr-xr-xdh_auto_install40
-rw-r--r--doc/PROGRAMMING13
4 files changed, 74 insertions, 13 deletions
diff --git a/debian/changelog b/debian/changelog
index adb1b2f0..b89db64b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,13 @@ debhelper (7.3.16) UNRELEASED; urgency=low
* dh_installdocs: Loosen the Document field parsing, to accept
everything doc-base *really* accepts in a doc id (not just what
it's documented to accept). Closes: #543499
+ * Allow sequence addons to pass options to debhelper commands,
+ by adding add_command_options and remove_command_options to the interface.
+ Closes: #543392
+ (Modestas Vainius)
+ * dh_auto_install: Add a --destdir parameter that can be used to override
+ the default. Closes: #538201
+ (Modestas Vainius)
-- Joey Hess <joeyh@debian.org> Mon, 24 Aug 2009 12:59:02 -0400
diff --git a/dh b/dh
index bdd78c52..710117ea 100755
--- a/dh
+++ b/dh
@@ -293,6 +293,9 @@ $sequences{binary} = [@{$sequences{install}}, qw{
}, @b];
$sequences{'binary-arch'} = [@{$sequences{binary}}];
+# Additional command options
+my %command_opts;
+
# sequence addon interface
sub _insert {
my $offset=shift;
@@ -333,6 +336,26 @@ sub add_command {
my $sequence=shift;
unshift @{$sequences{$sequence}}, $command;
}
+sub add_command_options {
+ my $command=shift;
+ push @{$command_opts{$command}}, @_;
+}
+sub remove_command_options {
+ my $command=shift;
+ if (@_) {
+ # Remove only specified options
+ if (my $opts = $command_opts{$command}) {
+ foreach my $opt (@_) {
+ $opts = [ grep { $_ ne $opt } @$opts ];
+ }
+ $command_opts{$command} = $opts;
+ }
+ }
+ else {
+ # Clear all additional options
+ delete $command_opts{$command};
+ }
+}
if ($dh{LIST}) {
my %addons;
@@ -501,6 +524,10 @@ sub run {
$command="debian/rules";
@options="override_".$override_command;
}
+ else {
+ # Pass additional command options if any
+ unshift @options, @{$command_opts{$command}} if exists $command_opts{$command};
+ }
# 3 space indent lines the command being run up under the
# sequence name after "dh ".
diff --git a/dh_auto_install b/dh_auto_install
index b57db839..a5d483b1 100755
--- a/dh_auto_install
+++ b/dh_auto_install
@@ -9,6 +9,7 @@ dh_auto_install - automatically runs make install or similar
use strict;
use Debian::Debhelper::Dh_Lib;
use Debian::Debhelper::Dh_Buildsystems;
+use File::Spec;
use Cwd;
=head1 SYNOPSIS
@@ -25,10 +26,11 @@ if the environment variable is set). If there is a setup.py or Build.PL,
it is used. Note that the Ant build system does not support installation,
so dh_auto_install will not install files built using Ant.
-The files are installed into debian/<package>/ if there is only one binary
-package. In the multiple binary package case, the files are instead
-installed into debian/tmp/, and should be moved from there to the
-appropriate package build directory using L<dh_install(1)>.
+Unless --destdir option is specified, the files are installed into
+debian/<package>/ if there is only one binary package. In the multiple binary
+package case, the files are instead installed into debian/tmp/, and should be
+moved from there to the appropriate package build directory using
+L<dh_install(1)>.
DESTDIR is used to tell make where to install the files.
If the Makefile was generated by MakeMaker from a Makefile.PL, it will
@@ -45,6 +47,12 @@ system selection and control options.
=over 4
+=item B<--destdir=>I<directory>
+
+Install files into the specified I<directory>. If this option is not specified,
+destination directory is determined automatically as described in the
+L</DESCRIPTION> section.
+
=item B<--> I<params>
Pass "params" to the program that is run. These can be used to supplement
@@ -54,17 +62,23 @@ or override the any standard parameters that dh_auto_install passes.
=cut
-buildsystems_init();
-
my $destdir;
-my @allpackages=getpackages();
-if (@allpackages > 1) {
- $destdir="debian/tmp";
-}
-else {
- $destdir=tmpdir($dh{MAINPACKAGE});
+
+buildsystems_init(options => {
+ "destdir=s" => \$destdir,
+});
+
+# If destdir is not specified, determine it automatically
+if (!$destdir) {
+ my @allpackages=getpackages();
+ if (@allpackages > 1) {
+ $destdir="debian/tmp";
+ }
+ else {
+ $destdir=tmpdir($dh{MAINPACKAGE});
+ }
}
-$destdir=cwd()."/".$destdir;
+$destdir = File::Spec->rel2abs($destdir, cwd());
buildsystems_do("install", $destdir);
diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING
index 4be09b1c..5f236ebd 100644
--- a/doc/PROGRAMMING
+++ b/doc/PROGRAMMING
@@ -270,6 +270,19 @@ add_command($new_command, $sequence)
Add $new_command to the beginning of the specified sequence.
If the sequence does not exist, it will be created.
+add_command_options($command, $opt1, $opt2, ...)
+ Append $opt1, $opt2 etc. to the list of additional options which
+ dh passes when running the specified $command. These options are
+ not relayed to debhelper commands called via $command override.
+
+remove_command_options($command)
+ Clear all additional $command options previously added with
+ add_command_options().
+
+remove_command_options($command, $opt1, $opt2, ...)
+ Remove $opt1, $opt2 etc. from the list of additional options which
+ dh passes when running the specified $command.
+
Buildsystem Classes:
-------------------