glide: update lock and add util scripts

This commit is contained in:
Ethan Buchman
2016-07-23 12:13:41 -04:00
parent ce97902897
commit eac43dc62b
9 changed files with 63 additions and 6 deletions

View File

@@ -0,0 +1,34 @@
#! /bin/bash
# for every github.com/tendermint dependency, warn is if its not synced with origin/master
GLIDE=$1
# make list of libs
LIBS=($(grep "github.com/tendermint" $GLIDE | awk '{print $3}'))
for lib in "${LIBS[@]}"; do
# get vendored commit
VENDORED=`grep -A1 $lib $GLIDE | grep -v $lib | awk '{print $2}'`
PWD=`pwd`
cd $GOPATH/src/$lib
MASTER=`git rev-parse origin/master`
HEAD=`git rev-parse HEAD`
cd $PWD
if [[ "$VENDORED" != "$MASTER" ]]; then
echo ""
if [[ "$VENDORED" != "$HEAD" ]]; then
echo "Vendored version of $lib differs from origin/master and HEAD"
echo "Vendored: $VENDORED"
echo "Master: $MASTER"
echo "Head: $HEAD"
else
echo "Vendored version of $lib differs from origin/master but matches HEAD"
echo "Vendored: $VENDORED"
echo "Master: $MASTER"
fi
fi
done

View File

@@ -0,0 +1,23 @@
#! /bin/bash
set -euo pipefail
IFS=$'\n\t'
# script to update the given dependency in the glide.lock file with the checked out branch on the local host
GLIDE=$1
LIB=$2
# get vendored commit for given lib
function parseGlide() {
cat $1 | grep -A1 $2 | grep -v $2 | awk '{print $2}'
}
OLD_COMMIT=`parseGlide $GLIDE $LIB`
PWD=`pwd`
cd $GOPATH/src/github.com/tendermint/$LIB
NEW_COMMIT=$(git rev-parse HEAD)
cd $PWD
sed -i "s/$OLD_COMMIT/$NEW_COMMIT/g" $GLIDE