summaryrefslogtreecommitdiffstats
path: root/perl-install/common.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-03-12 19:31:03 +0000
committerThierry Vignaud <tv@mageia.org>2012-03-12 19:31:03 +0000
commit95e031578306cf1ef7656404d3e2b49db80497f4 (patch)
treea96c4252a6cc3b13ea2f5f911af4318390df1f9a /perl-install/common.pm
parent7dd226f80f477a768b808a4efe761f78c345c247 (diff)
downloaddrakx-95e031578306cf1ef7656404d3e2b49db80497f4.tar
drakx-95e031578306cf1ef7656404d3e2b49db80497f4.tar.gz
drakx-95e031578306cf1ef7656404d3e2b49db80497f4.tar.bz2
drakx-95e031578306cf1ef7656404d3e2b49db80497f4.tar.xz
drakx-95e031578306cf1ef7656404d3e2b49db80497f4.zip
(cmp_kernel_versions) move it from any.pm to common.pm; thus preventing lazy loading of syscall.ph through
any->detect_devices>modules>list_modules>MDK::Common>MDK::Common::System>syscall.ph This can end in crashing mgaaplet when performing live update (mga#3042) because of lazy loading of syscall (by which time perl may as well have been updated including syscall.ph which leave eg perl/5.12.x for perl/5.14.x) This also saves quite some memory for: - net_applet (5Mb aka 11%), - mgapplet (7Mb aka 14%) (as well as maybe for drakxnet but that's more transient): 21736 root 20 0 240m 44m 10m S 0 1.1 0:00.63 net_applet 21501 root 20 0 236m 39m 11m S 0 1.0 0:01.09 net_applet 23116 root 20 0 297m 50m 12m S 0 1.3 0:00.58 mgaapplet 23259 root 20 0 290m 43m 12m S 0 1.1 0:00.40 mgaapplet
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r--perl-install/common.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index adaa07a0d..7aea9bc17 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -488,4 +488,16 @@ sub update_gnomekderc_no_create {
}
}
+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;
+}
+
1;