Browse Source

update some scripts

pull/307/head
Ethan Buchman 8 years ago
parent
commit
f0871e4f5e
4 changed files with 47 additions and 5 deletions
  1. +27
    -0
      scripts/glide/checkout.sh
  2. +3
    -1
      scripts/glide/parse.sh
  3. +3
    -1
      scripts/glide/status.sh
  4. +14
    -3
      scripts/glide/update.sh

+ 27
- 0
scripts/glide/checkout.sh View File

@ -0,0 +1,27 @@
#! /bin/bash
set -u
function parseGlide() {
cat $1 | grep -A1 $2 | grep -v $2 | awk '{print $2}'
}
# fetch and checkout vendored dep
glide=$1
lib=$2
echo "----------------------------------"
echo "Getting $lib ..."
go get -t github.com/tendermint/$lib/...
VENDORED=$(parseGlide $glide $lib)
cd $GOPATH/src/github.com/tendermint/$lib
MASTER=$(git rev-parse origin/master)
if [[ "$VENDORED" != "$MASTER" ]]; then
echo "... VENDORED != MASTER ($VENDORED != $MASTER)"
echo "... Checking out commit $VENDORED"
git checkout $VENDORED &> /dev/null
fi

+ 3
- 1
scripts/glide/parse.sh View File

@ -3,6 +3,8 @@ set -euo pipefail
LIB=$1 LIB=$1
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
if [[ "$GLIDE" == "" ]]; then
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
fi
cat $GLIDE | grep -A1 $LIB | grep -v $LIB | awk '{print $2}' cat $GLIDE | grep -A1 $LIB | grep -v $LIB | awk '{print $2}'

+ 3
- 1
scripts/glide/status.sh View File

@ -2,7 +2,9 @@
# for every github.com/tendermint dependency, warn is if its not synced with origin/master # for every github.com/tendermint dependency, warn is if its not synced with origin/master
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
if [[ "$GLIDE" == "" ]]; then
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
fi
# make list of libs # make list of libs
LIBS=($(grep "github.com/tendermint" $GLIDE | awk '{print $3}')) LIBS=($(grep "github.com/tendermint" $GLIDE | awk '{print $3}'))


+ 14
- 3
scripts/glide/update.sh View File

@ -6,9 +6,12 @@ IFS=$'\n\t'
LIB=$1 LIB=$1
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
TMCORE=$GOPATH/src/github.com/tendermint/tendermint
if [[ "$GLIDE" == "" ]]; then
GLIDE=$TMCORE/glide.lock
fi
OLD_COMMIT=`bash scripts/glide/parse.sh $LIB`
OLD_COMMIT=`bash $TMCORE/scripts/glide/parse.sh $LIB`
PWD=`pwd` PWD=`pwd`
cd $GOPATH/src/github.com/tendermint/$LIB cd $GOPATH/src/github.com/tendermint/$LIB
@ -16,4 +19,12 @@ cd $GOPATH/src/github.com/tendermint/$LIB
NEW_COMMIT=$(git rev-parse HEAD) NEW_COMMIT=$(git rev-parse HEAD)
cd $PWD cd $PWD
sed -i "" "s/$OLD_COMMIT/$NEW_COMMIT/g" $GLIDE
uname -a | grep Linux > /dev/null
if [[ "$?" == 0 ]]; then
# linux
sed -i "s/$OLD_COMMIT/$NEW_COMMIT/g" $GLIDE
else
# mac
sed -i "" "s/$OLD_COMMIT/$NEW_COMMIT/g" $GLIDE
fi

Loading…
Cancel
Save