update-status-go: does not need to depend on make shell

The dependency on `make shell` is confusing and unnecessary since
`update-status-go.sh` script only requires availability of the
`nix-prefetch-url` utility to check SHA256 of the `status-go` verison.

Use of `make shell` with this script can also cause issues when running
`make run-android` if already in the shell, which prevents spawning a
new one and effectively stops changes to `status-go-verison.json` file
taking effect.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-09-14 22:16:42 +02:00
parent 4f4651baac
commit a76e4666de
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 18 additions and 17 deletions

View File

@ -1,31 +1,30 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ ! -x "$(command -v nix-prefetch-url)" ]] && [[ -z "${IN_NIX_SHELL}" ]]; then GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
echo "Remember to call 'make shell'!" source "${GIT_ROOT}/nix/scripts/source.sh"
if [[ ! -x "$(command -v nix-prefetch-url)" ]]; then
echo "No 'nix-prefetch-url' utility found!" >&2
exit 1 exit 1
fi fi
set -ef set -ef
# urlencode <string>
urlencode() { urlencode() {
# urlencode <string> old_lc_collate=$LC_COLLATE
LC_COLLATE=C
old_lc_collate=$LC_COLLATE local length="${#1}"
LC_COLLATE=C for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
local length="${#1}" case $c in
for (( i = 0; i < length; i++ )); do [a-zA-Z0-9.~_-]) printf '%s' "$c";;
local c="${1:$i:1}" *) printf '%%%02X' "'$c";;
case $c in
[a-zA-Z0-9.~_-]) printf '%s' "$c" ;;
*) printf '%%%02X' "'$c" ;;
esac esac
done done
LC_COLLATE=$old_lc_collate LC_COLLATE=$old_lc_collate
} }
GIT_ROOT="$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)"
VERSION_FILE="${GIT_ROOT}/status-go-version.json" VERSION_FILE="${GIT_ROOT}/status-go-version.json"
SCRIPT_FILE="$(basename "$0")" SCRIPT_FILE="$(basename "$0")"
@ -97,7 +96,8 @@ STATUS_GO_SHA256=$(nix-prefetch-url --unpack ${REPO_URL}/archive/$(urlencode ${S
cat << EOF > ${VERSION_FILE} cat << EOF > ${VERSION_FILE}
{ {
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead", "_comment": "THIS SHOULD NOT BE EDITED BY HAND.",
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "${STATUS_GO_OWNER}", "owner": "${STATUS_GO_OWNER}",
"repo": "${STATUS_GO_REPO}", "repo": "${STATUS_GO_REPO}",
"version": "${STATUS_GO_VERSION}", "version": "${STATUS_GO_VERSION}",

View File

@ -1,5 +1,6 @@
{ {
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead", "_comment": "THIS SHOULD NOT BE EDITTED BY HAND.",
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.86.3", "version": "v0.86.3",