diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-04-02 20:53:11 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-04-02 20:53:11 +0000 |
commit | b058df0c834dc8d2ed4235a74fc562e57b1f9273 (patch) | |
tree | 4d7f0e8f280381709980eb1c59449ef96b0551b8 /lib/Iurt/DKMS.pm | |
parent | 68f8cbf92e0d027708a51c34cab7e08c9b873f99 (diff) | |
download | iurt-b058df0c834dc8d2ed4235a74fc562e57b1f9273.tar iurt-b058df0c834dc8d2ed4235a74fc562e57b1f9273.tar.gz iurt-b058df0c834dc8d2ed4235a74fc562e57b1f9273.tar.bz2 iurt-b058df0c834dc8d2ed4235a74fc562e57b1f9273.tar.xz iurt-b058df0c834dc8d2ed4235a74fc562e57b1f9273.zip |
use better algorithm to prefer devel packages over source packages
and to handle contrib kernels correctly
Diffstat (limited to 'lib/Iurt/DKMS.pm')
-rw-r--r-- | lib/Iurt/DKMS.pm | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/Iurt/DKMS.pm b/lib/Iurt/DKMS.pm index e7a1abf..4d4b3e6 100644 --- a/lib/Iurt/DKMS.pm +++ b/lib/Iurt/DKMS.pm @@ -95,8 +95,8 @@ sub search_dkms { if ($version =~ /(.*)source-(.*)/ || $version =~ /(.*)devel-(.*)/) { my $source = "$1$2"; my ($sourcedir) = $files =~ m,^/usr/src/([^/ ]+)$,m; - plog('NOTIFY', "kernel source $version ($source sourcedir $sourcedir)"); - $kernel_source{$source} = [ $version, $sourcedir ]; + plog('NOTIFY', "kernel source $version (sourcedir $sourcedir)"); + $kernel_source{$version} = $sourcedir; } else { my ($modulesdir) = $files =~ m,^/lib/modules/([^/ ]+)$,m; if ($modulesdir) { @@ -122,22 +122,27 @@ sub search_dkms { plog("checking $realmodule-kernel-$modulesdir-$realversion"); next if $cache->{dkms}{"$realmodule-kernel-$modulesdir-$realversion"} && !$run->{ignore_failure}; if (!$modules{$realmodule}{$realversion}{$modulesdir}) { - my @choices; - push @choices, $kernel; - if (my ($name, $v) = $kernel =~ /^([^-]+)-.*-(2\..*)/) { - push @choices, "$name-$v"; - } - if (my ($name) = $kernel =~ /(2\..*)/) { - push @choices, $name; + my (@choices); + if (my ($prefix, $v) = $kernel =~ /^(.*?-?)(2\..*)/) { + if (exists $kernel_source{"${prefix}source-$v"}) { + # main flavour + push @choices, "${prefix}devel-$v", "${prefix}source-$v"; + } elsif ($prefix) { + # other flavour + push @choices, "${prefix}devel-$v"; + if (my ($main_prefix, $_flavour) = $prefix =~ /^([^-]+-)?([^-]+)-$/) { + push @choices, "${main_prefix}source-$v"; + } + } } my $source = find { $kernel_source{$_} } @choices; if (!$source) { plog('ERR', "ERROR: no source for kernel $kernel (tried " . join(", ", @choices) . ")"); next; } - plog("dkms module $module version $version should be compiled for kernel $kernel ($kernel_source{$source}[0])"); + plog("dkms module $module version $version should be compiled for kernel $kernel ($source)"); $nb++; - push @{$run->{dkms_todo}}, [ $module, $version, $modulesourcedir, $realmodule, $realversion, $file, $kernel, $modulesdir, @{$kernel_source{$source}}, $media ]; + push @{$run->{dkms_todo}}, [ $module, $version, $modulesourcedir, $realmodule, $realversion, $file, $kernel, $modulesdir, $source, $kernel_source{$source}, $media ]; } $modules{$realmodule}{$realversion}{$modulesdir}++; } |