summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-03-06 15:46:00 +0000
committerFrancois Pons <fpons@mandriva.com>2003-03-06 15:46:00 +0000
commit496f1cfdd6fb89b02e9a7e7f2b19344b6ee2bf66 (patch)
tree896042f42106148f7efa4f5d903ec7f5e3edaa1e /perl-install/standalone.pm
parentba912a0656f47765109a8330cdcf562917297ebd (diff)
downloaddrakx-backup-do-not-use-496f1cfdd6fb89b02e9a7e7f2b19344b6ee2bf66.tar
drakx-backup-do-not-use-496f1cfdd6fb89b02e9a7e7f2b19344b6ee2bf66.tar.gz
drakx-backup-do-not-use-496f1cfdd6fb89b02e9a7e7f2b19344b6ee2bf66.tar.bz2
drakx-backup-do-not-use-496f1cfdd6fb89b02e9a7e7f2b19344b6ee2bf66.tar.xz
drakx-backup-do-not-use-496f1cfdd6fb89b02e9a7e7f2b19344b6ee2bf66.zip
added check_kernel_module_packages with same behaviour expected as for
install_any module.
Diffstat (limited to 'perl-install/standalone.pm')
-rw-r--r--perl-install/standalone.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm
index 483ef0362..2aaaa50b6 100644
--- a/perl-install/standalone.pm
+++ b/perl-install/standalone.pm
@@ -195,6 +195,40 @@ sub ensure_is_installed {
1;
}
+sub check_kernel_module_packages {
+ my ($do, $base_name, $ext_name) = @_;
+ my $result;
+ my (%list, %select);
+
+ eval {
+ local *_;
+ require urpm;
+ my $urpm = new urpm;
+ $urpm->read_config(nocheck_access => 1);
+ foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) {
+ $urpm->parse_synthesis($_);
+ }
+ foreach (@{$urpm->{depslist} || []}) {
+ $_->name eq $ext_name and $list{$_->name} = 1;
+ $_->name =~ /$base_name/ and $list{$_->name} = 1;
+ }
+ };
+ if (!$ext_name || $list{$ext_name}) {
+ eval {
+ my ($version, $release, $ext) = c::kernel_version() =~ /([^-]*)-([^-]*mdk)(\S*)/;
+ $ext and $ext = "-$ext";
+ $list{"$base_name$version-$release$ext"} or die "no NVIDIA kernel for current kernel";
+ $select{"$base_name$version-$release$ext"} = 1;
+ foreach (`rpm -qa kernel*`) {
+ ($ext, $version, $release) = /kernel[^-]*(-smp|-enterprise|-secure)?(\d+\.\d+\.\d+)\.([^\-]+mdk)$/;
+ $list{"$base_name$version-$release$ext"} and $select{"$base_name$version-$release$ext"} = 1;
+ }
+ $result = [ keys(%select), if_($ext_name, $ext_name) ];
+ }
+ }
+ return undef;
+}
+
sub what_provides {
my ($_o, $name) = @_;
my ($what) = split '\n', `urpmq '$name' 2>/dev/null`;