aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-08-27 09:32:21 +0000
committerThierry Vignaud <tv@mandriva.org>2007-08-27 09:32:21 +0000
commit2d44e6bb283a45c35e72a293ca8fa5aab3e57eca (patch)
tree48dfe9f5dee4632866730cc454bbd326edaa227d
parenta3c7b1c49228ebcb07f8fffdecf3cfaf0035e53b (diff)
downloadrpmdrake-2d44e6bb283a45c35e72a293ca8fa5aab3e57eca.tar
rpmdrake-2d44e6bb283a45c35e72a293ca8fa5aab3e57eca.tar.gz
rpmdrake-2d44e6bb283a45c35e72a293ca8fa5aab3e57eca.tar.bz2
rpmdrake-2d44e6bb283a45c35e72a293ca8fa5aab3e57eca.tar.xz
rpmdrake-2d44e6bb283a45c35e72a293ca8fa5aab3e57eca.zip
(get_parallel_group) factorize a test
-rwxr-xr-xRpmdrake/pkg.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm
index 64e0c28e..16d48e03 100755
--- a/Rpmdrake/pkg.pm
+++ b/Rpmdrake/pkg.pm
@@ -254,6 +254,9 @@ sub open_urpmi_db() {
$urpm;
}
+sub get_parallel_group() {
+ $::rpmdrake_options{parallel} ? $::rpmdrake_options{parallel}[0] : undef;
+}
our $probe_only_for_updates;
sub get_pkgs {
@@ -342,8 +345,7 @@ sub get_pkgs {
push @installed_pkgs, $fullname;
$pkg->pack_header; # needed in order to call methods on objects outside ->traverse
});
- my $group;
- if ($::rpmdrake_options{parallel} && (($group) = @{$::rpmdrake_options{parallel}})) {
+ if (my $group = get_parallel_group()) {
urpm::media::configure($urpm, parallel => $group);
}
@@ -513,8 +515,9 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-(
my $_flush_guard = Gtk2::GUI_Update_Guard->new;
- my $group;
- return perform_parallel_install($urpm, $group, \$statusbar_msg_id) if $::rpmdrake_options{parallel} && (($group) = @{$::rpmdrake_options{parallel}});
+ if (my $group = get_parallel_group()) {
+ return perform_parallel_install($urpm, $group, \$statusbar_msg_id);
+ }
my $lock = urpm::lock::urpmi_db($urpm);
my $rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive');