From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B879696F68 for ; Fri, 27 Jan 2023 11:41:48 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 956B573BB for ; Fri, 27 Jan 2023 11:41:18 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 27 Jan 2023 11:41:17 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 57654467BC for ; Fri, 27 Jan 2023 11:41:17 +0100 (CET) Date: Fri, 27 Jan 2023 11:41:06 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20230118135448.152425-1-l.nunner@proxmox.com> In-Reply-To: <20230118135448.152425-1-l.nunner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1674815875.i6y9hjxurd.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 2.630 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_HI -5 Sender listed at https://www.dnswl.org/, high trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, apt.pm] Subject: Re: [pve-devel] [PATCH manager] fix 4481: fetch changelogs for any Proxmox repository X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2023 10:41:48 -0000 On January 18, 2023 2:54 pm, Leo Nunner wrote: > 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. >=20 > Signed-off-by: Leo Nunner > --- > PVE/API2/APT.pm | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) >=20 > 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 =3Dsub { > $base =3D~ s!pool/updates/!pool/!; # for security channel > $changelog_url =3D "http://packages.debian.org/changelogs/$base/${s= rcpkg}_${pkgver}/changelog"; > } elsif ($origin eq 'Proxmox') { > - if ($component eq 'pve-enterprise') { > - $changelog_url =3D "https://enterprise.proxmox.com/debian/$base/${pkgn= ame}_${pkgver}.changelog"; > - } else { > - $changelog_url =3D "http://download.proxmox.com/debian/$base/${pkgname= }_${pkgver}.changelog"; > + my $data =3D Proxmox::RS::APT::Repositories::repositories("pve"); > + > + for my $file ($data->{files}->@*) { > + for my $repo ($file->{repositories}->@*) { > + if (join(" ", $repo->{Components}->@*) eq $component) { a few improvements possible here: - it should be enough that one of the components matches (e.g., I could hav= e pvetest and pve-no-subscription configured in a single entry) - this should only take enabled repositories into account - we should probably also compare the 'Site' member of $pkgfile toe the repository URL since $origin and $component also come from $pkgfile at the call sites, we = could maybe just pass in $pkgfile? other than that, this looks okay to me since our components all contain the product, so this allows differentiation :) > + $changelog_url =3D $repo->{URIs}[0] . "/$base/${pkgname}_${pkgver}.ch= angelog"; > + last; > + } > + } > } > } > } > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20