- $ENV{DH_INTERNAL_OPTIONS}=~s/^\s+//;
- $ENV{DH_INTERNAL_OPTIONS}=~s/\s+$//;
- unshift @ARGV, split(/\s+/,$ENV{DH_INTERNAL_OPTIONS});
+ @ARGV_extra=split(/\x1e/, $ENV{DH_INTERNAL_OPTIONS});
+ getoptions(\@ARGV_extra, %params);
+
+ # 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, but when
+ # nothing is specified, the excludes will cause the set of
+ # packages DH_INTERNAL_OPTIONS specifies to be acted on.
+ if (defined $dh{DOPACKAGES}) {
+ foreach my $package (getpackages()) {
+ if (! grep { $_ eq $package } @{$dh{DOPACKAGES}}) {
+ $exclude_package{$package}=1;
+ }
+ }
+ }
+ delete $dh{DOPACKAGES};
+ delete $dh{DOINDEP};
+ delete $dh{DOARCH};
+ }
+
+ # DH_OPTIONS can contain additional options to be parsed like @ARGV
+ if (defined $ENV{DH_OPTIONS}) {
+ @ARGV_extra=split_options_string($ENV{DH_OPTIONS});
+ my $ret=getoptions(\@ARGV_extra, %params);
+ if (!$ret) {
+ warning("warning: ignored unknown options in DH_OPTIONS");
+ }