aboutsummaryrefslogtreecommitdiffstats
path: root/URPM
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-10-01 16:23:27 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-10-01 16:23:27 +0000
commitb309548799f3eeb03c104fa0e58adc07541c9cad (patch)
tree7f1ab7b9280d99daa3c060a6d7d741d29f723c8d /URPM
parent849fad1cd3ed505b07cb20cf19bbf3f99e6c89bc (diff)
downloadperl-URPM-b309548799f3eeb03c104fa0e58adc07541c9cad.tar
perl-URPM-b309548799f3eeb03c104fa0e58adc07541c9cad.tar.gz
perl-URPM-b309548799f3eeb03c104fa0e58adc07541c9cad.tar.bz2
perl-URPM-b309548799f3eeb03c104fa0e58adc07541c9cad.tar.xz
perl-URPM-b309548799f3eeb03c104fa0e58adc07541c9cad.zip
- prefer precompiled kmod packages corresponding to installed kernels
Diffstat (limited to 'URPM')
-rw-r--r--URPM/Resolve.pm27
1 files changed, 24 insertions, 3 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 357f5b5..e833c0b 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -171,10 +171,14 @@ sub find_required_package {
_set_flag_installed_and_upgrade_if_no_newer($db, $pkg);
}
- if (my @kernel_source = _find_required_package__kernel_source($urpm, $db, \@chosen)) {
- $urpm->{debug_URPM}("packageCallbackChoices: kernel source chosen " . join(",", map { $_->name } @kernel_source) . " in " . join(",", map { $_->name } @chosen)) if $urpm->{debug_URPM};
+ if (my @kernel_source = _find_required_package__kernel_source($urpm, $db, \@packages)) {
+ $urpm->{debug_URPM}("packageCallbackChoices: kernel source chosen " . join(",", map { $_->name } @kernel_source) . " in " . join(",", map { $_->name } @packages)) if $urpm->{debug_URPM};
return \@kernel_source, \@kernel_source;
}
+ if (my @kmod = _find_required_package__kmod($urpm, $db, \@packages)) {
+ $urpm->{debug_URPM}("packageCallbackChoices: kmod packages " . join(",", map { $_->name } @kmod) . " in " . join(",", map { $_->name } @packages)) if $urpm->{debug_URPM};
+ return \@kmod, \@kmod;
+ }
_find_required_package__sort($urpm, $db, \@packages);
} else {
@@ -233,10 +237,10 @@ sub _find_required_package__sort {
[ map { $_->[0] } @chosen_with_score ], [ map { $_->[0] } @prefered ];
}
+#- prefer the pkgs corresponding to installed/selected kernels
sub _find_required_package__kernel_source {
my ($urpm, $db, $choices) = @_;
- #- prefer kernel-source-stripped over kernel-source
$choices->[0]->name =~ /^kernel-(.*source-|.*-devel-)/ or return;
my @l = grep {
@@ -258,6 +262,23 @@ sub _find_required_package__kernel_source {
} @$choices;
}
+#- prefer the pkgs corresponding to installed/selected kernels
+sub _find_required_package__kmod {
+ my ($urpm, $db, $choices) = @_;
+
+ $choices->[0]->name =~ /-kernel-2\./ or return;
+
+ my @l = grep {
+ if (my ($name, $version, $flavor, $release) = $_->name =~ /(.*)-kernel-(2\..*)-(.*)-(.*)/) {
+ my $kernel = "kernel-$flavor-$version-$release";
+ _is_selected_or_installed($urpm, $db, $kernel);
+ } else {
+ $urpm->{debug_URPM}("unknown kmod package " . $_->fullname) if $urpm->{debug_URPM};
+ 0;
+ }
+ } @$choices;
+}
+
#- Packages that require locales-xxx when the corresponding locales are
#- already installed should be preferred over packages that require locales
#- which are not installed.