mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 11:46:44 +00:00
fix #4481: fetch changelogs for any Proxmox repository
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>
This commit is contained in:
parent
7b668b16bb
commit
2bbfac1f45
@ -89,11 +89,16 @@ my $get_pkgfile = sub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
my $get_changelog_url =sub {
|
my $get_changelog_url =sub {
|
||||||
my ($pkgname, $info, $pkgver, $origin, $component) = @_;
|
my ($pkgname, $info, $pkgver, $pkgfile) = @_;
|
||||||
|
|
||||||
my $changelog_url;
|
my $changelog_url;
|
||||||
my $base;
|
my $base;
|
||||||
$base = dirname($info->{FileName}) if defined($info->{FileName});
|
$base = dirname($info->{FileName}) if defined($info->{FileName});
|
||||||
|
|
||||||
|
my $origin = $pkgfile->{Origin};
|
||||||
|
my $component = $pkgfile->{Component};
|
||||||
|
my $site = $pkgfile->{Site};
|
||||||
|
|
||||||
if ($origin && $base) {
|
if ($origin && $base) {
|
||||||
$pkgver =~ s/^\d+://; # strip epoch
|
$pkgver =~ s/^\d+://; # strip epoch
|
||||||
my $srcpkg = $info->{SourcePkg} || $pkgname;
|
my $srcpkg = $info->{SourcePkg} || $pkgname;
|
||||||
@ -101,10 +106,19 @@ my $get_changelog_url =sub {
|
|||||||
$base =~ s!pool/updates/!pool/!; # for security channel
|
$base =~ s!pool/updates/!pool/!; # for security channel
|
||||||
$changelog_url = "http://packages.debian.org/changelogs/$base/${srcpkg}_${pkgver}/changelog";
|
$changelog_url = "http://packages.debian.org/changelogs/$base/${srcpkg}_${pkgver}/changelog";
|
||||||
} elsif ($origin eq 'Proxmox') {
|
} elsif ($origin eq 'Proxmox') {
|
||||||
if ($component eq 'pve-enterprise') {
|
my $data = Proxmox::RS::APT::Repositories::repositories("pve");
|
||||||
$changelog_url = "https://enterprise.proxmox.com/debian/$base/${pkgname}_${pkgver}.changelog";
|
|
||||||
} else {
|
for my $file ($data->{files}->@*) {
|
||||||
$changelog_url = "http://download.proxmox.com/debian/$base/${pkgname}_${pkgver}.changelog";
|
for my $repo ($file->{repositories}->@*) {
|
||||||
|
if (
|
||||||
|
$repo->{Enabled}
|
||||||
|
&& grep(/$component/, $repo->{Components}->@*)
|
||||||
|
&& $repo->{URIs}[0] =~ m/$site/
|
||||||
|
) {
|
||||||
|
$changelog_url = $repo->{URIs}[0] . "/$base/${pkgname}_${pkgver}.changelog";
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +138,7 @@ my $assemble_pkginfo = sub {
|
|||||||
if (my $pkgfile = &$get_pkgfile($candidate_ver)) {
|
if (my $pkgfile = &$get_pkgfile($candidate_ver)) {
|
||||||
$data->{Origin} = $pkgfile->{Origin};
|
$data->{Origin} = $pkgfile->{Origin};
|
||||||
my $changelog_url = $get_changelog_url->(
|
my $changelog_url = $get_changelog_url->(
|
||||||
$pkgname, $info, $candidate_ver->{VerStr}, $pkgfile->{Origin}, $pkgfile->{Component});
|
$pkgname, $info, $candidate_ver->{VerStr}, $pkgfile);
|
||||||
|
|
||||||
$data->{ChangeLogUrl} = $changelog_url if $changelog_url;
|
$data->{ChangeLogUrl} = $changelog_url if $changelog_url;
|
||||||
}
|
}
|
||||||
@ -431,7 +445,7 @@ __PACKAGE__->register_method({
|
|||||||
my $url;
|
my $url;
|
||||||
|
|
||||||
die "changelog for '${pkgname}_$ver->{VerStr}' not available\n"
|
die "changelog for '${pkgname}_$ver->{VerStr}' not available\n"
|
||||||
if !($pkgfile && ($url = &$get_changelog_url($pkgname, $info, $ver->{VerStr}, $pkgfile->{Origin}, $pkgfile->{Component})));
|
if !($pkgfile && ($url = &$get_changelog_url($pkgname, $info, $ver->{VerStr}, $pkgfile)));
|
||||||
|
|
||||||
my $data = "";
|
my $data = "";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user