public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Leo Nunner <l.nunner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] fix 4481: fetch changelogs for any Proxmox repository
Date: Wed, 18 Jan 2023 14:54:48 +0100	[thread overview]
Message-ID: <20230118135448.152425-1-l.nunner@proxmox.com> (raw)

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





             reply	other threads:[~2023-01-18 13:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 13:54 Leo Nunner [this message]
2023-01-27 10:41 ` Fabian Grünbichler
2023-01-28 13:56   ` Thomas Lamprecht
2023-01-30 10:53     ` Leo Nunner

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=20230118135448.152425-1-l.nunner@proxmox.com \
    --to=l.nunner@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