diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-09-03 16:21:58 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-09-03 16:21:58 +0000 |
commit | 3ffc5a717900ac77f3d3f108e6e7bf86008f0795 (patch) | |
tree | 8fb0313137ff0329b58c8c7c4b03b99827b386cc | |
parent | d9181e69c5d65a225ddba5d57d8d67de34e7bb22 (diff) | |
download | urpmi-3ffc5a717900ac77f3d3f108e6e7bf86008f0795.tar urpmi-3ffc5a717900ac77f3d3f108e6e7bf86008f0795.tar.gz urpmi-3ffc5a717900ac77f3d3f108e6e7bf86008f0795.tar.bz2 urpmi-3ffc5a717900ac77f3d3f108e6e7bf86008f0795.tar.xz urpmi-3ffc5a717900ac77f3d3f108e6e7bf86008f0795.zip |
don't deconstruct $files in _create_metalink_(), use $rel_files instead
-rw-r--r-- | urpm/download.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/urpm/download.pm b/urpm/download.pm index 5d6a9305..83c6709f 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -788,7 +788,7 @@ sub sync_rel { $urpm->{debug} and $urpm->{debug}(N("retrieving %s", $files_text)); eval { - _sync_webfetch_raw($urpm, $medium, \@files, _all_options($urpm, $medium, \%options)); + _sync_webfetch_raw($urpm, $medium, $rel_files, \@files, _all_options($urpm, $medium, \%options)); $urpm->{log}(N("retrieved %s", $files_text)); 1; }; @@ -829,8 +829,10 @@ sub get_content { #- syncing algorithms. +#- +#- nb: $files is constructed from $rel_files using $medium sub _sync_webfetch_raw { - my ($urpm, $medium, $files, $options) = @_; + my ($urpm, $medium, $rel_files, $files, $options) = @_; #- currently ftp and http protocols are managed by curl or wget, #- ssh and rsync protocols are managed by rsync *AND* ssh. @@ -871,7 +873,7 @@ sub _sync_webfetch_raw { # FIXME: This is rather crude and should probably be done some better place. if ($options->{metalink}) { - _create_metalink_($urpm, $medium, \@l, $options); + @l = _create_metalink_($urpm, $medium, $rel_files, $options); } while (@l) { my $half_MAX_ARG = 131072 / 2; @@ -896,7 +898,7 @@ sub _take_n_elem { } sub _create_metalink_ { - my ($urpm, $medium, $files, $options) = @_; + my ($urpm, $medium, $rel_files, $options) = @_; # Don't create a metalink when downloading mirror list $medium or return; @@ -915,9 +917,8 @@ sub _create_metalink_ { # only use the 8 best mirrors, then we let aria2 choose my @mirrors = _take_n_elem(8, @{$mirrors->{list}}); - foreach my $append (@$files) { - $append =~ s/$mirrors->{chosen}//; - push @metalink, qq(\t<file name=") . basename($append) . qq(">); + foreach my $rel_file (@$rel_files) { + push @metalink, qq(\t<file name=") . basename($rel_file) . qq(">); push @metalink, qq(\t\t<resources>); my $i = 0; @@ -938,16 +939,17 @@ sub _create_metalink_ { push @options, qq(maxconnections=") . $mirror->{connections} . qq("); } push @options, 'location="' . lc($mirror->{zone}) . '"'; + my $base = urpm::mirrors::_add__with_dir($mirror->{url}, $medium->{'with-dir'}); push @metalink, - sprintf(qq(\t\t\t<url %s>%s%s</url>), join(' ', @options), $mirror->{url}, $append); + sprintf(qq(\t\t\t<url %s>%s/%s</url>), join(' ', @options), $base, $rel_file); } push @metalink, "\t\t</resources>"; push @metalink, "\t</file>"; - $append = "$metalinkfile:$append"; } push @metalink, "</files>", "</metalink>"; output_safe($metalinkfile, join('', map { "$_\n" } @metalink)); + $metalinkfile; } 1; |