summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2017-06-26 11:56:35 +0000
committerNiels Thykier <niels@thykier.net>2017-06-26 12:02:13 +0000
commitf9999ffaa5995ebef7cc9c5dc1dc7efc10bb5604 (patch)
tree212fd5f7a1512b1fce11fe73429b1730557621c0
parent71dabb453dcd32e5822253a5760875e5304a9e9e (diff)
downloaddebhelper-f9999ffaa5995ebef7cc9c5dc1dc7efc10bb5604.tar.gz
dh_installman: Split manpages between processes
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog3
-rwxr-xr-xdh_installman62
2 files changed, 45 insertions, 20 deletions
diff --git a/debian/changelog b/debian/changelog
index 75726f1f..9c192deb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,9 @@ debhelper (10.5.1) UNRELEASED; urgency=medium
* dh_shlibdeps: Fix a regression where non-detached debug symbol files
where not properly processed. Thanks to Sven Joachim for reporting
the issue. (Closes: #865982)
+ * dh_installman: When re-encoding manpages, use the actual manpages as
+ tasks to split rather than packages. This provides a much better
+ performance if the manpages are unevenly split between the packages.
-- Niels Thykier <niels@thykier.net> Sun, 25 Jun 2017 18:02:30 +0000
diff --git a/dh_installman b/dh_installman
index 236774fe..930152fd 100755
--- a/dh_installman
+++ b/dh_installman
@@ -232,30 +232,52 @@ on_items_in_parallel(\@all_packages, sub {
rm_files($sofile);
make_symlink_raw_target($sodest, $sofile);
}
-
- # Now utf-8 conversion.
- if (defined `man --version`) {
- foreach my $dir (qw{usr/share/man}) {
- next unless -e "$tmp/$dir";
- my @files;
- find(sub {
- return if -l $_ || ! -f _;
- my ($tmp, $orig) = ($_.".new", $_);
- complex_doit "man --recode UTF-8 ./\Q$orig\E > \Q$tmp\E";
- # recode uncompresses compressed pages
- rm_files($orig) if s/\.(gz|Z)$//;
- rename_path($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;
- }
- }
}
});
+# Now utf-8 conversion.
+if (defined `man --version`) {
+ my (@manpages_to_reencode, @issues);
+ for my $package (@{$dh{DOPACKAGES}}) {
+ next if is_udeb($package);
+ my $tmp = tmpdir($package);
+ foreach my $dir (qw{usr/share/man}) {
+ next unless -e "$tmp/$dir";
+ find(sub {
+ return if -l $_ || !-f _;
+ if ($_ =~ m/\.dh-new$/) {
+ push(@issues, "${File::Find::dir}/${_}");
+ return;
+ }
+ push(@manpages_to_reencode, "${File::Find::dir}/${_}");
+ }, "$tmp/$dir");
+ }
+ if (@issues) {
+ warning("Removing temporary manpages from another dh_installman instance");
+ rm_files(@issues);
+ warning("Possibly race-condition detected or left-overs from an interrupted dh_installman (e.g. with ^C)");
+ error("Please ensure there are no parallel dh_installman's running (for this pkg) and then re-run dh_installman");
+ }
+ }
+ if (@manpages_to_reencode) {
+ on_items_in_parallel(\@manpages_to_reencode, sub {
+ for my $manpage (@_) {
+ my $manpage_tmp = "${manpage}.dh-new";
+ complex_doit "man --recode UTF-8 ./\Q$manpage\E > \Q$manpage_tmp\E";
+ # recode uncompresses compressed pages
+ rm_files($manpage) if $manpage =~ s/\.(gz|Z)$//;
+ rename_path($manpage_tmp, $manpage);
+ }
+ # Bulk reset permissions of all re-encoded files
+ xargs(\@_, 'chmod', '0644', '--');
+ });
+ }
+} else {
+ # Should only occur during debhelper building itself (to avoid a B-D on man-db).
+ warning("man is not available. Skipping re-encode of UTF-8 manpages")
+}
+
# Check if a file is a .so man page, for use by File::Find.
sub find_so_man {
# The -s test is because a .so file tends to be small. We don't want