diff options
author | Shlomi Fish <shlomif@iglu.org.il> | 2016-07-11 10:53:26 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-07-11 11:07:35 +0200 |
commit | a0067ef8d20f28f6947e2669a700b07319a147d5 (patch) | |
tree | 98fe561183ff2420bbec4a01586840eb23dac917 | |
parent | 5ae9d970ebf2f365e388757b5a884095cf51ffbb (diff) | |
download | urpmi-a0067ef8d20f28f6947e2669a700b07319a147d5.tar urpmi-a0067ef8d20f28f6947e2669a700b07319a147d5.tar.gz urpmi-a0067ef8d20f28f6947e2669a700b07319a147d5.tar.bz2 urpmi-a0067ef8d20f28f6947e2669a700b07319a147d5.tar.xz urpmi-a0067ef8d20f28f6947e2669a700b07319a147d5.zip |
adapt to aria2c-1.16+ output (mga#16500)
aria2c > 1.14 changed the output of the progress download string
it's no longer what follows:
"[#1 SIZE:176.0KiB/2.5MiB(6%) CN:3 SPD:256.22KiBs ETA:09s]"
but here is the new one from aria2c 1.16 and beyond:
"[#2c8dae 496KiB/830KiB(59%) CN:1 DL:84KiB ETA:3s]"
So the old parser no longer works...
The string parser has been rewritten by Shlomi Fish with use of
multiline mode and comments for better readability, should aria2c
progress download string change again
Dug & fixed by Giuseppe Ghibò <ghibomgx@gmail.com> and Shlomi Fish
<shlomif@shlomifish.org>
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | urpm/download.pm | 27 |
2 files changed, 25 insertions, 3 deletions
@@ -3,6 +3,7 @@ o s/suggests/recommends/ - bash completion: o add --deploops & --debug-librpm +- fix reporting progress with newer aria2 (mga#16500) - library: o fix unmarking packages as potential orphans when downgrading (mga#16149) - prefer http mirrors when using a mirrorlist, this avoids selecting an rsync diff --git a/urpm/download.pm b/urpm/download.pm index 8fe9256d..4de9e316 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -694,7 +694,7 @@ sub sync_aria2 { "/usr/bin/aria2c", $options->{debug} ? ('--log', "$options->{dir}/.aria2.log") : @{[]}, '--auto-file-renaming=false', '--ftp-pasv', - '--summary-interval=0', + '--summary-interval=1', '--follow-metalink=mem', $medium->{mirrorlist} ? ( '--metalink-enable-unique-protocol=true', # do not try to connect to the same server using the same protocol @@ -762,8 +762,29 @@ sub _parse_aria2_output { propagate_sync_callback($options, 'start', $file) if !$options->{is_retry}; } - #parses aria2c: [#1 SIZE:176.0KiB/2.5MiB(6%) CN:3 SPD:256.22KiBs ETA:09s] - if ($buf =~ m!^\[#\d*\s+\S+:([\d\.]+\w*).([\d\.]+\w*)\S([\d]+)\S+\s+\S+\s*([\d\.]+)\s\w*:([\d\.]+\w*)\s\w*:(\d+\w*)\]$!) { + + # aria2c 1.16 and beyond: + # parses aria2c: [#2c8dae 496KiB/830KiB(59%) CN:1 DL:84KiB ETA:3s] + # + # using multiline mode and comments for better readability: + # + if ($buf =~ m! + ^\[\#[\dA-Fa-f]+ # match #2c8dae + \s+ + ([\d\.]+\w*) # Match 496KiB + / + ([\d\.]+\w*) # Match 830KiB + \s* \( (\d+) % \) # Match (59%) + \s+ + CN:(\S+) # Match CN:1 + \s+ + DL:(\S+) # Match DL:84KiB + \s+ + ETA:(\w+) + \]$ + !msx + ) + { my ($total, $percent, $speed, $eta) = ($2, $3, $5, $6); #- $1 = current downloaded size, $4 = connections if (propagate_sync_callback($options, 'progress', $file, $percent, $total, $eta, $speed) eq 'canceled') { |