instead of lexically by package name Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> --- restructured for readability removed redundant sort
PVE/API2/APT.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm index d0e3d4bd..1199c204 100644 --- a/PVE/API2/APT.pm +++ b/PVE/API2/APT.pm @@ -24,8 +24,8 @@ use JSON; use PVE::JSONSchema qw(get_standard_option); use AptPkg::Cache; -use AptPkg::Version; use AptPkg::PkgRecords; +use Dpkg::Version; my $get_apt_cache = sub { @@ -521,7 +521,8 @@ __PACKAGE__->register_method({ # order most important things first my @list = qw(proxmox-ve pve-manager); - push @list, grep { /^pve-kernel-/ && $cache->{$_}->{CurrentState} eq 'Installed' } sort keys %$cache; + my $byver = sub { version_compare($cache->{$b}->{CurrentVer}->{VerStr}, $cache->{$a}->{CurrentVer}->{VerStr}) }; + push @list, sort $byver grep { /^pve-kernel-/ && $cache->{$_}->{CurrentState} eq 'Installed' } keys %$cache; my @opt_pack = qw( ceph -- 2.14.2 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel