summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-08-18 12:24:56 +0000
committerOlivier Blin <oblin@mandriva.com>2008-08-18 12:24:56 +0000
commit180f8ebe3edf2d7f5808265fc30bc70db045a19e (patch)
treed5a0ef5319cf78f2987af728f9549737887d97d7
parent37f388f0b64fda53c6b77c2e52a2669da1718e89 (diff)
downloaddrakx-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar
drakx-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar.gz
drakx-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar.bz2
drakx-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar.xz
drakx-180f8ebe3edf2d7f5808265fc30bc70db045a19e.zip
do not reload urpmi media every time are_available is called
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/do_pkgs.pm18
2 files changed, 13 insertions, 7 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 9fa51ab76..e5568d3b5 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,5 @@
+- do_pkgs: do not reload urpmi media at every check for package availability
+
Version 11.10.2 - 18 August 2008
- reakky fix another focus bug (#42750)
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm
index bc2196c3a..37d92c9a8 100644
--- a/perl-install/do_pkgs.pm
+++ b/perl-install/do_pkgs.pm
@@ -189,6 +189,7 @@ package do_pkgs_standalone;
use run_program;
use common;
use log;
+use feature qw(state);
our @ISA = qw(do_pkgs_common);
@@ -231,14 +232,17 @@ sub are_available {
my ($_do, @pkgs) = @_;
my %pkgs = map { $_ => 1 } @pkgs;
+ require urpm::media;
+ state $urpm;
eval {
- require urpm::media;
- my $urpm = urpm->new;
- $urpm->{log} = \&log::l;
- urpm::media::configure($urpm,
- nocheck_access => 1,
- no_skiplist => 1,
- no_second_pass => 1);
+ if (!$urpm) {
+ $urpm = urpm->new;
+ $urpm->{log} = \&log::l;
+ urpm::media::configure($urpm,
+ nocheck_access => 1,
+ no_skiplist => 1,
+ no_second_pass => 1);
+ }
map { $_->name } grep { $pkgs{$_->name} } @{$urpm->{depslist} || []};
};
}