]> git.notmuchmail.org Git - notmuch/commitdiff
test-databases: use wget or curl to download test databases
authorTomi Ollila <tomi.ollila@iki.fi>
Sun, 12 Mar 2017 12:59:33 +0000 (14:59 +0200)
committerDavid Bremner <david@tethera.net>
Thu, 16 Mar 2017 01:06:12 +0000 (22:06 -0300)
Often Linux systems are shipped with wget(1) by default (and no curl).

Many BSDs, macOS, and e.g. some Linux minimal/container images
comes with curl(1) (and no wget).

Attempting to download with curl if wget is not available increases
the likelihood for this to succeed.

test/test-databases/Makefile.local

index dcc8863c70d8ee973687eb30580e02640e214f3e..7aedff70f6e3df4114f62d32f605d37645d851ca 100644 (file)
@@ -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 ;\
+       if command -v wget >/dev/null ;\
+       then set -x; wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@) ;\
+       elif command -v curl >/dev/null ;\
+       then set -x; curl -L -s -o $@ ${TEST_DATABASE_MIRROR}/$(notdir $@) ;\
+       else echo Cannot fetch databases, no wget nor curl available; exit 1 ;\
+       fi
 
 download-test-databases: ${test_databases}