[pve-devel] [PATCH manager] fix 4481: fetch changelogs for any Proxmox repository

Leo Nunner l.nunner at proxmox.com
Wed Jan 18 14:54:48 CET 2023


This patch fixes the issue that when the user supplied any non-standard
repositories, the changelogs often wouldn't load. For example, providing
both pve-no-subscription and pbs-no-subscription broke the changelog
API, since the URL built for pbs-no-subscription was invalid.

Signed-off-by: Leo Nunner <l.nunner at proxmox.com>
---
 PVE/API2/APT.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index 09c76545..921b55a1 100644
--- a/PVE/API2/APT.pm
+++ b/PVE/API2/APT.pm
@@ -101,10 +101,15 @@ my $get_changelog_url =sub {
 	    $base =~ s!pool/updates/!pool/!; # for security channel
 	    $changelog_url = "http://packages.debian.org/changelogs/$base/${srcpkg}_${pkgver}/changelog";
 	} elsif ($origin eq 'Proxmox') {
-	    if ($component eq 'pve-enterprise') {
-		$changelog_url = "https://enterprise.proxmox.com/debian/$base/${pkgname}_${pkgver}.changelog";
-	    } else {
-		$changelog_url = "http://download.proxmox.com/debian/$base/${pkgname}_${pkgver}.changelog";
+	    my $data = Proxmox::RS::APT::Repositories::repositories("pve");
+
+	    for my $file ($data->{files}->@*) {
+		for my $repo ($file->{repositories}->@*) {
+		    if (join(" ", $repo->{Components}->@*) eq $component) {
+			$changelog_url = $repo->{URIs}[0] . "/$base/${pkgname}_${pkgver}.changelog";
+			last;
+		    }
+		}
 	    }
 	}
     }
-- 
2.30.2






More information about the pve-devel mailing list