[debhelper-devel] [debhelper] 03/08: dh_installman: Remove complex_doit calls

Niels Thykier nthykier at moszumanska.debian.org
Sun Jul 16 12:43:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch shell-out-less
in repository debhelper.

commit 7fe6fbcef731c97cd1e54563d821055f147e668d
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Jul 15 10:44:31 2017 +0000

    dh_installman: Remove complex_doit calls
    
    Avoid forking shells to start commands now that "doit" can do what we
    need.  This saves up to 10% on packages with many manpages during
    recode (tested on libssl-doc).
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog | 2 ++
 dh_installman    | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3915710..162aa78 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ debhelper (10.7) UNRELEASED; urgency=medium
     the tools have chdir to a different directory.
   * Dh_Lib: Support an optional hashref in doit + doit_* to enable some
     trivial operations in the child process (e.g. redirect stdout).
+  * dh_installman: Avoid forking a shell where a simple subprocess call
+    is sufficient.
 
  -- Niels Thykier <niels at thykier.net>  Sat, 15 Jul 2017 09:42:32 +0000
 
diff --git a/dh_installman b/dh_installman
index f61d7e6..a78f8c5 100755
--- a/dh_installman
+++ b/dh_installman
@@ -243,7 +243,7 @@ on_items_in_parallel(\@all_packages, sub {
 
 			install_dir($destdir);
 			if ($gz) {
-				complex_doit "zcat \Q$page\E > \Q$instpage\E";
+				doit({ stdout => $instpage }, 'zcat', $page);
 			}
 			else {
 				install_file($page, $instpage);
@@ -295,7 +295,7 @@ if (defined `man --version`) {
 			for my $manpage (@_) {
 				my $manpage_tmp = "${manpage}.dh-new";
 				my $manpage_cmd = ($manpage =~ m{^/}) ? $manpage : "./${manpage}";
-				complex_doit "man --recode UTF-8 \Q${manpage_cmd}\E > \Q$manpage_tmp\E";
+				doit({ stdout => $manpage_tmp }, 'man', '--recode', 'UTF-8', $manpage_cmd);
 				# recode uncompresses compressed pages
 				my $orig = $manpage;
 				rm_files($orig) if $manpage =~ s/\.(gz|Z)$//;

-- 
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