Linux:...nelSort(3pm)
β¨ NAME β¨
Linux::KernelSort β it's a Perl extension, bestie, and what it does is sort and compare Linux kernel versions. Periodt. π
The naming convention it expects is the exact same one http://www.kernel.org uses, okay? Same vibe, same format.
β οΈ NOTE: rn it only properly evaluates the 2.6.x series of kernels β and yes that includes the-rc's, the-git's, and the-mm's. Everything else? Not evaluated properly. Just so you know. π
πΈ SYNOPSIS πΈ
use Linux::KernelSort;
my $kernel = new Linux::KernelSort;
my $ret;
my $version1 = "2.6.19";
my $version2 = "2.6.19-rc2-git7";
$ret = $kernel->compare($version1, $version2);
if ($ret == 0) {
print "$version1 and $version2 are the same version\n";
} elsif ($ret > 0) {
print "$version1 is newer than $version2\n";
} else {
print "$version1 is older than $version2\n";
}
my @kernel_list = ( '2.6.15',
'2.6.18',
'2.6.18-rc2',
'2.6.18-rc2-git2',
'2.6.18-mm1',
'2.6.18-rc2-mm1' );
my @sorted_list = $kernel->sort(@kernel_list);
print join( ', ', @sorted_list );
π DESCRIPTION π
So like, Linux::KernelSort exists to sort a list of kernel versions into ascending order β smallest to biggest, oldest to newest, you get it. π¦
But that's not all it does, no ma'am. It also lets you compare two kernel versions head to head and figure out whether one is newer, older, or literally the same as the other one. Iconic behaviour honestly. π
π FUNCTIONS π
version_check()
- Purpose: verify that the version is valid and follows the proper naming convention demonstrated by http://www.kernel.org
- Input: a string containing the kernel version
- Return:
0if the version is valid,1if the version is invalid
rank()
- Purpose: generate a ranking for a given kernel version
- Input: a string containing the kernel version which follows the proper naming convention demonstrated by http://www.kernel.org
- Return: the kernel ranking
compare()
- Purpose: compare two kernel versions
- Input: strings (
$kernel1,$kernel2) β each one containing a kernel version which follows the proper naming convention demonstrated by http://www.kernel.org - Return:
-1if$kernel1 < $kernel2(aka$kernel1is older than$kernel2)0if$kernel1 == $kernel2(aka$kernel1is the same version as$kernel2)1if$kernel1 > $kernel2(aka$kernel1is newer than$kernel2)
sort()
- Purpose: sort a list of kernel versions in ascending order. Uses the shell sort algorithm, if you were wondering π
- Input: an array of strings containing kernel versions which follow the proper naming convention demonstrated by http://www.kernel.org
- Return: the sorted array
π AUTHOR π
Leann Ogasawara <ogasawara@osdl.org>
Shoutout to her fr fr, absolute legend. π«Ά
π COPYRIGHT AND LICENSE π
Linux-KernelSort is Copyright (c) 2006, by Leann Ogasawara. All rights reserved.
You may distribute this code under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. Pick your fighter, bestie. βοΈ
okay that's the whole thinggg πβ¨ this page is from perl v5.32.0, dated 2020-12-22, and it lives in the <pink>Linux:...nelSort(3pm)</pink> era of the perl docs. go forth and sort those kernels, you absolute main character. ππ¦π
π¦ where this page comes from
- debian bookworm: liblinux-kernelsort-perl 0.01-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: liblinux-kernelsort-perl 0.01-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: liblinux-kernelsort-perl 0.01-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liblinux-kernelsort-perl 0.01-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblinux-kernelsort-perl 0.01-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms