aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--URPM/Resolve.pm27
2 files changed, 25 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 9745314..d7e2221 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- prefer precompiled kmod packages corresponding to installed kernels
- don't resolve suggested virtual packages if already installed (#34376)
Version 2.06 - 28 September 2007, by Pascal "Pixel" Rigaux
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.