From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D0EAD6DE17E9 for ; Sun, 12 Mar 2017 06:00:09 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.171 X-Spam-Level: X-Spam-Status: No, score=0.171 tagged_above=-999 required=5 tests=[AWL=0.180, HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fTjxgu_rhW8L for ; Sun, 12 Mar 2017 06:00:08 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 7C4C66DE1683 for ; Sun, 12 Mar 2017 06:00:08 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id 79CC01001F9; Sun, 12 Mar 2017 14:59:34 +0200 (EET) From: Tomi Ollila To: notmuch@notmuchmail.org Cc: tomi.ollila@iki.fi Subject: [PATCH] test-databases: use wget or curl to download test databases Date: Sun, 12 Mar 2017 14:59:33 +0200 Message-Id: <20170312125933.10316-1-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.11.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Mar 2017 13:00:09 -0000 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. --- This is an update to id:1395846591-3490-1-git-send-email-tomi.ollila@iki.fi (~1080 days). Changed 'hash' to 'command -v' and added '-L' to curl options (just to be sure) -- and added more detail to the commit message -- Latest observation was that centos 7 (docker) container image did not have wget(1) but curl(1) there were. David asked whether this a job for configure. For the time being I think this is simplest to use -- any alternative adds unnecessary cohesion between the tool/configuration and this make. If, in the future, we will add more online capabilities to this (test) system, then, perhaps we'd better to make some script (as command) to handle that; now 3 years has passed since my previous version -- and that is good as we'd like to be as offline as possible there. 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 dcc8863c70d8..7aedff70f6e3 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 ;\ + 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} -- 2.11.0