neo-go/scripts/check_deps.sh
Roman Khimov 09921bb3a4 check_deps: fix the check for stable NeoGo revisions used in nft-nd-nns
vX.Y.Z-date-commit is very much different from vX.Y.Z and we can have any of
them for NeoGo (vX.Y.Z is even preferable). Previous code ended up this way
for v0.106.3:

++ sed -E -n -e 's/.*neo-go\s.+-.+-(\w+)/\1/ p' examples/nft-nd-nns//go.mod
+ NEO_GO_COMMIT=
+ git merge-base --is-ancestor '' HEAD
fatal: Not a valid object name
+ die 'examples/nft-nd-nns/: neo-go commit  was not found in git'
+ echo 'examples/nft-nd-nns/: neo-go commit  was not found in git'
examples/nft-nd-nns/: neo-go commit  was not found in git
+ exit 1

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 11:03:01 +03:00

35 lines
1 KiB
Bash
Executable file

#!/bin/sh
die() {
echo "$*"
exit 1
}
find -name go.mod -print0 |
xargs -0 -n1 grep -o 'pkg/interop v\S*' |
uniq | wc -l |
xargs -I{} -n1 [ 1 -eq {} ] ||
die "Different versions for dependencies in go.mod"
INTEROP_COMMIT="$(sed -E -n -e 's/.*pkg\/interop.+-.+-(\w+)/\1/ p' go.mod)"
git merge-base --is-ancestor "$INTEROP_COMMIT" HEAD ||
die "pkg/interop commit $INTEROP_COMMIT was not found in git"
for dir in examples/*/; do
if [ -z "${dir#*zkp/}" ]; then
continue
fi
INTEROP_COMMIT="$(sed -E -n -e 's/.*pkg\/interop.+-.+-(\w+)/\1/ p' "$dir/go.mod")"
git merge-base --is-ancestor "$INTEROP_COMMIT" HEAD ||
die "$dir: pkg/interop commit $INTEROP_COMMIT was not found in git"
if [ -z "${dir#*nft-nd-nns/}" ]; then
NEO_GO_COMMIT="$(sed -E -n -e 's/.*neo-go\s.+-.+-(\w+)/\1/ p' "$dir/go.mod")"
if [ -z "$NEO_GO_COMMIT" ]; then
NEO_GO_COMMIT="$(sed -E -n -e 's/.*neo-go\s(\w+)/\1/ p' "$dir/go.mod")"
fi
git merge-base --is-ancestor "$NEO_GO_COMMIT" HEAD ||
die "$dir: neo-go commit $NEO_GO_COMMIT was not found in git"
fi
done