diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Debian/Debhelper/DH/AddonAPI.pm | 6 | ||||
-rw-r--r-- | lib/Debian/Debhelper/DH/SequenceState.pm | 1 | ||||
-rw-r--r-- | lib/Debian/Debhelper/Dh_Lib.pm | 19 | ||||
-rw-r--r-- | lib/Debian/Debhelper/Sequence.pm | 5 | ||||
-rw-r--r-- | lib/Debian/Debhelper/SequencerUtil.pm | 1 |
5 files changed, 27 insertions, 5 deletions
diff --git a/lib/Debian/Debhelper/DH/AddonAPI.pm b/lib/Debian/Debhelper/DH/AddonAPI.pm index f8328e3..16d7498 100644 --- a/lib/Debian/Debhelper/DH/AddonAPI.pm +++ b/lib/Debian/Debhelper/DH/AddonAPI.pm @@ -143,12 +143,15 @@ sub insert_after { sub remove_command { my ($command) = @_; # Implement if actually needed (I *think* it basically means to transform dh_foo to dh_foo -a/-i) + # Remember to adapt the `commands_removed_by_sequence` logic to handle this one as well. _assert_not_conditional_sequence_addon('remove_command'); my @affected_sequences = _sequences_containing_cmd($command); @affected_sequences = _filter_sequences_for_conditional_add_ons(@affected_sequences); return 1 if not @affected_sequences; for my $seq (@affected_sequences) { - $seq->remove_command($command); + if ($seq->remove_command($command)) { + $Debian::Debhelper::DH::SequenceState::commands_removed_by_sequence{$command} = $DH_INTERNAL_ADDON_NAME; + } } return 1; } @@ -221,6 +224,7 @@ sub declare_command_obsolete { } _assert_not_conditional_sequence_addon('declare_command_obsolete'); $Debian::Debhelper::DH::SequenceState::obsolete_command{$command} = [$DH_INTERNAL_ADDON_NAME, $error_compat]; + $Debian::Debhelper::DH::SequenceState::commands_removed_by_sequence{$command} = ''; return 1; } diff --git a/lib/Debian/Debhelper/DH/SequenceState.pm b/lib/Debian/Debhelper/DH/SequenceState.pm index b029e01..539eced 100644 --- a/lib/Debian/Debhelper/DH/SequenceState.pm +++ b/lib/Debian/Debhelper/DH/SequenceState.pm @@ -21,6 +21,7 @@ our ( @options, # Options passed by name (to assist can_skip with which options are used) %seen_options, + %commands_removed_by_sequence, # Whether there were sequences of options that inhibit certain optimizations # * $unoptimizable_option_bundle => can skip iff cli-options hint is present and empty # * $unoptimizable_user_option => We can never skip anything (non-option seen) diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm index 720741f..cdc1686 100644 --- a/lib/Debian/Debhelper/Dh_Lib.pm +++ b/lib/Debian/Debhelper/Dh_Lib.pm @@ -248,6 +248,8 @@ our $DEB822_FIELD_REGEX = qr/ /xoa; our $PARSE_DH_SEQUENCE_INFO = 0; +# Safety valve for `dh_assistant`. Not intended for anyone else. +our $ALLOW_UNSAFE_EXECUTION = 1; # We need logging in compat 9 or in override/hook targets (for --remaining-packages to work) # - This option is a global toggle to disable logs for special commands (e.g. dh or dh_clean) @@ -970,7 +972,7 @@ my ($compat_from_bd, $compat_from_dctrl); $delared_compat_source = "Build-Depends: debhelper-compat (= $c)"; } elsif ($compat_from_dctrl != -1) { $c = $compat_from_dctrl; - $delared_compat_source = "X-DH-Comat: $c"; + $delared_compat_source = "X-DH-Compat: $c"; } elsif (not $nowarn) { # d/compat deliberately omitted since we do not want to recommend users to it. error("Please specify the compatibility level in debian/control. Such as, via Build-Depends: debhelper-compat (= X)"); @@ -1121,8 +1123,15 @@ sub default_sourcedir { ); } push(@try, "debian/$package.$filename"); + my $nameless_variant = "debian/$filename"; + if (defined $dh{NAME} and not compat(13) and -f $nameless_variant) { + warning('The use of prefix-less debhelper config files with --name is deprecated.'); + warning("Please rename \"${nameless_variant}\" to \"debian/$dh{MAINPACKAGE}.${filename}\""); + error("Named prefix-less debhelper config files is not supported in compat 15 and later") + if not compat(14); + warning('Named prefix-less debhelper config files will trigger an error in compat 15 or later'); + } if ($nameless_variant_handling or (not defined($nameless_variant_handling) and $package eq $dh{MAINPACKAGE})) { - my $nameless_variant = "debian/$filename"; push(@try, $nameless_variant); if (getpackages() > 1 and not $nameless_variant_handling and not compat(13) and -f $nameless_variant) { warning('The use of prefix-less debhelper config files is deprecated.'); @@ -3286,4 +3295,10 @@ sub _internal_optional_file_args { return; } +sub assert_unsafe_execution_is_ok { + if (not $Debian::Debhelper::Dh_Lib::ALLOW_UNSAFE_EXECUTION) { + error("Internal error: The command did not want to allow unsafe execution, but was about to trigger it!"); + } +} + 1 diff --git a/lib/Debian/Debhelper/Sequence.pm b/lib/Debian/Debhelper/Sequence.pm index ba627f4..cefa4f7 100644 --- a/lib/Debian/Debhelper/Sequence.pm +++ b/lib/Debian/Debhelper/Sequence.pm @@ -74,8 +74,9 @@ sub _insert { sub remove_command { my ($this, $command) = @_; - $this->{'_cmds'} = [grep { $_->{'command'} ne $command } @{$this->{'_cmds'}}]; - return; + my $cmds = $this->{'_cmds'}; + $this->{'_cmds'} = [grep { $_->{'command'} ne $command } @{$cmds}]; + return scalar(@{$this->{'_cmds'}}) < scalar(@{$cmds}); } sub add_command_at_start { diff --git a/lib/Debian/Debhelper/SequencerUtil.pm b/lib/Debian/Debhelper/SequencerUtil.pm index 2fe5824..b01e920 100644 --- a/lib/Debian/Debhelper/SequencerUtil.pm +++ b/lib/Debian/Debhelper/SequencerUtil.pm @@ -228,6 +228,7 @@ sub rules_explicit_target { my ($target) = @_; if (! $RULES_PARSED) { + Debian::Debhelper::Dh_Lib::assert_unsafe_execution_is_ok(); my $processing_targets = 0; my $not_a_target = 0; my $current_target; |