diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-10-01 16:02:45 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-10-01 16:02:45 +0000 |
commit | f647c533c77edfd66e0f7e21ddd86fad8b29075b (patch) | |
tree | 732d34823a427f692b82319a7d60ced3ba3a7be6 | |
parent | 0b0b77c2f6e5068b4d7a03ac2a518e5a8c8475e6 (diff) | |
download | perl-URPM-f647c533c77edfd66e0f7e21ddd86fad8b29075b.tar perl-URPM-f647c533c77edfd66e0f7e21ddd86fad8b29075b.tar.gz perl-URPM-f647c533c77edfd66e0f7e21ddd86fad8b29075b.tar.bz2 perl-URPM-f647c533c77edfd66e0f7e21ddd86fad8b29075b.tar.xz perl-URPM-f647c533c77edfd66e0f7e21ddd86fad8b29075b.zip |
create _find_required_package__kernel_source() out of _find_required_package__sort()
-rw-r--r-- | URPM/Resolve.pm | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 23656a0..a9befc6 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -203,31 +203,9 @@ sub _find_required_package__sort { return [ $chosen[0] ]; } - #- prefer kernel-source-stripped over kernel-source - if ($chosen[0]->name =~ /^kernel-(.*source-|.*-devel-)/) { - - my @l = grep { - if ($_->name =~ /^kernel-.*source-stripped-(.*)/) { - my $version = quotemeta($1); - find { - $_->name =~ /-$version$/ && ($_->flag_installed || $_->flag_selected); - } $urpm->packages_providing('kernel'); - } elsif ($_->name =~ /(kernel-.*)-devel-(.*)/) { - my $kernel = "$1-$2"; - _is_selected_or_installed($urpm, $db, $kernel); - } elsif ($_->name =~ /^kernel-.*source-/) { - #- hopefully we don't have a media with kernel-source but not kernel-source-stripped nor kernel-.*-devel - 0; - } else { - $urpm->{debug_URPM}("unknown kernel-source package " . $_->fullname) if $urpm->{debug_URPM}; - 0; - } - } @chosen; - - if (@l) { - $urpm->{debug_URPM}("packageCallbackChoices: kernel source chosen " . join(",", map { $_->name } @l) . " in " . join(",", map { $_->name } @chosen)) if $urpm->{debug_URPM}; - return \@l, \@l; - } + 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}; + return \@kernel_source, \@kernel_source; } if ($urpm->{media}) { @@ -255,6 +233,31 @@ sub _find_required_package__sort { [ map { $_->[0] } @chosen_with_score ], [ map { $_->[0] } @prefered ]; } +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 { + if ($_->name =~ /^kernel-.*source-stripped-(.*)/) { + my $version = quotemeta($1); + find { + $_->name =~ /-$version$/ && ($_->flag_installed || $_->flag_selected); + } $urpm->packages_providing('kernel'); + } elsif ($_->name =~ /(kernel-.*)-devel-(.*)/) { + my $kernel = "$1-$2"; + _is_selected_or_installed($urpm, $db, $kernel); + } elsif ($_->name =~ /^kernel-.*source-/) { + #- hopefully we don't have a media with kernel-source but not kernel-source-stripped nor kernel-.*-devel + 0; + } else { + $urpm->{debug_URPM}("unknown kernel-source 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. |