[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 2/2] Fix depwait handling following dose-builddebcheck conversion



In the presence of depwaits, the same source package may appear in both
%interesting_packages and %interesting_packages_depwait, leading to two
entries in dose-builddebcheck's input.  We must take care to keep these
distinct, otherwise dose-builddebcheck will fail.

This mostly restores previous name mangling which I had mistakenly
believed to be unnecessary when converting to dose-builddebcheck.
---
 bin/wanna-build | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/bin/wanna-build b/bin/wanna-build
index 9c1e161..2a6aeb1 100755
--- a/bin/wanna-build
+++ b/bin/wanna-build
@@ -1659,7 +1659,7 @@ sub explain_dose_dependency {
         $desc = 'depends on';
         $target = $dep->{'depends'};
     }
-    if ($pkg =~ s/^src://) {
+    if ($pkg =~ s/^src:(?:(?:source|depwait)---)?//) {
         return "$pkg build-$desc:\n- $target\n";
     } else {
         return "$pkg $desc:\n- $target\n";
@@ -1818,7 +1818,9 @@ sub call_dose_builddebcheck {
     my ($SOURCES, $tmpfile) = tempfile( $tmpfile_pattern, UNLINK => 1 );
     for my $key (keys %interesting_packages) {
 	my $pkg = $db->{$key};
-	print $SOURCES "Package: $key\n";
+	# Prefix "source---" to make sure these are distinct from depwaits;
+	# the same source package may be present in both.
+	print $SOURCES "Package: source---$key\n";
 	print $SOURCES "Version: $pkg->{'version'}\n";
         my $t = $srcs->{$key}{'dep'} || $srcs->{$key}{'depends'};
         my $tt = $pkg->{'extra_depends'};
@@ -1833,7 +1835,10 @@ sub call_dose_builddebcheck {
     }
     for my $key (keys %interesting_packages_depwait) {
 	my $pkg = $db->{$key};
-	print $SOURCES "Package: $key\n";
+	# Prefix "depwait---" to make sure these are distinct from
+	# non-depwait checks; the same source package may be present in
+	# both.
+	print $SOURCES "Package: depwait---$key\n";
 	print $SOURCES "Version: $pkg->{'version'}\n";
 	print $SOURCES "Build-Depends: $pkg->{'depends'}\n";
 	print $SOURCES "Architecture: all\n";
@@ -1844,17 +1849,19 @@ sub call_dose_builddebcheck {
     return if $simulate_dose;
     my $doseresults = wb_dose_builddebcheck({'arch' => $args->{'arch'}, 'pkgs' => $args->{'pkgs'}, 'src' => $tmpfile});
     if (ref($doseresults) eq 'HASH') {
-        foreach my $key (keys %$doseresults) {
-		my $found = 0;
+        foreach my $key (grep { $_ =~ /^source---/ } keys %$doseresults) {
+		$key =~ s/^source---//;
 		if (exists $interesting_packages{$key}) {
-		    $found = 1;
-		    $interesting_packages{$key} = $doseresults->{$key};
+		    $interesting_packages{$key} = $doseresults->{"source---".$key};
+		} else {
+		    #print "TODO: dose reported a package we do not care about now\n" if $verbose;
 		}
+        }
+        foreach my $key (grep { $_ =~ /^depwait---/ } keys %$doseresults) {
+		$key =~ s/^depwait---//;
 		if (exists $interesting_packages_depwait{$key}) {
-		    $found = 1;
-		    $interesting_packages_depwait{$key} = $doseresults->{$key};
-		}
-		unless ($found) {
+		    $interesting_packages_depwait{$key} = $doseresults->{"depwait---".$key};
+		} else {
 		    #print "TODO: dose reported a package we do not care about now\n" if $verbose;
 		}
         }
-- 
1.8.4.rc3


Reply to: