From 170345ed730ff801de7a3230a3727fcb70383ffa Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 11 Dec 2002 11:27:17 +0000 Subject: 4.1-12mdk --- rpm-find-leaves | 2 +- urpm.pm | 36 +++++++++++++++++++----------------- urpme | 6 +++++- urpmi.spec | 6 +++++- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/rpm-find-leaves b/rpm-find-leaves index 5c7fb496..3ab5a470 100644 --- a/rpm-find-leaves +++ b/rpm-find-leaves @@ -5,7 +5,7 @@ use URPM; my @packages; { - my $db = URPM::DB::open; + my $db = URPM::DB::open or die; $db->traverse(sub { my ($p) = @_; $p->pack_header; diff --git a/urpm.pm b/urpm.pm index 43c64a8c..b6f3911a 100644 --- a/urpm.pm +++ b/urpm.pm @@ -101,7 +101,7 @@ Locale::gettext::textdomain ("urpmi"); sub _ { my ($format, @params) = @_; - sprintf(Locale::gettext::gettext($format), @params); + sprintf(Locale::gettext::gettext($format || ''), @params); } #- create a new urpm object. @@ -181,8 +181,8 @@ sub set_proxy { } #- quoting/unquoting a string that may be containing space chars. -sub quotespace { local $_ = $_[0]; s/(\s)/\\$1/g; $_ } -sub unquotespace { local $_ = $_[0]; s/\\(\s)/$1/g; $_ } +sub quotespace { local $_ = $_[0] || ''; s/(\s)/\\$1/g; $_ } +sub unquotespace { local $_ = $_[0] || ''; s/\\(\s)/$1/g; $_ } #- syncing algorithms, currently is implemented wget and curl methods, #- webfetch is trying to find the best (and one which will work :-) @@ -225,7 +225,7 @@ sub sync_wget { my $options = shift @_; system "/usr/bin/wget", (ref $options && set_proxy({type => "wget", proxy => $options->{proxy}})), - (ref $options && $options->{quiet} ? ("-q") : ("-nv")), "-NP", + (ref $options && $options->{quiet} ? ("-q") : ("-nv")), "--retr-symlinks", "-NP", (ref $options ? $options->{dir} : $options), @_; $? == 0 or die _("wget failed: exited with %d or signal %d\n", $? >> 8, $? & 127); } @@ -457,16 +457,18 @@ sub probe_medium { #- there is a little more to do at this point as url is not known, inspect directly list file for it. unless ($medium->{url}) { my %probe; - local *L; - open L, "$urpm->{statedir}/$medium->{list}"; - while () { - #- /./ is end of url marker in list file (typically generated by a - #- find . -name "*.rpm" > list - #- for exportable list file. - /^(.*)\/\.\// and $probe{$1} = undef; - /^(.*)\/[^\/]*$/ and $probe{$1} = undef; - } - close L; + if (-r "$urpm->{statedir}/$medium->{list}") { + local *L; + open L, "$urpm->{statedir}/$medium->{list}"; + while () { + #- /./ is end of url marker in list file (typically generated by a + #- find . -name "*.rpm" > list + #- for exportable list file. + /^(.*)\/\.\// and $probe{$1} = undef; + /^(.*)\/[^\/]*$/ and $probe{$1} = undef; + } + close L; + } foreach (sort { length($a) <=> length($b) } keys %probe) { if ($medium->{url}) { $medium->{url} eq substr($_, 0, length($medium->{url})) or @@ -487,8 +489,8 @@ sub probe_medium { $urpm->probe_removable_device($medium); #- clear URLs for trailing /es. - $medium->{url} =~ s|(.*?)/*$|$1|; - $medium->{clear_url} =~ s|(.*?)/*$|$1|; + $medium->{url} and $medium->{url} =~ s|(.*?)/*$|$1|; + $medium->{clear_url} and $medium->{clear_url} =~ s|(.*?)/*$|$1|; $medium; } @@ -497,7 +499,7 @@ sub probe_medium { sub probe_removable_device { my ($urpm, $medium) = @_; - if ($medium->{url} =~ /^removable_?([^_:]*)(?:_[^:]*)?:/) { + if ($medium->{url} && $medium->{url} =~ /^removable_?([^_:]*)(?:_[^:]*)?:/) { $medium->{removable} ||= $1 && "/dev/$1"; } else { delete $medium->{removable}; diff --git a/urpme b/urpme index a5a58a78..8442e4a7 100644 --- a/urpme +++ b/urpme @@ -193,7 +193,11 @@ if (@toremove > @l && !$auto) { =~ /[$noexpr]/ and exit 0; } -$urpm->install(\@toremove, {}, {}); +@l = $urpm->install(\@toremove, {}, {}); +if (@l) { + print STDERR _("Removing failed") . ":\n" . join("\n", map { "\t$_" } @l); + exit 1; +} sub toMb { my $nb = $_[0] / 1024 / 1024; diff --git a/urpmi.spec b/urpmi.spec index 20fd1d0b..bc7fa0d7 100644 --- a/urpmi.spec +++ b/urpmi.spec @@ -2,7 +2,7 @@ Name: urpmi Version: 4.1 -Release: 11mdk +Release: 12mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -204,6 +204,10 @@ fi %changelog +* Wed Dec 11 2002 François Pons 4.1-12mdk +- fix symlink download with wget. +- urpme now print possible errors. + * Tue Dec 10 2002 François Pons 4.1-11mdk - fixed source installation in / when installing dependencies. - added --install-src to avoid probing on root/user mode. -- cgit v1.2.1