[PATCH 1/1] test-databases: use wget or curl to download test databases

Subject: [PATCH 1/1] test-databases: use wget or curl to download test databases

Date: Wed, 26 Mar 2014 17:09:51 +0200

To: notmuch@notmuchmail.org

Cc: tomi.ollila@iki.fi

From: Tomi Ollila


On non-Linux systems curl(1) is often the tool of choice.
---
 test/test-databases/Makefile.local | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/test-databases/Makefile.local b/test/test-databases/Makefile.local
index 0572e78..49db87b 100644
--- a/test/test-databases/Makefile.local
+++ b/test/test-databases/Makefile.local
@@ -7,7 +7,13 @@ dir := test/test-databases
 test_databases := $(dir)/database-v1.tar.xz
 
 %.tar.xz:
-	wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@);
+	@exec 1>&2 ;: consistently write everything to stderr... ;\
+	if hash wget 2>/dev/null ;\
+	then set -x; wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@) ;\
+	elif hash curl 2>/dev/null ;\
+	then set -x; curl -s -o $@ ${TEST_DATABASE_MIRROR}/$(notdir $@) ;\
+	else echo Cannot fetch databases, no wget nor curl available; exit 1 ;\
+	fi
 
 download-test-databases: ${test_databases}
 
-- 
1.8.0


Thread: