diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-05-04 12:40:03 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-05-04 12:40:03 +0000 |
commit | 36a40c56f44d643af3a12eb925727934ca772ce3 (patch) | |
tree | 483851cfd9e07f0b674a38365f78c359f9bb48cf /urpm | |
parent | 79e34e9a0c7a397d26b54c55182e57656e2596fd (diff) | |
download | urpmi-36a40c56f44d643af3a12eb925727934ca772ce3.tar urpmi-36a40c56f44d643af3a12eb925727934ca772ce3.tar.gz urpmi-36a40c56f44d643af3a12eb925727934ca772ce3.tar.bz2 urpmi-36a40c56f44d643af3a12eb925727934ca772ce3.tar.xz urpmi-36a40c56f44d643af3a12eb925727934ca772ce3.zip |
- invoke "curl -h" only once
- avoid empty command-line arguments to rsync
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/download.pm | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/urpm/download.pm b/urpm/download.pm index f28afe46..27319bf3 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -179,7 +179,8 @@ sub sync_curl { open my $curl, join(" ", map { "'$_'" } "/usr/bin/curl", ($options->{limit_rate} ? ("--limit-rate", $options->{limit_rate}) : ()), ($options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()), - "--stderr", "-", "-s", "-I", @ftp_files) . " |"; + "--stderr", "-", # redirect everything to stdout + "-s", "-I", @ftp_files) . " |"; while (<$curl>) { if (/Content-Length:\s*(\d+)/) { !$cur_ftp_file || exists($ftp_files_info{$cur_ftp_file}{size}) @@ -215,7 +216,12 @@ sub sync_curl { } } } - #- http files (and other files) are correctly managed by curl to conditionnal download. + # Indicates whether this option is available in our curl + our $location_trusted; + if (!defined $location_trusted) { + $location_trusted = `/usr/bin/curl -h` =~ /location-trusted/ ? 1 : 0; + } + #- http files (and other files) are correctly managed by curl wrt conditional download. #- options for ftp files, -R (-O <file>)* #- options for http files, -R (-z file -O <file>)* if (my @all_files = ( @@ -230,8 +236,10 @@ sub sync_curl { ($options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()), ($options->{quiet} && !$options->{verbose} ? "-s" : @{[]}), "-k", - `curl -h` =~ /location-trusted/ ? "--location-trusted" : @{[]}, - "-R", "-f", "--stderr", "-", + $location_trusted ? "--location-trusted" : @{[]}, + "-R", + "-f", + "--stderr", "-", # redirect everything to stdout @all_files) . " |"; local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). while (<$curl>) { @@ -293,8 +301,6 @@ sub sync_rsync { my $count = 10; #- retry count on error (if file exists). my $basename = basename($_); my ($file) = m!^rsync://[^\/]*::! ? (m|^rsync://(.*)|) : ($_); - #my ($file) = m|^rsync://(.*)| or next; - #$file =~ /::/ or $file = $_; propagate_sync_callback($options, 'start', $file); do { local $_; @@ -302,8 +308,8 @@ sub sync_rsync { open my $rsync, join(" ", "/usr/bin/rsync", ($limit_rate ? "--bwlimit=$limit_rate" : ()), ($options->{quiet} ? qw(-q) : qw(--progress -v)), - ($options->{compress} and qw(-z)), - ($options->{ssh} and qw(-e ssh)), + ($options->{compress} ? qw(-z) : ()), + ($options->{ssh} ? qw(-e ssh) : ()), qw(--partial --no-whole-file), "'$file' '$options->{dir}' |"); local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). |