[debhelper-devel] [debhelper] 02/02: Avoid some unnecessary shells from qx

Niels Thykier nthykier at moszumanska.debian.org
Mon Aug 7 19:16:43 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 5332dc6aaffdc921d7494cfcae1435f43fca1678
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Aug 7 19:14:47 2017 +0000

    Avoid some unnecessary shells from qx
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog    | 4 ++++
 dh_compress         | 2 +-
 dh_gconf            | 3 ++-
 dh_installgsettings | 4 +++-
 dh_perl             | 2 +-
 5 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0fd218f..188866d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,10 @@ debhelper (10.7.3) UNRELEASED; urgency=medium
   * dh_installexamples: Ditto.
   * dh_installinfo: Ditto.
   * dh_installman: Ditto.
+  * dh_compress: Avoid forking a shell for a find command.
+  * dh_gconf: Ditto.
+  * dh_installgsettings: Ditto.
+  * dh_perl: Avoid forking a shell for a dpkg call.
 
  -- Niels Thykier <niels at thykier.net>  Thu, 03 Aug 2017 19:30:01 +0000
 
diff --git a/dh_compress b/dh_compress
index a0000d0..3858c46 100755
--- a/dh_compress
+++ b/dh_compress
@@ -203,7 +203,7 @@ on_pkgs_in_parallel {
 		chdir($olddir);
 
 		# Fix up symlinks that were pointing to the uncompressed files.
-		my %links = map { chomp; $_ => 1 } `find $tmp -type l`;
+		my %links = map { chomp; $_ => 1 } qx_cmd('find', $tmp, '-type', 'l');
 		my $changed;
 		# Keep looping through looking for broken links until no more
 		# changes are made. This is done in case there are links pointing
diff --git a/dh_gconf b/dh_gconf
index ba8f51a..74c04a3 100755
--- a/dh_gconf
+++ b/dh_gconf
@@ -90,7 +90,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
 	if (-d "$new_schemas_dir") {
 		# Get a list of the schemas
-		my $schemas = `find $new_schemas_dir -type f -name \\*.schemas -printf '%P '`;
+		my $schemas = qx_cmd('find', $new_schemas_dir, '-type', 'f', '-name', '*.schemas',
+							 '-printf', '%P');
 		if ($schemas ne '') {
 			addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)");
 		}
diff --git a/dh_installgsettings b/dh_installgsettings
index db0d103..faedcb7 100755
--- a/dh_installgsettings
+++ b/dh_installgsettings
@@ -78,7 +78,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
 	if (-d "$gsettings_schemas_dir") {
 		# Get a list of the schemas
-		my $schemas = `find $gsettings_schemas_dir -type f \\( -name \\*.xml -o -name \\*.override \\) -printf '%P '`;
+		my $schemas = qx_cmd('find', $gsettings_schemas_dir, '-type', 'f',
+							 '(', '-name', '*.xml', '-o', '-name', '*.override',
+							 ')', '-printf', '%P');
 		if ($schemas ne '') {
 			addsubstvar($package, "misc:Depends", "dconf-gsettings-backend | gsettings-backend");
 		}
diff --git a/dh_perl b/dh_perl
index b536099..8e1e603 100755
--- a/dh_perl
+++ b/dh_perl
@@ -123,7 +123,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	if ($deps) {
 		my $version="";
 		if ($deps & XS_MODULE or $dh{V_FLAG_SET}) {
-			($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m
+			($version) = qx_cmd('dpkg', '-s', $perl) =~ /^Version:\s*(\S+)/m
 				unless $version;
 			$version = ">= $version";
 		}

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