[debhelper-devel] [debhelper] 02/03: dh_install: Refactor handling of autodest

Niels Thykier nthykier at moszumanska.debian.org
Mon Jun 26 13:17:51 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 3d8a18251a391e35eb674fa73b7fbe678c04dd9c
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Jun 26 13:04:52 2017 +0000

    dh_install: Refactor handling of autodest
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh_install | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/dh_install b/dh_install
index 4771233..61a4ce3 100755
--- a/dh_install
+++ b/dh_install
@@ -176,7 +176,6 @@ foreach my $package (getpackages()) {
 	
 	foreach my $set (@install) {
 		my $dest;
-		my $tmpdest=0;
 		
 		if (! defined $dh{AUTODEST} && @$set > 1) {
 			$dest=pop @$set;
@@ -227,18 +226,18 @@ foreach my $package (getpackages()) {
 		next if $skip_install or $missing_files;
 
 		foreach my $src (@filelist) {
-		
-			if (! defined $dest) {
+
+			my $target_dest = $dest;
+			if (! defined $$target_dest) {
 				# Guess at destination directory.
-				$dest=$src;
-				$dest=~s/^(.*\/)?\Q$srcdir\E\///;
-				$dest=~s/^(.*\/)?debian\/tmp\///;
-				$dest=dirname("/".$dest);
-				$tmpdest=1;
+				$target_dest = $src;
+				$target_dest =~ s/^(.*\/)?\Q$srcdir\E\///;
+				$target_dest =~ s/^(.*\/)?debian\/tmp\///;
+				$target_dest = dirname("/".$target_dest);
 			}
 
 			# Make sure the destination directory exists.
-			install_dir("$tmp/$dest");
+			install_dir("$tmp/$target_dest");
 
 			if (-d $src && $exclude) {
 				my $basename = basename($src);
@@ -247,19 +246,15 @@ foreach my $package (getpackages()) {
 				chomp $pwd;
 				complex_doit("cd '$dir' && " .
 							 "find '$basename' $exclude \\( -type f -or -type l \\) -print0 | LC_ALL=C sort -z | " .
-							 "xargs -0 -I {} cp --reflink=auto --parents -dp {} $pwd/$tmp/$dest/");
+							 "xargs -0 -I {} cp --reflink=auto --parents -dp {} $pwd/$tmp/$target_dest/");
 				# cp is annoying so I need a separate pass
 				# just for empty directories
 				complex_doit("cd '$dir' && " .
 							 "find '$basename' $exclude \\( -type d -and -empty \\) -print0 | LC_ALL=C sort -z | " .
-							 "xargs -0 -I {} cp --reflink=auto --parents -a {} $pwd/$tmp/$dest/");
+							 "xargs -0 -I {} cp --reflink=auto --parents -a {} $pwd/$tmp/$target_dest/");
 			}
 			else {
-				doit("cp", '--reflink=auto', "-a", $src, "$tmp/$dest/");
-			}
-
-			if ($tmpdest) {
-				$dest=undef;
+				doit("cp", '--reflink=auto', "-a", $src, "$tmp/$target_dest/");
 			}
 		}
 	}

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