public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Luke Harding <luke@lukeh990.io>
To: pve-devel@lists.proxmox.com
Cc: Luke Harding <luke@lukeh990.io>
Subject: [pve-devel] [PATCH dab 4/7] Change closure algorithm to use an alternate package if the most preferred candidate fails.
Date: Tue, 18 Nov 2025 17:01:19 -0500	[thread overview]
Message-ID: <20251118220122.61257-5-luke@lukeh990.io> (raw)
In-Reply-To: <20251118220122.61257-1-luke@lukeh990.io>

Signed-off-by: Luke Harding <luke@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


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-11-18 22:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 22:01 [pve-devel] [PATCH dab 0/7] Improvements to DAB; Support Devuan 6.0 Luke Harding
2025-11-18 22:01 ` [pve-devel] [PATCH dab 1/7] Add a '--no-ssh' option to dab bootstrap to disable ssh packages that are automatically included Luke Harding
2025-11-18 22:01 ` [pve-devel] [PATCH dab 2/7] Add origin for devuan suites Luke Harding
2025-11-18 22:01 ` [pve-devel] [PATCH dab 3/7] Add devuan "Excalibur" 6.0 suite Luke Harding
2025-11-18 22:01 ` Luke Harding [this message]
2025-11-18 22:01 ` [pve-devel] [PATCH dab 5/7] Add new `[--mta <postfix|exim|none>]` flag; Deprecate --exim Luke Harding
2025-11-18 22:01 ` [pve-devel] [PATCH dab 7/7] Bump version to 3.8.0 Luke Harding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251118220122.61257-5-luke@lukeh990.io \
    --to=luke@lukeh990.io \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal