summaryrefslogtreecommitdiffstats
path: root/perl-install/pkgs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-01-19 14:31:44 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-01-19 14:31:44 +0000
commit47a390d1a20b72a9a87e4f89e6a94eadad4ba818 (patch)
treeebc3a8b071318d505bb47e430e4884695ea2f9bf /perl-install/pkgs.pm
parent0b243c6d1dd0234af94666d8b0751e1bf487b174 (diff)
downloaddrakx-backup-do-not-use-47a390d1a20b72a9a87e4f89e6a94eadad4ba818.tar
drakx-backup-do-not-use-47a390d1a20b72a9a87e4f89e6a94eadad4ba818.tar.gz
drakx-backup-do-not-use-47a390d1a20b72a9a87e4f89e6a94eadad4ba818.tar.bz2
drakx-backup-do-not-use-47a390d1a20b72a9a87e4f89e6a94eadad4ba818.tar.xz
drakx-backup-do-not-use-47a390d1a20b72a9a87e4f89e6a94eadad4ba818.zip
- factorize kernel regexp in analyse_kernel_name()
- remove special kernel choosing in packageCallbackChoices()
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r--perl-install/pkgs.pm46
1 files changed, 29 insertions, 17 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 1198bb5db..7df5063cf 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -164,19 +164,39 @@ sub packageById {
$pkg->is_arch_compat && $pkg;
}
+sub analyse_kernel_name {
+ $_[0] =~ /kernel[^\-]*(-enterprise|-i686-up-4GB|-p3-smp-64GB|-secure|-smp)?(?:-([^\-]+))?$/;
+}
+
+sub packages2kernels {
+ my ($packages) = @_;
+
+ map {
+ my $pkg = $packages->{depslist}[$_];
+ if (my ($ext, $version) = analyse_kernel_name($pkg->name)) {
+ [ $pkg, $ext, $version ];
+ } else {
+ log::l("ERROR: unknown package " . $pkg->name . " providing kernel");
+ ();
+ }
+ } keys %{$packages->{provides}{kernel}};
+}
+
sub bestKernelPackage {
my ($packages) = @_;
- my ($best, $best2, $best3);
- foreach (keys %{$packages->{provides}{kernel}}) {
- my $pkg = $packages->{depslist}[$_] or next;
- $pkg->name =~ /kernel-\d/ and $best = $pkg;
- $pkg->name =~ /kernel-i686/ and $best2 = $pkg;
- $pkg->name =~ /kernel-enterprise/ and $best3 = $pkg;
+ my @kernels = packages2kernels($packages) or internal_error('no kernel available');
+ my ($version_BOOT) = c::kernel_version() =~ /^(\d+\.\d+)/;
+ if (my @l = grep { $_->[2] =~ /\Q$version_BOOT/ } @kernels) {
+ #- favour versions corresponding to current BOOT version
+ @kernels = @l;
}
- log::l("bestKernelPackage's: " . join(' ', map { if_($_, $_->name) } $best, $best2, $best3));
-
- $best || $best2 || $best3;
+ if (my @l = grep { $_->[1] eq '' } @kernels) {
+ @kernels = @l;
+ }
+
+ log::l("bestKernelPackage: " . join(' ', map { $_->[0]->name } @kernels) . (@kernels > 1 ? ' (choosing the first)' : ''));
+ $kernels[0][0];
}
sub packagesOfMedium {
@@ -226,14 +246,6 @@ sub packageCallbackChoices {
$prefer;
} else {
my @l = grep {
- #- or if a kernel has to be chosen, chose the basic one.
- if ($_->arch ne 'src') {
- if ($_->name =~ /kernel-\d/ || $_->name =~ /kernel-i686/) {
- log::l("packageCallbackChoices: chosen " . $_->name);
- return $_;
- }
- }
-
#- or even if a package requires a specific locales which
#- is already selected.
find {