summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-08-27 11:53:11 +0000
committerFrancois Pons <fpons@mandriva.com>2002-08-27 11:53:11 +0000
commitf81bbee311b3be991a13a2aaa3bef8183294e8b2 (patch)
tree526b508e5b91bc2153147f1273935719a7b2cdec
parent6987d4315ab303a662f93c982795ac1d47c76ba6 (diff)
downloadurpmi-f81bbee311b3be991a13a2aaa3bef8183294e8b2.tar
urpmi-f81bbee311b3be991a13a2aaa3bef8183294e8b2.tar.gz
urpmi-f81bbee311b3be991a13a2aaa3bef8183294e8b2.tar.bz2
urpmi-f81bbee311b3be991a13a2aaa3bef8183294e8b2.tar.xz
urpmi-f81bbee311b3be991a13a2aaa3bef8183294e8b2.zip
4.0-5mdk
-rw-r--r--urpm.pm86
-rw-r--r--urpm/parallel_ka_run.pm24
-rw-r--r--urpm/parallel_ssh.pm28
-rw-r--r--urpmi.spec8
-rwxr-xr-xurpmq2
5 files changed, 82 insertions, 66 deletions
diff --git a/urpm.pm b/urpm.pm
index 1a41432e..39850bc9 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -532,6 +532,51 @@ sub configure {
my ($urpm, %options) = @_;
$urpm->clean;
+
+ if ($options{parallel}) {
+ my ($parallel_options, $parallel_handler);
+ #- handle parallel configuration, examine all module available that
+ #- will handle the parallel mode (configuration is /etc/urpmi/parallel.cfg).
+ local ($_, *PARALLEL);
+ open PARALLEL, "/etc/urpmi/parallel.cfg";
+ while (<PARALLEL>) {
+ chomp; s/#.*$//; s/^\s*//; s/\s*$//;
+ /\s*([^:]*):(.*)/ or $urpm->{error}(_("unable to parse \"%s\" in file [%s]", $_, "/etc/urpmi/parallel.cfg")), next;
+ $1 eq $options{parallel} and $parallel_options = ($parallel_options && "\n") . $2;
+ }
+ close PARALLEL;
+ #- if a configuration options has been found, use it else fatal error.
+ if ($parallel_options) {
+ foreach my $dir (grep { -d $_ } map { "$_/urpm" } @INC) {
+ local *DIR;
+ opendir DIR, $dir;
+ while ($_ = readdir DIR) {
+ -f "$dir/$_" or next;
+ $urpm->{log}->(_("examining parallel handler in file [%s]", "$dir/$_"));
+ eval { require "$dir/$_"; $parallel_handler = $urpm->handle_parallel_options($parallel_options) };
+ $parallel_handler and last;
+ }
+ closedir DIR;
+ $parallel_handler and last;
+ }
+ }
+ if ($parallel_handler) {
+ if ($parallel_handler->{nodes}) {
+ $urpm->{log}->(_("found parallel handler for nodes: %s", join(', ', keys %{$parallel_handler->{nodes}})));
+ }
+ if (!$options{media} && $parallel_handler->{media}) {
+ $options{media} = $parallel_handler->{media};
+ $urpm->{log}->(_("using associated media for parallel mode : %s", $options{media}));
+ }
+ $urpm->{parallel_handler} = $parallel_handler;
+ } else {
+ $urpm->{fatal}(1, _("unable to use parallel option \"%s\"", $options{parallel}));
+ }
+ } else {
+ #- parallel is exclusive against root options.
+ $urpm->{root} = $options{root};
+ }
+
if ($options{synthesis}) {
#- synthesis take precedence over media, update options.
$options{media} || $options{update} || $options{parallel} and
@@ -595,45 +640,6 @@ sub configure {
});
close RPMDB;
}
- if ($options{parallel}) {
- my ($parallel_options, $parallel_handler);
- #- handle parallel configuration, examine all module available that
- #- will handle the parallel mode (configuration is /etc/urpmi/parallel.cfg).
- local ($_, *PARALLEL);
- open PARALLEL, "/etc/urpmi/parallel.cfg";
- while (<PARALLEL>) {
- chomp; s/#.*$//; s/^\s*//; s/\s*$//;
- /\s*([^:]*):(.*)/ or $urpm->{error}(_("unable to parse \"%s\" in file [%s]", $_, "/etc/urpmi/parallel.cfg")), next;
- $1 eq $options{parallel} and $parallel_options = ($parallel_options && "\n") . $2;
- }
- close PARALLEL;
- #- if a configuration options has been found, use it else fatal error.
- if ($parallel_options) {
- foreach my $dir (grep { -d $_ } map { "$_/urpm" } @INC) {
- local *DIR;
- opendir DIR, $dir;
- while ($_ = readdir DIR) {
- -f "$dir/$_" or next;
- $urpm->{log}->(_("examining parallel handler in file [%s]", "$dir/$_"));
- eval { require "$dir/$_"; $parallel_handler = $urpm->handle_parallel_options($parallel_options) };
- $parallel_handler and last;
- }
- closedir DIR;
- $parallel_handler and last;
- }
- }
- if ($parallel_handler) {
- if ($parallel_handler->{nodes}) {
- $urpm->{log}->(_("found parallel handler for nodes: %s", join(', ', keys %{$parallel_handler->{nodes}})));
- }
- $urpm->{parallel_handler} = $parallel_handler;
- } else {
- $urpm->{fatal}(1, _("unable to use parallel option \"%s\"", $options{parallel}));
- }
- } else {
- #- parallel is exclusive against root options.
- $urpm->{root} = $options{root};
- }
}
#- add a new medium, sync the config file accordingly.
@@ -1976,7 +1982,7 @@ sub install_logger {
#- install packages according to each hashes (install or upgrade).
sub install {
my ($urpm, $remove, $install, $upgrade, %options) = @_;
- my $db = URPM::DB::open($urpm->{root}, 1); #- open in read/write mode.
+ my $db = URPM::DB::open($urpm->{root}, !$options{test}); #- open in read/write mode unless testing installation.
my $trans = $db->create_transaction($urpm->{root});
my @l;
local *F;
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index ef806b6b..8a60ed8f 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -75,26 +75,27 @@ sub parallel_install {
}
local (*F, $_);
- my ($node, %good_nodes, $bad);
+ my ($node, %bad_nodes);
$urpm->{log}("parallel_ka_run: rshp -v $parallel->{options} -- urpmi --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
open F, "rshp -v $parallel->{options} -- urpmi --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line} |";
while ($_ = <F>) {
chomp;
s/<([^>]*)>.*:->:(.*)/$2/ and $node = $1;
- /Installation is possible/ and $good_nodes{$node} = undef;
+ $bad_nodes{$node} .= $_;
+ /Installation failed/ and $bad_nodes{$node} = '';
+ /Installation is possible/ and delete $bad_nodes{$node}, last;
}
close F or $urpm->{fatal}(1, _("rshp failed"));
foreach (keys %{$parallel->{nodes}}) {
- exists $good_nodes{$_} and next;
- $urpm->{error}(_("Installation failed on node %s", $_) . ":\n" . ""); #TODO
- $bad = 1;
- }
- unless ($bad) {
- #- continue installation.
- $urpm->{log}("parallel_ka_run: rshp $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
- system "rshp $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}";
+ exists $bad_nodes{$_} or next;
+ $urpm->{error}(_("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
}
+ %bad_nodes and return;
+
+ #- continue installation.
+ $urpm->{log}("parallel_ka_run: rshp $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
+ system "rshp $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}" == 0;
}
@@ -102,7 +103,7 @@ sub parallel_install {
package urpm;
sub handle_parallel_options {
my ($urpm, $options) = @_;
- my ($ka_run_options) = $options =~ /ka-run:(.*)/;
+ my ($media, $ka_run_options) = $options =~ /ka-run(?:\(([^\)]*)\))?:(.*)/;
if ($ka_run_options) {
my ($flush_nodes, %nodes);
@@ -117,6 +118,7 @@ sub handle_parallel_options {
}
return bless {
+ media => $media,
options => $ka_run_options,
nodes => \%nodes,
}, "urpm::parallel_ka_run";
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index 46a21b34..bd7ee200 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -77,29 +77,30 @@ sub parallel_install {
system "scp $sources $_:$urpm->{cachedir}/rpms";
}
- my (%good_nodes, $bad);
+ my %bad_nodes;
foreach my $node (keys %{$parallel->{nodes}}) {
local (*F, $_);
$urpm->{log}("parallel_ssh: ssh $node urpmi --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
open F, "ssh $node urpmi --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line} |";
while ($_ = <F>) {
- chomp;
- /Installation is possible/ and $good_nodes{$node} = undef;
+ $bad_nodes{$node} .= $_;
+ /Installation failed/ and $bad_nodes{$node} = '';
+ /Installation is possible/ and delete $bad_nodes{$node}, last;
}
close F;
}
foreach (keys %{$parallel->{nodes}}) {
- exists $good_nodes{$_} and next;
- $urpm->{error}(_("Installation failed on node %s", $_) . ":\n" . ""); #TODO
- $bad = 1;
+ exists $bad_nodes{$_} or next;
+ $urpm->{error}(_("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
}
- unless ($bad) {
- foreach my $node (keys %{$parallel->{nodes}}) {
- #- continue installation.
- $urpm->{log}("parallel_ssh: ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
- system "ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}";
- }
+ %bad_nodes and return;
+
+ #- continue installation on each nodes.
+ foreach my $node (keys %{$parallel->{nodes}}) {
+ $urpm->{log}("parallel_ssh: ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
+ system "ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}";
}
+ 1;
}
@@ -109,10 +110,11 @@ sub handle_parallel_options {
my ($urpm, $options) = @_;
my ($id, @nodes) = split ':', $options;
- if ($id eq 'ssh') {
+ if ($id =~ /^ssh(?:\(([^\)]*)\))?$/) {
my %nodes; @nodes{@nodes} = undef;
return bless {
+ media => $1,
nodes => \%nodes,
}, "urpm::parallel_ssh";
}
diff --git a/urpmi.spec b/urpmi.spec
index 72de6043..258ce2cf 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 4.0
-Release: 4mdk
+Release: 5mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
@@ -177,6 +177,12 @@ fi
%changelog
+* Tue Aug 27 2002 François Pons <fpons@mandrakesoft.com> 4.0-5mdk
+- fixed urpmq --auto-select disabling its selection.
+- open read-only rpmdb when testing installation (--test).
+- added reverse media parameter from parallel configuration.
+- improved error management of parallel extension module.
+
* Mon Aug 26 2002 François Pons <fpons@mandrakesoft.com> 4.0-4mdk
- english typo fixed.
- improved skip.list contents to provides using sense and regexp
diff --git a/urpmq b/urpmq
index 0df80787..386b3642 100755
--- a/urpmq
+++ b/urpmq
@@ -81,7 +81,7 @@ for (@ARGV) {
/^--media$/ and do { push @nextargv, \$query->{media}; next };
/^--mediums$/ and do { push @nextargv, \$query->{media}; next };
/^--synthesis$/ and do { push @nextargv, \$query->{synthesis}; next };
- /^--auto-select$/ and do { $query->{upgrade} = $query->{auto_select} = 1; next };
+ /^--auto-select$/ and do { $query->{deps} = $query->{upgrade} = $query->{auto_select} = 1; next };
/^--fuzzy$/ and do { $query->{fuzzy} = 1; next };
/^--list$/ and do { $query->{list} = 1; next };
/^--src$/ and do { $query->{src} = 1; next };