[debhelper-devel] [debhelper] 01/01: Avoid some unnecessary stat calls

Niels Thykier nthykier at moszumanska.debian.org
Mon Jun 26 08:56:16 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 40a2c63119dbb4f2b91b9215037bae22f1b71d3a
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Jun 26 08:55:37 2017 +0000

    Avoid some unnecessary stat calls
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog | 3 +++
 dh_installdocs   | 2 +-
 dh_installman    | 6 +++---
 dh_strip         | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4069537..ed9c44c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,9 @@ debhelper (10.5.1) UNRELEASED; urgency=medium
   * Dh_Lib: Avoid 1-2 stat calls in make_symlink by reusing existing
     stat calls.
   * dh_installman: Avoid a fork+exec for renaming a path.
+  * dh_installdocs: Avoid unnecssary stat call.
+  * dh_installman: Ditto.
+  * dh_strip: Ditto.
 
  -- Niels Thykier <niels at thykier.net>  Sun, 25 Jun 2017 18:02:30 +0000
 
diff --git a/dh_installdocs b/dh_installdocs
index 465a74d..fd594ff 100755
--- a/dh_installdocs
+++ b/dh_installdocs
@@ -241,7 +241,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		install_dir($target_dir) unless -l $target_dir;
 		foreach my $doc (@docs) {
 			next if excludefile($doc);
-			next if -e $doc && ! -s $doc; # ignore empty files
+			next if -f $doc && ! -s _; # ignore empty files
 			ensure_docdir($package);
 			if (-d $doc && length $exclude) {
 				my $basename = basename($doc);
diff --git a/dh_installman b/dh_installman
index 49e58b9..899bd5a 100755
--- a/dh_installman
+++ b/dh_installman
@@ -209,7 +209,7 @@ on_selected_pkgs_in_parallel(\@all_packages, sub {
 			my $instpage = "$destdir$instname.$section";
 
 			next if -l $instpage;
-			next if compat(5) && -e $instpage;
+			next if compat(5) && -e _;
 
 			install_dir($destdir);
 			if ($gz) {
@@ -239,7 +239,7 @@ on_selected_pkgs_in_parallel(\@all_packages, sub {
 				next unless -e "$tmp/$dir";
 				my @files;
 				find(sub {
-						return if !-f $_ || -l $_;
+						return if -l $_ || ! -f _;
 						my ($tmp, $orig) = ($_.".new", $_);
 						complex_doit "man --recode UTF-8 ./\Q$orig\E > \Q$tmp\E";
 						# recode uncompresses compressed pages
@@ -260,7 +260,7 @@ on_selected_pkgs_in_parallel(\@all_packages, sub {
 sub find_so_man {
 	# The -s test is because a .so file tends to be small. We don't want
 	# to open every man page. 1024 is arbitrary.
-	if (! -f $_ || -s $_ > 1024 || -s == 0) {
+	if (! -f $_ || -s _ > 1024 || -s _ == 0) {
 		return;
 	}
 
diff --git a/dh_strip b/dh_strip
index a7efc2d..a05cf11 100755
--- a/dh_strip
+++ b/dh_strip
@@ -366,7 +366,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	if ($use_build_id > 1 and -d $debugtmp) {
 		my $dbgsym_docdir = "${debugtmp}/usr/share/doc";
 		my $doc_symlink = "${dbgsym_docdir}/${package}-dbgsym";
-		if ( not -l $doc_symlink and not -e $doc_symlink ) {
+		if ( not -l $doc_symlink and not -e _ ) {
 			install_dir($dbgsym_docdir);
 			make_symlink_raw_target($package, $doc_symlink);
 		}

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