[debhelper-devel] [debhelper] 01/01: Dh_Lib: Fix regression of --no-act
Niels Thykier
nthykier at moszumanska.debian.org
Sun Oct 8 09:56:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit f74e7a5fb9376573c0ab980f2446a251a3ed4712
Author: Niels Thykier <niels at thykier.net>
Date: Sun Oct 8 09:55:32 2017 +0000
Dh_Lib: Fix regression of --no-act
Signed-off-by: Niels Thykier <niels at thykier.net>
---
debian/changelog | 2 ++
lib/Debian/Debhelper/Dh_Lib.pm | 32 ++++++++++++++++++--------------
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ac38fb6..0302a1e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,8 @@ debhelper (10.9.1) UNRELEASED; urgency=medium
possibly replace regular units).
* dh_systemd_enable: Drop versioned dependency on
init-system-helpers that is satisfied in oldstable.
+ * Dh_Lib: Fix regression where --no-act would actually create
+ maintscript snippets.
[ Dmitry Shachnev ]
* qmake.pm: Add basic cross-building support. (Closes: #877357)
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 9c5ca65..e71d8e1 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -915,16 +915,18 @@ sub autoscript {
# Add fragments to top so they run in reverse order when removing.
if (not defined($sed) or ref($sed)) {
verbose_print("[META] Prepend autosnippet \"$filename\" to $script [${outfile}.new]");
- open(my $out_fd, '>', "${outfile}.new") or error("open(${outfile}.new): $!");
- print {$out_fd} '# Automatically added by ' . basename($0) . "/${tool_version}\n";
- autoscript_sed($sed, $infile, undef, $out_fd);
- print {$out_fd} "# End automatically added section\n";
- open(my $in_fd, '<', $outfile) or error("open($outfile): $!");
- while (my $line = <$in_fd>) {
- print {$out_fd} $line;
+ if (not $dh{NO_ACT}) {
+ open(my $out_fd, '>', "${outfile}.new") or error("open(${outfile}.new): $!");
+ print {$out_fd} '# Automatically added by ' . basename($0) . "/${tool_version}\n";
+ autoscript_sed($sed, $infile, undef, $out_fd);
+ print {$out_fd} "# End automatically added section\n";
+ open(my $in_fd, '<', $outfile) or error("open($outfile): $!");
+ while (my $line = <$in_fd>) {
+ print {$out_fd} $line;
+ }
+ close($in_fd);
+ close($out_fd) or error("close(${outfile}.new): $!");
}
- close($in_fd);
- close($out_fd) or error("close(${outfile}.new): $!");
} else {
complex_doit("echo \"# Automatically added by ".basename($0)."/${tool_version}\"> $outfile.new");
autoscript_sed($sed, $infile, "$outfile.new");
@@ -934,11 +936,13 @@ sub autoscript {
rename_path("${outfile}.new", $outfile);
} elsif (not defined($sed) or ref($sed)) {
verbose_print("[META] Append autosnippet \"$filename\" to $script [${outfile}]");
- open(my $out_fd, '>>', $outfile) or error("open(${outfile}): $!");
- print {$out_fd} '# Automatically added by ' . basename($0) . "/${tool_version}\n";
- autoscript_sed($sed, $infile, undef, $out_fd);
- print {$out_fd} "# End automatically added section\n";
- close($out_fd) or error("close(${outfile}): $!");
+ if (not $dh{NO_ACT}) {
+ open(my $out_fd, '>>', $outfile) or error("open(${outfile}): $!");
+ print {$out_fd} '# Automatically added by ' . basename($0) . "/${tool_version}\n";
+ autoscript_sed($sed, $infile, undef, $out_fd);
+ print {$out_fd} "# End automatically added section\n";
+ close($out_fd) or error("close(${outfile}): $!");
+ }
} else {
complex_doit("echo \"# Automatically added by ".basename($0)."/${tool_version}\">> $outfile");
autoscript_sed($sed, $infile, $outfile);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list