summaryrefslogtreecommitdiffstats
path: root/perl-install/do_pkgs.pm
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 /perl-install/do_pkgs.pm
parent37f388f0b64fda53c6b77c2e52a2669da1718e89 (diff)
downloaddrakx-backup-do-not-use-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar
drakx-backup-do-not-use-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar.gz
drakx-backup-do-not-use-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar.bz2
drakx-backup-do-not-use-180f8ebe3edf2d7f5808265fc30bc70db045a19e.tar.xz
drakx-backup-do-not-use-180f8ebe3edf2d7f5808265fc30bc70db045a19e.zip
do not reload urpmi media every time are_available is called
Diffstat (limited to 'perl-install/do_pkgs.pm')
-rw-r--r--perl-install/do_pkgs.pm18
1 files changed, 11 insertions, 7 deletions
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} || []};
};
}