summaryrefslogtreecommitdiffstats
path: root/perl-install/do_pkgs.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/do_pkgs.pm')
-rw-r--r--perl-install/do_pkgs.pm80
1 files changed, 25 insertions, 55 deletions
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm
index 11cb4e84b..a84223f24 100644
--- a/perl-install/do_pkgs.pm
+++ b/perl-install/do_pkgs.pm
@@ -41,6 +41,20 @@ sub is_installed {
$do->are_installed($name);
}
+sub check_kernel_module_packages {
+ my ($do, $base_name, $o_ext_name) = @_;
+
+ require bootloader;
+ my @l = map { $base_name . '-' . bootloader::vmlinuz2version($_) } bootloader::installed_vmlinuz();
+ my @ext = if_($o_ext_name, $o_ext_name);
+ my @rpms = $do->are_available(@ext, @l);
+
+ log::l("found kernel module packages $_") foreach @rpms;
+
+ #- we want at least a kernel package and the ext package if specified
+ @rpms > @ext && \@rpms;
+}
+
################################################################################
package do_pkgs_during_install;
use run_program;
@@ -57,7 +71,7 @@ sub new {
sub install {
my ($do, @l) = @_;
log::l("do_pkgs_during_install::install");
- if ($::testing) {
+ if ($::testing || $::globetrotter) {
log::l("i would install packages " . join(' ', @l));
return 1;
} else {
@@ -65,30 +79,16 @@ sub install {
}
}
-sub check_kernel_module_packages {
- my ($do, $base_name, $o_ext_name) = @_;
-
- if (!$o_ext_name || pkgs::packageByName($do->{o}{packages}, $o_ext_name)) {
- my @rpms = map {
- my $name = $base_name . $_->{ext} . '-' . $_->{version};
- if ($_->{pkg}->flag_available && pkgs::packageByName($do->{o}{packages}, $name)) {
- log::l("found kernel module packages $name");
- $name;
- } else {
- ();
- }
- } pkgs::packages2kernels($do->{o}{packages});
-
- @rpms and return [ @rpms, if_($o_ext_name, $o_ext_name) ];
- }
- return undef;
-}
-
sub what_provides {
my ($do, $name) = @_;
map { $_->name } pkgs::packagesProviding($do->{o}{packages}, $name);
}
+sub are_available {
+ my ($do, @pkgs) = @_;
+ grep { pkgs::packageByName($do->{o}{packages}, $_) } @pkgs;
+}
+
sub are_installed {
my ($do, @l) = @_;
grep {
@@ -148,13 +148,9 @@ sub install {
$ret;
}
-sub check_kernel_module_packages {
- my ($_do, $base_name, $o_ext_name) = @_;
- my ($result, %list, %select);
- my @rpm_qa if 0;
-
- #- initialize only once from rpm -qa output...
- @rpm_qa or @rpm_qa = `rpm -qa`;
+sub are_available {
+ my ($_do, @pkgs) = @_;
+ my %pkgs = map { $_ => 1 } @pkgs;
eval {
local *_;
@@ -164,35 +160,9 @@ sub check_kernel_module_packages {
foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) {
$urpm->parse_synthesis("$urpm->{statedir}/synthesis.$_->{hdlist}");
}
- foreach (@{$urpm->{depslist} || []}) {
- $_->name eq $o_ext_name and $list{$_->name} = 1;
- $_->name =~ /$base_name/ and $list{$_->name} = 1;
- }
- foreach (@rpm_qa) {
- my ($name) = /(.*?)-[^-]*-[^-]*$/ or next;
- $name eq $o_ext_name and $list{$name} = 0;
- $name =~ /$base_name/ and $list{$name} = 0;
- }
+ map { $_->name } grep { $pkgs{$_->name} } @{$urpm->{depslist} || []};
};
- if (!$o_ext_name || exists $list{$o_ext_name}) {
- eval {
- my ($version_release, $ext);
- if (c::kernel_version() =~ /([^-]*)-([^-]*mdk)(\S*)/) {
- $version_release = "$1.$2";
- $ext = $3 ? "-$3" : "";
- exists $list{"$base_name$ext-$version_release"} or die "no $base_name for current kernel";
- $list{"$base_name$ext-$version_release"} and $select{"$base_name$ext-$version_release"} = 1;
- } else {
- #- kernel version is not recognized, what to do ?
- }
- foreach (@rpm_qa) {
- ($ext, $version_release) = /kernel[^\-]*(-smp|-enterprise|-secure)?(?:-([^\-]+))$/;
- $list{"$base_name$ext-$version_release"} and $select{"$base_name$ext-$version_release"} = 1;
- }
- $result = [ keys(%select), if_($o_ext_name, $o_ext_name) ];
- }
- }
- return $result;
+
}
sub what_provides {