kalu icon indicating copy to clipboard operation
kalu copied to clipboard

Add support to configure different download method

Open gumik opened this issue 8 years ago • 5 comments

It would be really nice if kalu could support diffent download method. That's what can be configured in pacman via the following line in config file: XferCommand = /usr/bin/curl -C - -f %u > %o As kalu is reading pacman.conf, it may read this option too. I did small research and call to alpm_option_set_fetchcb function should be done when initializing alpm library in kalu and kalu-dbus. You can see how it's done in pacman source code: src/pacman/conf.c:799

gumik avatar Jan 19 '17 13:01 gumik

Well, it's not as easy as you seem to think/make it out to be I'm afraid.

That call to alpm_option_set_fetchcb() you link to does set a function as callback, one that needs to be implemented - here in pacman, and would have to be as well in kalu.

Of course, pacman can assume that when they exec curl, the user will get download feedback from curl, it being called from a terminal and all.

Not so much with kalu though, where kalu can't do any progress bars anymore, and no output from curl (or whatever is used) is shown to the user either. So at least there would be the need to get the output and show it to the user, knowning that is wouldn't be in a tty so it's more limited, etc

In the end, it's a lot of trouble I'm not really interested in, and not sure it's worth it either, to be honest.

jjk-jacky avatar Jan 19 '17 17:01 jjk-jacky

Good point. There will be no support for progress bars. My motivation for this is that in work I'm behind proxy server which parses each file through anti-virus software. In effect, when you download any bigger file, you don't get any content for several dozens seconds. Default alpm download method timeouts after 10 seconds. It means that I'm unable to upgrade any package from kalu. There may be of course other solution for this problem. But I didn't find any way to adjust timeout value. Do you know if it can be modified somehow? I think I need to dig into libalpm code to check how it's done and if it's configurable.

I did quick (and ugly) implementation for curl support. Just copied callback method from pacman. It works well. Of course progress bars have two states only, 0% - 100%. I think it's not a big issue. At least much less than unable to download anything. May be useful for any user behind corporate proxy.

gumik avatar Jan 20 '17 09:01 gumik

There's been talk about an option to do that on pacman-dev ML[1], it hasn't happened/been applied yet but maybe you can apply the patch in the mean time - though you seem to have done similar work already.

[1] https://lists.archlinux.org/pipermail/pacman-dev/2016-December/021698.html

jjk-jacky avatar Jan 20 '17 10:01 jjk-jacky

Oh, great! That would be exactly what I want. When this patch will be applied, are you good to make use of this setting in kalu?

gumik avatar Jan 20 '17 10:01 gumik

Absolutely, I intend to.

jjk-jacky avatar Jan 20 '17 11:01 jjk-jacky