From 4ad4527d104c915efa912d3e1e3a543fad7aca34 Mon Sep 17 00:00:00 2001
From: Dave Reisner <d@falconindy.com>
Date: Wed, 2 Feb 2011 23:21:43 -0500
Subject: 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>
---
 lib/libalpm/dload.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'lib/libalpm')

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
-- 
cgit v1.2.3-70-g09d2