[pve-devel] applied: [PATCH v2 manager] pveversion: sort kernel packages by version

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Feb 16 11:18:13 CET 2018


applied

On 2/16/18 10:49 AM, Fabian Grünbichler wrote:
> instead of lexically by package name
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at 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
> 






More information about the pve-devel mailing list