diff options
-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}++; } |