[pacman-dev] [PATCH] Normalize alpm download callback function's args to frontend
In response to my recent patches attempting to fix pacman's repetitive output with --noprogressbar, agregory kindly pointed out an obvious error I missed and suggested that I tackle the problem by making alpm's download callback function return normalized output[1]. [1]: https://wiki.archlinux.org/index.php/User:Apg#download_callback I deviated only slightly from his suggested spec. - When the total download size is unknown, return before calling the frontend's callback function. This is libalpm's original behavior. - Do not attempt to report download errors. I don't see any indication in the curl docs that it's possible for the progress function to be called after a download error. I'm happy to add either of those conditions, of course. Oh, and agregory was quite right: a side effect of this change is that it fixes the repeating-output bug that my previous, more complicated patches attempted to. As always, I welcome critiques. iff
From: Ivy Foster
On 09/07/16 13:11, ivy.foster@gmail.com wrote:
From: Ivy Foster
When curl calls alpm's dlcb, alpm calls the frontend's cb with the following (dlsize, totalsize) arguments:
0, -1: initialize 0, 0: no change since last call x {x>0, x
0}: data downloaded, total size known x {x>0}, x: download finished If total size is not known, do not call frontend cb (no change to original behavior); alpm's callback shouldn't be called if there is a download error.
See agregory's original spec here: https://wiki.archlinux.org/index.php/User:Apg#download_callback
Implementing the full idea from Andrew is probably still worthwhile. But this gets the main parts done and is an improvement so I am accepting. Thanks, Allan
participants (2)
-
Allan McRae
-
ivy.foster@gmail.com