depot/download: let curl fail on 404 response

Downloading non-existent archives from 'depot.genode.org' leads to
files in the 'public' directory containing the 404 error website
delivered by the HTTP server. Specifying the '--fail' option results
in curl generating an exit-code that leads to the appropriate action
by the tool, e.g.:

 Error: failed to download 'https://depot.genode.org/user/pkg/x/version.tar.xz'

Issue #4865.
This commit is contained in:
Josef Söntgen 2023-05-09 13:34:10 +02:00 committed by Christian Helmuth
parent 3fa275354d
commit bab90d4837

View File

@ -110,7 +110,7 @@ file_url = '${URL($(call archive_user,$1))}/$1'
$(PUBLIC_DIR)/%:
@$(ECHO) "$(DARK_COL)download$(DEFAULT_COL) $*"
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)curl --silent $(call file_url,$*) -o $@ ||\
$(VERBOSE)curl --fail --silent $(call file_url,$*) -o $@ ||\
(echo "Error: failed to download $(call file_url,$*)"; rm -f $@; false)
$(MAKECMDGOALS): $(TARGETS)