Commit 9aac6297 authored by Dietmar Maurer's avatar Dietmar Maurer

implement better method to compute changelog url

apt-get uses similar code.
parent 8d8f6276
...@@ -3,6 +3,7 @@ package PVE::API2::APT; ...@@ -3,6 +3,7 @@ package PVE::API2::APT;
use strict; use strict;
use warnings; use warnings;
use File::stat (); use File::stat ();
use File::Basename;
use LWP::UserAgent; use LWP::UserAgent;
...@@ -73,15 +74,14 @@ my $get_changelug_url = sub { ...@@ -73,15 +74,14 @@ my $get_changelug_url = sub {
foreach my $verfile (@{$candidate_ver->{FileList}}) { foreach my $verfile (@{$candidate_ver->{FileList}}) {
my $pkgfile = $verfile->{File}; my $pkgfile = $verfile->{File};
my $origin = $pkgfile->{Origin}; my $origin = $pkgfile->{Origin};
my $comp = $pkgfile->{Component}; my $base = dirname($info->{FileName});
if ($origin && $comp) { if ($origin && $base) {
my $pkgver = $candidate_ver->{VerStr}; my $pkgver = $candidate_ver->{VerStr};
$pkgver =~ s/^\d+://; # strip epoch $pkgver =~ s/^\d+://; # strip epoch
my $srcpkg = $info->{SourcePkg} || $pkgname; my $srcpkg = $info->{SourcePkg} || $pkgname;
my $firstLetter = substr($srcpkg, 0, 1);
if ($origin eq 'Debian') { if ($origin eq 'Debian') {
$changelog_url = "http://packages.debian.org/changelogs/pool/$comp/" . $changelog_url = "http://packages.debian.org/changelogs/$base/" .
"$firstLetter/$srcpkg/${srcpkg}_$pkgver/changelog"; "${srcpkg}_$pkgver/changelog";
} }
last; last;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment