[pve-devel] [PATCH dab 4/7] Change closure algorithm to use an alternate package if the most preferred candidate fails.

Luke Harding luke at lukeh990.io
Tue Nov 18 23:01:19 CET 2025


Signed-off-by: Luke Harding <luke at lukeh990.io>
---
 PVE/DAB.pm | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/PVE/DAB.pm b/PVE/DAB.pm
index da117c0..8b93c1b 100644
--- a/PVE/DAB.pm
+++ b/PVE/DAB.pm
@@ -1207,19 +1207,30 @@ sub __closure_single {
 	  }
       }
       # search for non-excluded alternative
-      my $found;
+      my $success;
       foreach my $p1 (@l1) {
-	  if ($p1 =~ m/^\s*(\S+).*/) {
-	      next if grep { $1 eq $_ } @$excl;
-	      $found = $1;
-	      last;
-	  }
+          next unless $p1 =~ /^\s*(\S+)/;
+          my $candidate = $1;
+
+          next if grep { $candidate eq $_ } @$excl;
+
+          #print STDERR "$pname: trying $candidate for '$p'\n";
+
+          my $ok = eval {
+              __closure_single($pkginfo, $closure, $pkghash, $pkglist, $candidate, $excl);
+              1;
+          };
+
+          if ($ok) {
+              $success = 1;
+              last;
+          } else {
+              print STDERR "$pname: $candidate failed, trying next alternative...\n";
+          }
       }
-      die "package '$pname' depends on exclusion '$p'\n" if !$found;
 
-      #printf (STDERR "$pname: $p --> $found\n");
-	  
-      __closure_single ($pkginfo, $closure, $pkghash, $pkglist, $found, $excl);
+      die "package '$pname' could not satisfy dependency '$p' (all alternatives failed)\n"
+          unless $success;
   }
 }
 
-- 
2.52.0




More information about the pve-devel mailing list