updatedep.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env bash
  2. # A script for updating godep dependencies for the vendored directory /cmd/
  3. # without pulling in etcd itself as a dependency.
  4. #
  5. # update depedency
  6. # 1. edit glide.yaml with version, git SHA
  7. # 2. run ./scripts/updatedep.sh
  8. # 3. it automatically detects new git SHA, and vendors updates to cmd/vendor directory
  9. #
  10. # add depedency
  11. # 1. run ./scripts/updatedep.sh github.com/USER/PROJECT#^1.0.0
  12. # OR
  13. # ./scripts/updatedep.sh github.com/USER/PROJECT#9b772b54b3bf0be1eec083c9669766a56332559a
  14. # 2. make sure glide.yaml and glide.lock are updated
  15. if ! [[ "$0" =~ "scripts/updatedep.sh" ]]; then
  16. echo "must be run from repository root"
  17. exit 255
  18. fi
  19. rm -rf vendor
  20. mv cmd/vendor vendor
  21. # TODO: glide doesn't play well with symlink
  22. echo "manually deleting etcd-repo symlink in vendor"
  23. rm -f vendor/github.com/coreos/etcd
  24. GLIDE_ROOT="$GOPATH/src/github.com/Masterminds/glide"
  25. GLIDE_SHA=cfde1caa6b394a320fc65c5abc77646d18febff9
  26. go get -d -u github.com/Masterminds/glide
  27. pushd "${GLIDE_ROOT}"
  28. git reset --hard ${GLIDE_SHA}
  29. go install
  30. popd
  31. GLIDE_VC_ROOT="$GOPATH/src/github.com/sgotti/glide-vc"
  32. GLIDE_VC_SHA=d96375d23c85287e80296cdf48f9d21c227fa40a
  33. go get -d -u github.com/sgotti/glide-vc
  34. pushd "${GLIDE_VC_ROOT}"
  35. git reset --hard ${GLIDE_VC_SHA}
  36. go install
  37. popd
  38. if [ -n "$1" ]; then
  39. echo "glide get on $(echo $1)"
  40. glide get --strip-vendor --skip-test $1
  41. else
  42. echo "glide update on *"
  43. glide update --strip-vendor --skip-test
  44. fi;
  45. echo "removing test files"
  46. glide vc --only-code --no-tests
  47. mv vendor cmd/
  48. echo "recreating symlink to etcd"
  49. ln -s ../../../../ cmd/vendor/github.com/coreos/etcd
  50. echo "done"