public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] api: apt: list_updates: fix dependency detection for virtual package
Date: Thu,  3 Feb 2022 12:32:19 +0100	[thread overview]
Message-ID: <20220203113219.119833-1-f.ebner@proxmox.com> (raw)

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>
---

Note for testers: the API call uses a cache.

 PVE/API2/APT.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index 5344f5e8..dcd87c37 100644
--- a/PVE/API2/APT.pm
+++ b/PVE/API2/APT.pm
@@ -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)) {
-- 
2.30.2





             reply	other threads:[~2022-02-03 11:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 11:32 Fabian Ebner [this message]
2022-02-04 16:45 ` [pve-devel] applied: " Thomas Lamprecht
2022-02-07  9:17 ` [pve-devel] " Fabian Ebner

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=20220203113219.119833-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --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