Skip to content

Commit b750b33

Browse files
committed
Merge #10276: contrib/verifybinaries: allow filtering by platform
8d4dafd contrib/verifybinaries: allow filtering by platform (Andres G. Aragoneses) Tree-SHA512: 5c117d18fd6e73cdbbf39c610f521bccb32ca7100eb8d5d5ed9c664514c37b32bd2f94f357b64c34f7c093e0c09312ecff330b7f5c708700d4b48643780ebac5
2 parents ffce893 + 8d4dafd commit b750b33

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

contrib/verifybinaries/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ The script returns 0 if everything passes the checks. It returns 1 if either the
2626
./verify.sh bitcoin-core-0.13.0-rc3
2727
```
2828

29+
If you only want to download the binaries of certain platform, add the corresponding suffix, e.g.:
30+
31+
```sh
32+
./verify.sh bitcoin-core-0.11.2-osx
33+
./verify.sh 0.12.0-linux
34+
./verify.sh bitcoin-core-0.13.0-rc3-win64
35+
```
36+
2937
If you do not want to keep the downloaded binaries, specify anything as the second parameter.
3038

3139
```sh

contrib/verifybinaries/verify.sh

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,36 @@ if [ -n "$1" ]; then
4242
VERSION="$VERSIONPREFIX$1"
4343
fi
4444

45-
#now let's see if the version string contains "rc", and strip it off if it does
46-
# and simultaneously add RCSUBDIR to BASEDIR, where we will look for SIGNATUREFILENAME
47-
if [[ $VERSION == *"$RCVERSIONSTRING"* ]]; then
48-
BASEDIR="$BASEDIR${VERSION/%-$RCVERSIONSTRING*}/"
49-
BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSIONSTRING${VERSION: -1}/"
45+
STRIPPEDLAST="${VERSION%-*}"
46+
47+
#now let's see if the version string contains "rc" or a platform name (e.g. "osx")
48+
if [[ "$STRIPPEDLAST-" == "$VERSIONPREFIX" ]]; then
49+
BASEDIR="$BASEDIR$VERSION/"
5050
else
51+
# let's examine the last part to see if it's rc and/or platform name
52+
STRIPPEDNEXTTOLAST="${STRIPPEDLAST%-*}"
53+
if [[ "$STRIPPEDNEXTTOLAST-" == "$VERSIONPREFIX" ]]; then
54+
55+
LASTSUFFIX="${VERSION##*-}"
56+
VERSION="$STRIPPEDLAST"
57+
58+
if [[ $LASTSUFFIX == *"$RCVERSIONSTRING"* ]]; then
59+
RCVERSION="$LASTSUFFIX"
60+
else
61+
PLATFORM="$LASTSUFFIX"
62+
fi
63+
64+
else
65+
RCVERSION="${STRIPPEDLAST##*-}"
66+
PLATFORM="${VERSION##*-}"
67+
68+
VERSION="$STRIPPEDNEXTTOLAST"
69+
fi
70+
5171
BASEDIR="$BASEDIR$VERSION/"
72+
if [[ $RCVERSION == *"$RCVERSIONSTRING"* ]]; then
73+
BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSION/"
74+
fi
5275
fi
5376

5477
SIGNATUREFILE="$BASEDIR$SIGNATUREFILENAME"
@@ -92,12 +115,22 @@ if [ $RET -ne 0 ]; then
92115
exit "$RET"
93116
fi
94117

118+
if [ -n "$PLATFORM" ]; then
119+
grep $PLATFORM $TMPFILE > "$TMPFILE-plat"
120+
TMPFILESIZE=$(stat -c%s "$TMPFILE-plat")
121+
if [ $TMPFILESIZE -eq 0 ]; then
122+
echo "error: no files matched the platform specified" && exit 3
123+
fi
124+
mv "$TMPFILE-plat" $TMPFILE
125+
fi
126+
95127
#here we extract the filenames from the signature file
96128
FILES=$(awk '{print $2}' "$TMPFILE")
97129

98130
#and download these one by one
99131
for file in $FILES
100132
do
133+
echo "Downloading $file"
101134
wget --quiet -N "$BASEDIR$file"
102135
done
103136

0 commit comments

Comments
 (0)