]> git.proxmox.com Git - pve-manager.git/commitdiff
api: apt: list_updates: fix dependency detection for virtual package
authorFabian Ebner <f.ebner@proxmox.com>
Thu, 3 Feb 2022 11:32:19 +0000 (12:32 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 4 Feb 2022 16:44:03 +0000 (17:44 +0100)
A virtual package does not have SelectedState Install, but the
dependency will still be satisfied if a package providing it has.

Fixes a bug, wrongly showing that postfix will be installed, when a
different mail-transport-agent is installed and a pve-manager update
is available:
https://forum.proxmox.com/threads/103413/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/API2/APT.pm

index 5344f5e89c5a781d19420952b7fdb67690760e21..dcd87c37786cdde7100ef41c425634bfae15b0b4 100644 (file)
@@ -195,6 +195,13 @@ my $update_pve_pkgstatus = sub {
                for my $d (@$deps) {
                    if ($d->{DepType} eq 'Depends') {
                        $found = $d->{TargetPkg}->{SelectedState} eq 'Install' if !$found;
+                       # need to check ProvidesList for virtual packages
+                       if (!$found && (my $provides = $d->{TargetPkg}->{ProvidesList})) {
+                           for my $provide ($provides->@*) {
+                               $found = $provide->{OwnerPkg}->{SelectedState} eq 'Install';
+                               last if $found;
+                           }
+                       }
                        $req = $d->{TargetPkg} if !$req;
 
                        if (!($d->{CompType} & AptPkg::Dep::Or)) {