[pacman-dev] [RFC] curl-based internal downloader
Dave Reisner
d at falconindy.com
Sun Jan 2 20:13:20 EST 2011
Greetings,
I've been working on and off on a curl-based internal downloader to replace the
libfetch based implementation. Why?
- libcurl is more widely used in the arch repos. fetch is used for one and only
package: pacman.
- support for compression over http connections. I see proposals for adding
this to fetch, but never any acceptance. Please correct me if I'm mistaken.
- personal bias. not really a reason, but I think the implementation is cleaner
and more readable than the fetch equivalent.
- dan wanted me to. (the devil made me do it?)
In it's current form, I'd say this patch set is 90% complete. I've been using it
on top of pacman-git for about a week now and haven't come across any functional
issues. I've done a fair bit of testing with ftp, http, and file based sync'ing.
So what's remaining?
- setting pm_errno: libfetch provides a global variable fetchLastErrString,
whereas curl returns error codes (CURLcode) from operations and you feed them
to curl_easy_strerror() to get a char* back. I'm not sure what the best way
is to get back an error string from curl when (what will be) PM_ERR_LIBCURL
is set. could the global handle be used to store the CURLcode (it's just a
typedef'd long).
- the progress bar does _not_ play well with curl. The bar itself is fine, but the
time remaining jumps around a fair bit. You'll see a fair bit of hackery in
curl_progress() (lib/libalpm/dload.c) where I'm fighting with the progress
bar. Perhaps this belongs in the progress bar voodoo itself?
- my autoconf-fu sucks. Big time. I'm not sure what I've done is best practice,
but after applying patch 3/4, compiling without extra flags links in curl
and leaves out fetch. There is, however, no checking for both --with-curl and
--with-fetch being given, which will break the build.
Dan (and anyone else), I look forward to your tower of constructive criticism.
dave
configure.ac | 33 ++++---
lib/libalpm/alpm.c | 13 +--
lib/libalpm/dload.c | 263 ++++++++++++++++++++++++++++++---------------------
3 files changed, 176 insertions(+), 133 deletions(-)
More information about the pacman-dev
mailing list