summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-02-02 23:21:43 -0500
committerDave Reisner <d@falconindy.com>2011-03-09 15:22:32 -0500
commit4ad4527d104c915efa912d3e1e3a543fad7aca34 (patch)
tree63a1c870a6ad0a3006e1f0998668052d8edfca43
parent96e458b705eda4ddff7d6ec890cf1daf898e9186 (diff)
downloadpacman-4ad4527d104c915efa912d3e1e3a543fad7aca34.tar.xz
dload: temp patch to allow curl/fetch coexistance
this is just some debuggery to allow pacman to operate with both fetch and curl at the same time. use the PACMANDL variable to control which library is used. Signed-off-by: Dave Reisner <d@falconindy.com>
-rw-r--r--lib/libalpm/dload.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 22fee543..51dda5e2 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -561,8 +561,22 @@ cleanup:
static int download(const char *url, const char *localpath,
int force) {
if(handle->fetchcb == NULL) {
-#ifdef HAVE_LIBFETCH
+#if defined(HAVE_LIBFETCH) && defined(HAVE_LIBCURL)
+ const char *pmdownloader = getenv("PACMANDL");
+ if(!pmdownloader || strcmp(pmdownloader, "curl") == 0) {
+ printf(">> using libcurl as internal downloader\n");
+ return(curl_download_internal(url, localpath, force));
+ } else if(strcmp(pmdownloader, "fetch") == 0) {
+ printf(">> using libfetch as internal downloader\n");
+ return(fetch_download_internal(url, localpath, force));
+ } else {
+ _alpm_log(PM_LOG_ERROR, "PACMANDL unset or invalid! Use `curl' or `fetch'\n");
+ return(-1);
+ }
+#elif HAVE_LIBFETCH
return(fetch_download_internal(url, localpath, force));
+#elif HAVE_LIBCURL
+ return(curl_download_internal(url, localpath, force));
#else
RET_ERR(PM_ERR_EXTERNAL_DOWNLOAD, -1);
#endif