[debhelper-devel] [debhelper] 01/02: dh_installman: Batch chmod calls

Niels Thykier nthykier at moszumanska.debian.org
Sun Jun 4 12:07:08 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 582704c690753987caa1ee6d6eda5e742e46c39e
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Jun 4 11:31:21 2017 +0000

    dh_installman: Batch chmod calls
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog | 2 ++
 dh_installman    | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 5182ea7..dae3183 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ debhelper (10.5) UNRELEASED; urgency=medium
     lot slower.  Thanks to Kurt Roeckx for reporting it.
   * dh_installman: Fix wrong permission of man pages (set 0755 instead
     of 0644).  Regression introduced in 10.2.2.
+  * dh_installman: Batch chmod calls to reduce the overhead for
+    packages with many manpages.
 
  -- Niels Thykier <niels at thykier.net>  Sun, 04 Jun 2017 11:09:56 +0000
 
diff --git a/dh_installman b/dh_installman
index 0f29f3c..c7efe6b 100755
--- a/dh_installman
+++ b/dh_installman
@@ -234,15 +234,19 @@ foreach my $package (getpackages()) {
 	if (defined `man --version`) {
 		foreach my $dir (qw{usr/share/man}) {
 			next unless -e "$tmp/$dir";
+			my @files;
 			find(sub {
 				return if ! -f $_ || -l $_;
 				my ($tmp, $orig)=($_.".new", $_);
 				complex_doit "man --recode UTF-8 ./\Q$orig\E > \Q$tmp\E";
 				# recode uncompresses compressed pages
 				doit "rm", "-f", $orig if s/\.(gz|Z)$//;
-				doit('chmod', '0644', $tmp);
 				doit "mv", "-f", $tmp, $_;
+				# Schedule a permission reset
+				push(@files, "${File::Find::dir}/${_}");
 			}, "$tmp/$dir");
+			# Bulk reset permissions of all re-encoded files
+			xargs(\@files, 'chmod', '0644') if @files;
 		}
 	}
 }

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