diff options
author | Thierry Vignaud <tv@mageia.org> | 2011-07-27 10:27:02 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2011-07-27 10:27:02 +0000 |
commit | 7747ee1f6f2a7f21c089b3b1d28c31bdc6bc58f9 (patch) | |
tree | 69b47763fbbdab70dcfa3a13d5528cd990a15858 | |
parent | da65e2b625f7fadc173a6699c2622cc241f08be0 (diff) | |
download | drakx-7747ee1f6f2a7f21c089b3b1d28c31bdc6bc58f9.tar drakx-7747ee1f6f2a7f21c089b3b1d28c31bdc6bc58f9.tar.gz drakx-7747ee1f6f2a7f21c089b3b1d28c31bdc6bc58f9.tar.bz2 drakx-7747ee1f6f2a7f21c089b3b1d28c31bdc6bc58f9.tar.xz drakx-7747ee1f6f2a7f21c089b3b1d28c31bdc6bc58f9.zip |
move bootloader::cmp_kernel_versions() from bootloader to any for drakx-net (#1266)
-rw-r--r-- | perl-install/NEWS | 6 | ||||
-rw-r--r-- | perl-install/any.pm | 12 | ||||
-rw-r--r-- | perl-install/bootloader.pm | 16 |
3 files changed, 18 insertions, 16 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index 3278f562f..f98fc062a 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,7 @@ -- any.pm: Add lxsession to the wm list, and add lxde-logout as the - ask_window_manager_to_logout command (mga#1395) +- any.pm: + o Add lxsession to the wm list, and add lxde-logout as the + ask_window_manager_to_logout command (mga#1395) + o share some kernel check's code for drakx-net (#1266) Version 13.59 - 14 June 2011 Fix libnotify API ( mga #1780) diff --git a/perl-install/any.pm b/perl-install/any.pm index da0a0d37a..4fdcd745d 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -103,6 +103,18 @@ sub add_users { } } +sub cmp_kernel_versions { + my ($va, $vb) = @_; + my $rel_a = $va =~ s/-(.*)$// && $1; + my $rel_b = $vb =~ s/-(.*)$// && $1; + ($va, $vb) = map { [ split /[.-]/ ] } $va, $vb; + my $r = 0; + mapn_ { + $r ||= $_[0] <=> $_[1]; + } $va, $vb; + $r || $rel_a <=> $rel_b || $rel_a cmp $rel_b; +} + sub install_bootloader_pkgs { my ($do_pkgs, $b) = @_; diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index d5c6180f4..e9cd86b7c 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -653,18 +653,6 @@ sub _do_the_symlink { or cp_af("$::prefix/boot/$long_name", "$::prefix$link"); } -sub cmp_kernel_versions { - my ($va, $vb) = @_; - my $rel_a = $va =~ s/-(.*)$// && $1; - my $rel_b = $vb =~ s/-(.*)$// && $1; - ($va, $vb) = map { [ split /[.-]/ ] } $va, $vb; - my $r = 0; - mapn_ { - $r ||= $_[0] <=> $_[1]; - } $va, $vb; - $r || $rel_a <=> $rel_b || $rel_a cmp $rel_b; -} - # for lilo & xen sub get_mbootpack_filename { my ($entry) = @_; @@ -725,7 +713,7 @@ sub add_kernel { #- perImageAppend contains resume=/dev/xxx which we don't want @$dict = grep { $_->[0] ne 'resume' } @$dict; } - if (-e "$::prefix/sbin/udev" && cmp_kernel_versions($kernel_str->{version_no_ext}, '2.6.8') >= 0) { + if (-e "$::prefix/sbin/udev" && any::cmp_kernel_versions($kernel_str->{version_no_ext}, '2.6.8') >= 0) { log::l("it is a recent kernel, so we remove any existing devfs= kernel option to enable udev"); @$dict = grep { $_->[0] ne 'devfs' } @$dict; } @@ -920,7 +908,7 @@ sub get_kernel_labels { my ($kernels, $b_prefer_24) = @_; my @kernels_str = - sort { cmp_kernel_versions($b->{version_no_ext}, $a->{version_no_ext}) } + sort { any::cmp_kernel_versions($b->{version_no_ext}, $a->{version_no_ext}) } grep { -d "$::prefix/lib/modules/$_->{version}" } map { vmlinuz2kernel_str($_) } @$kernels; |