summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-09-15 14:33:02 +0000
committerFrancois Pons <fpons@mandriva.com>2003-09-15 14:33:02 +0000
commit9524cc24f479d69e9fc25245e892b9f3d257689f (patch)
treee8b087eee39807885522c89d82bfe2068579fea2 /perl-install/standalone.pm
parent6162c68fda694d558ad9995fc1cd62170a48a59a (diff)
downloaddrakx-backup-do-not-use-9524cc24f479d69e9fc25245e892b9f3d257689f.tar
drakx-backup-do-not-use-9524cc24f479d69e9fc25245e892b9f3d257689f.tar.gz
drakx-backup-do-not-use-9524cc24f479d69e9fc25245e892b9f3d257689f.tar.bz2
drakx-backup-do-not-use-9524cc24f479d69e9fc25245e892b9f3d257689f.tar.xz
drakx-backup-do-not-use-9524cc24f479d69e9fc25245e892b9f3d257689f.zip
improved speed by invoking once `rpm -qa` instead of 4.
Diffstat (limited to 'perl-install/standalone.pm')
-rw-r--r--perl-install/standalone.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm
index 38f0edfc3..227031d29 100644
--- a/perl-install/standalone.pm
+++ b/perl-install/standalone.pm
@@ -198,8 +198,11 @@ sub ensure_is_installed {
sub check_kernel_module_packages {
my ($do, $base_name, $ext_name) = @_;
- my $result;
- my (%list, %select);
+ my ($result, %list, %select);
+ my @rpm_qa if 0;
+
+ #- initialize only once from rpm -qa output...
+ @rpm_qa or @rpm_qa = `rpm -qa`;
eval {
local *_;
@@ -213,10 +216,10 @@ sub check_kernel_module_packages {
$_->name eq $ext_name and $list{$_->name} = 1;
$_->name =~ /$base_name/ and $list{$_->name} = 1;
}
- foreach (`rpm --qf '\%{NAME}\n' -qa`) {
- chomp;
- $_ eq $ext_name and $list{$_} = 0;
- /$base_name/ and $list{$_} = 0;
+ foreach (@rpm_qa) {
+ my ($name) = /(.*?)-[^-]*-[^-]*$/ or next;
+ $name eq $ext_name and $list{$name} = 0;
+ $name =~ /$base_name/ and $list{$name} = 0;
}
};
if (!$ext_name || exists $list{$ext_name}) {
@@ -230,7 +233,7 @@ sub check_kernel_module_packages {
} else {
#- kernel version is not recognized, what to do ?
}
- foreach (`rpm -qa`) {
+ foreach (@rpm_qa) {
($ext, $version_release) = /kernel[^\-]*(-smp|-enterprise|-secure)?(?:-([^\-]+))$/;
$list{"$base_name$ext-$version_release"} and $select{"$base_name$ext-$version_release"} = 1;
}