diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-03-20 21:38:24 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-03-20 21:38:24 -0400 |
commit | ef74e1767100abbf1aeff3654bfb5b0a3403c5ff (patch) | |
tree | f6e9917f52b8dc4c070f0bf0cb068a1509556785 /Debian/Debhelper | |
parent | ef2f1236c3608089934726e3769cea51fc301c17 (diff) |
Fix calling the same helper for separate packages in the override of dh binary-indep/binary-arch. Closes: #520567
This is based on some work by Modestas Vainius, somewhat simplified
by a trick using excludes.
Note that the error in the case where there are no packages to build was
changed to a warning. That can easily happen now, and doesn't seem
particilarly error-worthy anyway; just exiting w/o doing anything seems
fine in that case.
Diffstat (limited to 'Debian/Debhelper')
-rw-r--r-- | Debian/Debhelper/Dh_Getopt.pm | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm index afad4b3c..28e4b79a 100644 --- a/Debian/Debhelper/Dh_Getopt.pm +++ b/Debian/Debhelper/Dh_Getopt.pm @@ -145,10 +145,39 @@ sub getoptions { sub parseopts { my $options=shift; + my @ARGV_extra; + + # DH_INTERNAL_OPTIONS is used to pass additional options from + # dh through an override target to a command. + if (defined $ENV{DH_INTERNAL_OPTIONS}) { + $ENV{DH_INTERNAL_OPTIONS}=~s/^\s+//; + $ENV{DH_INTERNAL_OPTIONS}=~s/\s+$//; + @ARGV_extra=split(/\s+/,$ENV{DH_INTERNAL_OPTIONS}); + my $ret=getoptions(\@ARGV_extra, $options); + if (!$ret) { + warning("warning: unknown options will be a fatal error in a future debhelper release"); + #error("unknown option; aborting"); + } + + # Avoid forcing acting on packages specified in + # DH_INTERNAL_OPTIONS. This way, -p can be specified + # at the command line to act on a specific package, and if + # nothing is specified, the excludes will cause the set of + # packages DH_INTERNAL_OPTIONS specifies to be acted on. + foreach my $package (getpackages()) { + if (! grep { $_ eq $package } @{$dh{DOPACKAGES}}) { + $exclude_package{$package}=1; + } + } + delete $dh{DOPACKAGES}; + delete $dh{DOINDEP}; + delete $dh{DOARCH}; + delete $dh{DOSAME}; + } + # DH_OPTIONS can contain additional options # to be parsed like @ARGV, but with unknown options # skipped. - my @ARGV_extra; if (defined $ENV{DH_OPTIONS}) { $ENV{DH_OPTIONS}=~s/^\s+//; $ENV{DH_OPTIONS}=~s/\s+$//; @@ -159,14 +188,6 @@ sub parseopts { } } - # DH_INTERNAL_OPTIONS is used to pass additional options from - # dh through an override target to a command. - if (defined $ENV{DH_INTERNAL_OPTIONS}) { - $ENV{DH_INTERNAL_OPTIONS}=~s/^\s+//; - $ENV{DH_INTERNAL_OPTIONS}=~s/\s+$//; - unshift @ARGV, split(/\s+/,$ENV{DH_INTERNAL_OPTIONS}); - } - my $ret=getoptions(\@ARGV, $options); if (!$ret) { warning("warning: unknown options will be a fatal error in a future debhelper release"); @@ -186,7 +207,7 @@ sub parseopts { if ($dh{DOINDEP} || $dh{DOARCH} || $dh{DOSAME}) { # User specified that all arch (in)dep package be # built, and there are none of that type. - warning("I have no package to build"); + warning("You asked that all arch in(dep) packages be built, but there are none of that type."); exit(0); } push @{$dh{DOPACKAGES}},getpackages(); @@ -208,9 +229,9 @@ sub parseopts { } @{$dh{DOPACKAGES}}=@package_list; - # If there are no packages to act on now, it's an error. if (! defined $dh{DOPACKAGES} || ! @{$dh{DOPACKAGES}}) { - error("I have no package to build"); + warning("No packages to build."); + exit(0); } if (defined $dh{U_PARAMS}) { |