diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-09-11 15:19:58 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-09-11 15:19:58 +0000 |
commit | 08f90b961222590a974642fda6dbb6a62465eaa7 (patch) | |
tree | 7731f977fe826be6070d32a68178a107e22e4dec /Rpmdrake/open_db.pm | |
parent | 6fba00b7fd656cbcfb28fde414ec73c1d532ca9a (diff) | |
download | rpmdrake-08f90b961222590a974642fda6dbb6a62465eaa7.tar rpmdrake-08f90b961222590a974642fda6dbb6a62465eaa7.tar.gz rpmdrake-08f90b961222590a974642fda6dbb6a62465eaa7.tar.bz2 rpmdrake-08f90b961222590a974642fda6dbb6a62465eaa7.tar.xz rpmdrake-08f90b961222590a974642fda6dbb6a62465eaa7.zip |
(fast_open_urpmi_db) split it out of open_urpmi_db() in order to
factorize code into edit-urpm-sources and enable it to support
--urpmi-root option
callers don't have the pay the urpm::media::configure() heavy cost
Diffstat (limited to 'Rpmdrake/open_db.pm')
-rw-r--r-- | Rpmdrake/open_db.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Rpmdrake/open_db.pm b/Rpmdrake/open_db.pm index 06c12d4e..0e6a1d05 100644 --- a/Rpmdrake/open_db.pm +++ b/Rpmdrake/open_db.pm @@ -30,7 +30,7 @@ use urpm; use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw(open_rpm_db open_urpmi_db); +our @EXPORT = qw(fast_open_urpmi_db open_rpm_db open_urpmi_db); # because rpm blocks some signals when rpm DB is opened, we don't keep open around: @@ -55,8 +55,9 @@ sub open_rpm_db { } } -sub open_urpmi_db() { - my $error_happened; +# do not pay the urpm::media::configure() heavy cost: +my $error_happened; +sub fast_open_urpmi_db() { my $urpm = urpm->new; $urpm->{options}{'split-level'} ||= 20; $urpm->{options}{'split-length'} ||= 1; @@ -72,8 +73,14 @@ sub open_urpmi_db() { interactive_msg(N("Fatal error"), N("A fatal error occurred: %s.", $_[1])); }; - my $media = ref $::rpmdrake_options{media} ? join(',', @{$::rpmdrake_options{media}}) : ''; + urpm::media::read_config($urpm); + $urpm; +} + +sub open_urpmi_db() { + my $urpm = fast_open_urpmi_db(); + my $media = ref $::rpmdrake_options{media} ? join(',', @{$::rpmdrake_options{media}}) : ''; my $searchmedia = join(',', map { $_->{name} } grep { $_->{ignore} && $_->{name} =~ /backport/i } @{$urpm->{media}}); urpm::media::configure($urpm, media => $media, if_($searchmedia, searchmedia => $searchmedia)); |