[debhelper-devel] [debhelper] 01/01: Fix bug in handling of doc dirs

Niels Thykier nthykier at moszumanska.debian.org
Sat Sep 9 08:01:55 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 3e0d972f384084c1db51a38843a77d7048109dc2
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Sep 9 07:54:49 2017 +0000

    Fix bug in handling of doc dirs
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh_installdocs     | 7 ++++---
 dh_installexamples | 8 +++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dh_installdocs b/dh_installdocs
index 273b29d..8ffa4bf 100755
--- a/dh_installdocs
+++ b/dh_installdocs
@@ -283,7 +283,7 @@ foreach my $package (getpackages()) {
 		if ($dh{EXCLUDE_FIND}) {
 			$exclude .= ' -and ! \( '.$dh{EXCLUDE_FIND}.' \)';
 		}
-		my $target_dir = "usr/share/doc/$target_package";
+		my $target_dir = "${tmp}/usr/share/doc/${target_package}";
 		install_dir($target_dir) unless -l $target_dir;
 
 		foreach my $doc (@docs) {
@@ -295,13 +295,14 @@ foreach my $package (getpackages()) {
 				my $dir = ($basename eq '.') ? $doc : "$doc/..";
 				my $pwd=`pwd`;
 				chomp $pwd;
-				my $docdir = "${pwd}/${target_dir}";
+				# Gracefully handling tmpdir being absolute (-P/...)
+				my $docdir = $target_dir =~ m{^/} ? $target_dir : "${pwd}/${target_dir}";
 				complex_doit("cd '$dir' && " .
 							 "find '$basename' \\( -type f -or -type l \\)$exclude -print0 | LC_ALL=C sort -z | " .
 							 "xargs -0 -I {} cp --reflink=auto --parents -dp {} $docdir");
 			}
 			else {
-				doit("cp", '--reflink=auto', "-a", $doc, "${tmp}/${target_dir}");
+				doit("cp", '--reflink=auto', "-a", $doc, $target_dir);
 			}
 		}
 		doit("chown","-R","0:0","$tmp/usr/share/doc");
diff --git a/dh_installexamples b/dh_installexamples
index ac8b6f5..7547f87 100755
--- a/dh_installexamples
+++ b/dh_installexamples
@@ -138,7 +138,7 @@ foreach my $package (getpackages()) {
 			warning("Cannot auto-detect main package for ${package}.  If the default is wrong, please use --doc-main-package");
 			$target_package = $package;
 		}
-		my $target_dir = "usr/share/doc/${target_package}/examples";
+		my $target_dir = "${tmp}/usr/share/doc/${target_package}/examples";
 		install_dir($target_dir);
 
 		my $exclude = '';
@@ -152,12 +152,14 @@ foreach my $package (getpackages()) {
 				my $basename = basename($example);
 				my $dir = ($basename eq '.') ? $example : "$example/..";
 				chomp($pwd=`pwd`) if not defined($pwd);
+				# Gracefully handling tmpdir being absolute (-P/...)
+				my $destdir = $target_dir =~ m{^/} ? $target_dir : "${pwd}/${target_dir}";
 				complex_doit("cd '$dir' && " .
 							 "find '$basename' -type f$exclude -print0 | LC_ALL=C sort -z | " .
-							 "xargs -0 -I {} cp --reflink=auto --parents -dp {} ${pwd}/${target_dir}");
+							 "xargs -0 -I {} cp --reflink=auto --parents -dp {} ${destdir}");
 			}
 			else {
-				doit("cp", '--reflink=auto', "-a", $example, "${tmp}/${target_dir}");
+				doit("cp", '--reflink=auto', "-a", $example, $target_dir);
 			}
 		}
 	}

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