all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] api: apt: list_updates: fix dependency detection for virtual package
@ 2022-02-03 11:32 Fabian Ebner
  2022-02-04 16:45 ` [pve-devel] applied: " Thomas Lamprecht
  2022-02-07  9:17 ` [pve-devel] " Fabian Ebner
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Ebner @ 2022-02-03 11:32 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH manager] api: apt: list_updates: fix dependency detection for virtual package
  2022-02-03 11:32 [pve-devel] [PATCH manager] api: apt: list_updates: fix dependency detection for virtual package Fabian Ebner
@ 2022-02-04 16:45 ` Thomas Lamprecht
  2022-02-07  9:17 ` [pve-devel] " Fabian Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2022-02-04 16:45 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Ebner

On 03.02.22 12:32, Fabian Ebner wrote:
> 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(+)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH manager] api: apt: list_updates: fix dependency detection for virtual package
  2022-02-03 11:32 [pve-devel] [PATCH manager] api: apt: list_updates: fix dependency detection for virtual package Fabian Ebner
  2022-02-04 16:45 ` [pve-devel] applied: " Thomas Lamprecht
@ 2022-02-07  9:17 ` Fabian Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Ebner @ 2022-02-07  9:17 UTC (permalink / raw)
  To: pve-devel

Am 03.02.22 um 12:32 schrieb Fabian Ebner:
> 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/
> 

Turns out the same issue is present in PMG and PBS.. I guess the plan is
to move the rest of the APT stuff from PBS to proxmox-apt, fix it there
and re-use the proxmox-apt implementation everywhere.

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-07  9:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 11:32 [pve-devel] [PATCH manager] api: apt: list_updates: fix dependency detection for virtual package Fabian Ebner
2022-02-04 16:45 ` [pve-devel] applied: " Thomas Lamprecht
2022-02-07  9:17 ` [pve-devel] " Fabian Ebner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal