Package: debhelper
Version: 9.20151225
control: tags -1 + patch

Hi niel,

could you get a glimpse at this attemped patch ?

They are some failure on test suite that I could not fix

Bastien
diff --git a/dh_install b/dh_install
index 9288e86..d1b62ae 100755
--- a/dh_install
+++ b/dh_install
@@ -128,13 +128,13 @@ init(options => {
 	"autodest" => \$dh{AUTODEST},
 	"list-missing" => \$dh{LIST_MISSING},
 	"fail-missing" => \$dh{FAIL_MISSING},
-	"sourcedir=s" => \$dh{SOURCEDIR},	
+	"sourcedir=s@" => \$dh{SOURCEDIR},
 });
 
 my @installed;
 
-my $srcdir = '.';
-$srcdir = $dh{SOURCEDIR} if defined $dh{SOURCEDIR};
+my @srcdirs = ! compat(6) ? ('.','debian/tmp') : ('.');
+@srcdirs = $dh{SOURCEDIR} if defined $dh{SOURCEDIR};
 
 my $missing_files = 0;
 
@@ -173,17 +173,18 @@ foreach my $package (getpackages()) {
 		}
 
 		my @filelist;
-		foreach my $glob (@$set) {
-			my @found = glob "$srcdir/$glob";
-			if (! compat(6)) {
-				# Fall back to looking in debian/tmp.
-				if (! @found || ! (-e $found[0] || -l $found[0])) {
-					@found = glob "debian/tmp/$glob"
-						if $glob !~ m{^(?:\./)?debian/tmp/};
+		GLOB: foreach my $glob (@$set) {
+			my @found;
+			foreach my $srcdir (@srcdirs) {
+				if($srcdir eq '.') {
+					@found = glob "$srcdir/$glob";
+				} else {
+					@found = glob "$srcdir/$glob" if $glob !~ m{^(?:\./)?$srcdir};
+				}
+				if (@found && (-e $found[0] || -l $found[0])) {
+					push @filelist, @found;
+					next GLOB;
 				}
-			}
-			if (@found && (-e $found[0] || -l $found[0])) {
-				push @filelist, @found;
 			}
 		}
 
@@ -200,13 +201,17 @@ foreach my $package (getpackages()) {
 			
 			push @installed, $src;
 			next if $skip_install or $missing_files;
-		
+
 			if (! defined $dest) {
 				# Guess at destination directory.
-				$dest=$src;
-				$dest=~s/^(.*\/)?\Q$srcdir\E\///;
-				$dest=~s/^(.*\/)?debian\/tmp\///;
-				$dest=dirname("/".$dest);
+				$dest= $src;
+				$dest =~ s,^[.]/,,;
+				foreach my $srcdir (@srcdirs) {
+					$dest =~ s,^/?\Q$srcdir\E/,,;
+				}
+				# why next line ?
+				$dest =~ s,^/?debian/tmp/,,;
+				$dest=dirname('/'.$dest);
 				$tmpdest=1;
 			}
 
@@ -242,10 +247,9 @@ foreach my $package (getpackages()) {
 
 if ($dh{LIST_MISSING} || $dh{FAIL_MISSING}) {
 	# . as srcdir makes no sense, so this is a special case.
-	if ($srcdir eq '.') {
-		$srcdir='debian/tmp';
-	}
-	
+	my @missingsrcdirs = grep { $_ ne '.' } @srcdirs;
+	@missingsrcdirs = @missingsrcdirs || ('debian/tmp');
+
 	my @missing;
 	if ( -f 'debian/not-installed') {
 		# Pretend that these are also installed.
@@ -259,17 +263,19 @@ if ($dh{LIST_MISSING} || $dh{FAIL_MISSING}) {
 		"\Q$_\E\/.*|\Q$_\E";
 	} @installed);
 	$installed=qr{^($installed)$};
-	find(sub {
-		-f || -l || return;
-		$_="$File::Find::dir/$_";
-		if (! /$installed/ && ! excludefile($_)) {
-			my $file=$_;
-			$file=~s/^\Q$srcdir\E\///;
-			push @missing, $file;
-		}
-	}, $srcdir);
+	foreach my $srcdir (@missingsrcdirs) {
+		find(sub {
+			-f || -l || return;
+			$_="$File::Find::dir/$_";
+			if (! /$installed/ && ! excludefile($_)) {
+				my $file=$_;
+				$file=~s/^\Q$srcdir\E\///;
+				push @missing, ($file,$srcdir);
+			}
+			 }, $srcdir);
+	}
 	if (@missing) {
-		warning "$_ exists in $srcdir but is not installed to anywhere" foreach @missing;
+		warning "$_[0] exists in $_[1] but is not installed to anywhere" foreach @missing;
 		if ($dh{FAIL_MISSING}) {
 			error("missing files, aborting");
 		}

Reply via email to