33 lines
718 B
Bash
Raw Normal View History

2016-10-12 12:27:37 -04:00
#! /bin/bash
2018-02-28 11:15:40 +04:00
set +u
if [[ "$DEP" == "" ]]; then
DEP=$GOPATH/src/github.com/tendermint/tendermint/Gopkg.lock
fi
set -u
2016-10-12 12:27:37 -04:00
set -u
2018-02-27 17:20:56 +04:00
function getVendoredVersion() {
2018-02-28 11:15:40 +04:00
grep -A100 "$LIB" "$DEP" | grep revision | head -n1 | grep -o '"[^"]\+"' | cut -d '"' -f 2
2016-10-12 12:27:37 -04:00
}
# fetch and checkout vendored dep
2018-02-27 17:20:56 +04:00
lib=$1
2016-10-12 12:27:37 -04:00
echo "----------------------------------"
echo "Getting $lib ..."
2018-02-27 17:20:56 +04:00
go get -t "github.com/tendermint/$lib/..."
2016-10-12 12:27:37 -04:00
2018-02-27 17:20:56 +04:00
VENDORED=$(getVendoredVersion "$lib")
cd "$GOPATH/src/github.com/tendermint/$lib" || exit
2016-10-12 12:27:37 -04:00
MASTER=$(git rev-parse origin/master)
if [[ "$VENDORED" != "$MASTER" ]]; then
echo "... VENDORED != MASTER ($VENDORED != $MASTER)"
echo "... Checking out commit $VENDORED"
2018-02-27 17:20:56 +04:00
git checkout "$VENDORED" &> /dev/null
2016-10-12 12:27:37 -04:00
fi