summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-06-09 07:42:30 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-06-09 07:42:30 +0000
commit39d5d8e8c7e51adbf4bb27833dab6c84ab58c524 (patch)
tree277a801487a852e67b185c737c3404d74bd50ccd
parent31ad4fb787dc5bc23bf8a3d708d32e3a79641949 (diff)
downloadurpmi-39d5d8e8c7e51adbf4bb27833dab6c84ab58c524.tar
urpmi-39d5d8e8c7e51adbf4bb27833dab6c84ab58c524.tar.gz
urpmi-39d5d8e8c7e51adbf4bb27833dab6c84ab58c524.tar.bz2
urpmi-39d5d8e8c7e51adbf4bb27833dab6c84ab58c524.tar.xz
urpmi-39d5d8e8c7e51adbf4bb27833dab6c84ab58c524.zip
Introduce a --nolock option in urpmi and urpmq.
Use it for parallel distribution over ssh on localhost
-rw-r--r--urpm/args.pm2
-rw-r--r--urpm/parallel_ssh.pm8
-rwxr-xr-xurpmi5
-rwxr-xr-xurpmq6
4 files changed, 14 insertions, 7 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index af7d02ef..9bb3f111 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -117,6 +117,7 @@ my %options_spec = (
'excludedocs|exclude-docs' => sub { $urpm->{options}{excludedocs} = 1 },
'more-choices' => sub { $urpm->{options}{morechoices} = 1 },
'expect-install!' => \$::expect_install,
+ 'nolock' => \$::nolock,
a => \$::all,
q => sub { --$::verbose; $::rpm_opt = '' },
v => sub { ++$::verbose; $::rpm_opt = 'vh' },
@@ -208,6 +209,7 @@ my %options_spec = (
'use-distrib=s' => \$options{usedistrib},
'parallel=s' => \$options{parallel},
'env=s' => \$options{env},
+ 'nolock' => \$options{nolock},
d => \$options{deps},
u => \$options{upgrade},
a => \$options{all},
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index b14416fb..b698bbe1 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -2,6 +2,8 @@ package urpm::parallel_ssh;
use Time::HiRes qw(gettimeofday);
+sub _nolock($) { $_[0] eq 'localhost' ? '--nolock ' : '' }
+
#- parallel copy
sub parallel_register_rpms {
my ($parallel, $urpm, @files) = @_;
@@ -157,7 +159,7 @@ sub parallel_resolve_dependencies {
delete $state->{selected};
#- now try an iteration of urpmq.
foreach my $node (keys %{$parallel->{nodes}}) {
- my $command = "ssh $node urpmq --synthesis $synthesis -fduc $line " . join(' ', keys %chosen);
+ my $command = "ssh $node urpmq " . _nolock($node) . "--synthesis $synthesis -fduc $line " . join(' ', keys %chosen);
$urpm->{ui_msg}("parallel_ssh: $command", urpm::N("Resolving dependencies on %s...", $node));
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
@@ -212,7 +214,7 @@ sub parallel_install {
my %bad_nodes;
foreach my $node (keys %{$parallel->{nodes}}) {
local $_;
- my $command = "ssh $node urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}";
+ my $command = "ssh $node urpmi --pre-clean --no-locales --test --no-verify-rpm --auto " . _nolock($node) . "--synthesis $parallel->{synthesis} $parallel->{line}";
$urpm->{ui_msg}("parallel_ssh: $command", urpm::N("Verifying if install is possible on %s...", $node));
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
@@ -236,7 +238,7 @@ sub parallel_install {
my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath $options{excludepath}" : "");
#- continue installation on each node
foreach my $node (keys %{$parallel->{nodes}}) {
- my $command = "ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line";
+ my $command = "ssh $node urpmi --no-locales --no-verify-rpm --auto " . _nolock($node) . "--synthesis $parallel->{synthesis} $line";
$urpm->{ui_msg}("parallel_ssh: $command", urpm::N("Performing install on %s...", $node));
$urpm->{ui}{progress}->(0) if ref $urpm->{ui}{progress};
open my $fh, "$command |"
diff --git a/urpmi b/urpmi
index 5cf476f2..a09edce3 100755
--- a/urpmi
+++ b/urpmi
@@ -57,6 +57,7 @@ our $use_provides = 1;
our $verbose = 0;
our $usedistrib = 0;
our $log = '';
+our $nolock = 0;
my @files;
my @src_files;
@@ -265,7 +266,7 @@ unless ($bug) {
}
$verbose > 0 or $urpm->{log} = sub {};
-unless ($env) {
+unless ($env || $nolock) {
$urpm->exlock_rpm_db;
$urpm->shlock_urpmi_db;
}
@@ -707,7 +708,7 @@ if ($nok) {
}
}
-unless ($env) {
+unless ($env || $nolock) {
$urpm->unlock_urpmi_db;
$urpm->unlock_rpm_db;
diff --git a/urpmq b/urpmq
index a1d4cca1..da12eded 100755
--- a/urpmq
+++ b/urpmq
@@ -120,7 +120,8 @@ if ($urpm::args::options{env}) {
$urpm->{statedir} = $urpm::args::options{env};
}
-$urpm::args::options{upgrade} && !$urpm::args::options{env} and $urpm->shlock_rpm_db;
+$urpm::args::options{upgrade} && !$urpm::args::options{env} && !$urpm::args::options{nolock}
+ and $urpm->shlock_rpm_db;
$urpm->shlock_urpmi_db;
$urpm->configure(
nocheck_access => 1,
@@ -435,7 +436,8 @@ if ($urpm::args::options{list_aliases}) {
}
}
$urpm->unlock_urpmi_db;
-$urpm::args::options{upgrade} && !$urpm::args::options{env} and $urpm->unlock_rpm_db;
+$urpm::args::options{upgrade} && !$urpm::args::options{env} && !$urpm::args::options{nolock}
+ and $urpm->unlock_rpm_db;
#- print sub for query.
my $query_sub = sub {