summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-12-11 11:27:17 +0000
committerFrancois Pons <fpons@mandriva.com>2002-12-11 11:27:17 +0000
commit170345ed730ff801de7a3230a3727fcb70383ffa (patch)
treea3048f5bfeae9feecae80073440ac108ffda78c7 /urpm.pm
parent933d4974697b7561b1ea880c4b7d9b75d92087bd (diff)
downloadurpmi-170345ed730ff801de7a3230a3727fcb70383ffa.tar
urpmi-170345ed730ff801de7a3230a3727fcb70383ffa.tar.gz
urpmi-170345ed730ff801de7a3230a3727fcb70383ffa.tar.bz2
urpmi-170345ed730ff801de7a3230a3727fcb70383ffa.tar.xz
urpmi-170345ed730ff801de7a3230a3727fcb70383ffa.zip
4.1-12mdk
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm36
1 files changed, 19 insertions, 17 deletions
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 (<L>) {
- #- /./ 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 (<L>) {
+ #- /./ 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};