summaryrefslogtreecommitdiff
path: root/dh
diff options
context:
space:
mode:
authorModestas Vainius <modestas@vainius.eu>2009-08-26 16:40:45 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-08-26 16:40:45 -0400
commit391a6c42bc528de0e3ba34874346d290054f517e (patch)
tree8745784c60ede734b3660b67cfe115416cdbd9bc /dh
parentf92915e39eef5b24698881576121356ccba0b7c8 (diff)
Allow dh addons to pass options to debhelper commands
Add dh addons APIs add_command_options()/remove_command_options() that allow addons to add additional options which dh will pass to the specified debhelper commands. Signed-off-by: Modestas Vainius <modestas@vainius.eu>
Diffstat (limited to 'dh')
-rwxr-xr-xdh32
1 files changed, 32 insertions, 0 deletions
diff --git a/dh b/dh
index bdd78c52..f03bf006 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,31 @@ 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 (@_) {
+ if (ref($opt) eq "Regexp") {
+ $opts = [ grep ! /$opt/, @$opts ];
+ }
+ else {
+ $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 +529,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 ".