Repository: calcite-avatica-go Updated Branches: refs/heads/master 44f797acb -> a1c9c656d
[CALCITE-2536] Update release script to check self-referential import paths and go.mod to ensure that they have the right version of avatica-go Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/a1c9c656 Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/tree/a1c9c656 Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/diff/a1c9c656 Branch: refs/heads/master Commit: a1c9c656dbf8b9147f5335bb3353c3b658bc1eff Parents: 44f797a Author: Francis Chuang <[email protected]> Authored: Mon Sep 10 19:53:28 2018 +1000 Committer: Francis Chuang <[email protected]> Committed: Mon Sep 10 19:53:28 2018 +1000 ---------------------------------------------------------------------- make-release-artifacts.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/blob/a1c9c656/make-release-artifacts.sh ---------------------------------------------------------------------- diff --git a/make-release-artifacts.sh b/make-release-artifacts.sh index 84634d1..9e114cd 100755 --- a/make-release-artifacts.sh +++ b/make-release-artifacts.sh @@ -55,6 +55,39 @@ if ! grep -Fq "Copyright 2012-$(date +%Y)" NOTICE; then exit 1 fi +tagMajorVersion=$(echo $tag | sed -e 's/\..*//') + +# Check that go.mod's module path contains the right version +if ! grep -Fq "module github.com/apache/calcite-avatica-go/$tagMajorVersion" go.mod; then + echo "module declaration in go.mod does not contain the correct version. Expected: $tagMajorVersion" + exit 1 +fi + +# Make sure import paths contain the correct version +badImportPaths=false + +for i in $(git ls-files); do + + if [[ "$i" == "make-release-artifacts.sh" ]]; then + continue + fi + + lines=$(grep -F '"github.com/apache/calcite-avatica-go' $i) + + if ! [[ -z "$lines" ]]; then + while read -r line; do + if ! grep -q "github.com/apache/calcite-avatica-go/$tagMajorVersion" <<< "$line" ; then + badImportPaths=true + echo "import for github.com/apache/calcite-avatica-go in $i does not have the correct version ($tagMajorVersion) in its path" + fi + done <<< "$lines" + fi +done + +if "$badImportPaths" == true; then + exit 1 +fi + # Check that Avatica versions in both gen-protobuf.bat and gen-protobuf.sh match EXPECTED_AVATICA_VERSION=$(grep -oP '^export AVATICA_VER="\K[^"]+' gen-protobuf.sh)
