aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-04-03 17:55:46 +0800
committerfanquake <fanquake@gmail.com>2020-04-03 18:10:28 +0800
commit6ec42df32b06f8b262f31e40065247dee83f7aa5 (patch)
treec06eaa7e0c5242fc2b6f4bf238ca46e45d5acc14 /contrib/devtools
parentdce6f3b29b4197b8eea91f5919d56eb222ea8959 (diff)
parent332f373a9dece71717f75eb06e6a1fc957f2952b (diff)
downloadbitcoin-6ec42df32b06f8b262f31e40065247dee83f7aa5.tar.xz
Merge #18426: scripts: previous_release: improve behaviour on failed download
332f373a9dece71717f75eb06e6a1fc957f2952b [scripts] previous_release: improve failed download error message (Sebastian Falbesoner) Pull request description: Currently, if the earlier release build/fetch script `previous_release.sh` is invoked with the option `-b` (intending to fetch a binary package from `https://bitcoin.org`) and the download fails, the user sees the following confusing output: ``` $ contrib/devtools/previous_release.sh -r -b v0.9.5 [...] gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now ``` This implies that the download worked, but the archive is corrupted, when in reality the HTML document containing the delivery fail reason (most likely 404 Not Found) is saved and tried to get unpacked. In contrast to wget, curl is a bit stubborn and needs explicit instructions to react to server errors via the flag `-f` (outputs error message and returns error code, ideal for scripts): https://curl.haxx.se/docs/manpage.html#-f On the PR branch, the output on failed download looks now the following: ``` $ contrib/devtools/previous_release.sh -r -b v0.9.5 [...] curl: (22) The requested URL returned error: 404 Not Found Download failed. ``` ACKs for top commit: fanquake: ACK 332f373a9dece71717f75eb06e6a1fc957f2952b Tree-SHA512: 046c931ad9e78aeb2d13faa4866d46122ed325aa142483547c2b04032d03223ed2411783b00106fcab0cd91b2f78691531ac526ed7bb3ed7547b6e2adbfb2e93
Diffstat (limited to 'contrib/devtools')
-rwxr-xr-xcontrib/devtools/previous_release.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/devtools/previous_release.sh b/contrib/devtools/previous_release.sh
index efd035f778..5ddfdb4e73 100755
--- a/contrib/devtools/previous_release.sh
+++ b/contrib/devtools/previous_release.sh
@@ -139,7 +139,10 @@ pushd "$TARGET" || exit 1
fi
URL="https://bitcoin.org/$BIN_PATH/bitcoin-${tag:1}-$PLATFORM.tar.gz"
echo "Fetching: $URL"
- curl -O $URL
+ if ! curl -O -f $URL; then
+ echo "Download failed."
+ exit 1
+ fi
tar -zxf "bitcoin-${tag:1}-$PLATFORM.tar.gz" -C "$tag" --strip-components=1 "bitcoin-${tag:1}"
rm "bitcoin-${tag:1}-$PLATFORM.tar.gz"
fi