Adding update-geth target (#673)

This commit is contained in:
Alex Kohler 2018-02-20 13:04:25 -05:00 committed by Igor Mandrigin
parent 59e77571bc
commit c5b9f00467
3 changed files with 31 additions and 6 deletions

View File

@ -174,6 +174,9 @@ dep-ensure: ##@dependencies Dep ensure and apply all patches
dep-install: ##@dependencies Install vendoring tool
go get -u github.com/golang/dep/cmd/dep
update-geth: ##@dependencies Update geth (use GETH_BRANCH to optionally set the geth branch name)
./_assets/ci/update-geth.sh $(GETH_BRANCH)
patch: ##@patching Revert and apply all patches
./_assets/patches/patcher

27
_assets/ci/update-geth.sh Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# This script updates the go-ethereum dependency, optionally updating the branch if GETH_BRANCH is provided.
# If any changes were made, they will be committed.
# Exit early if any errors are encountered
set -e
if [ ! -z "$GETH_BRANCH" ]; then
# escape slashes
GETH_BRANCH=$(echo $GETH_BRANCH | sed 's@\/@\\\/@g')
# Update go-ethereum contraint branch
sed -i 'N;N;s@\(\[\[constraint]]\n name = "github.com\/ethereum\/go-ethereum"\n branch =\)\(.*\)@\1 '"\"${GETH_BRANCH}\""'@g' Gopkg.toml
fi
dep ensure -v -update github.com/ethereum/go-ethereum
if ! make dep-ensure; then
echo "Please fix patches and rerun. (dep-ensure failed)"
exit 1
fi
git add Gopkg.lock Gopkg.toml vendor/ _assets/patches/
if $(git diff --cached --quiet); then
echo "No changes to commit. Geth up to date."
exit 0
fi
git commit --quiet -m "Updating Geth"
echo "Geth updated."

View File

@ -49,12 +49,7 @@ file is changed, `dep ensure` will re-generate `Gopkg.lock` as well.
## Updating `Geth`
1. (for major releases) Update the branch name in `Gopkg.toml`.
2. Update the `go-ethereum` dependency: `dep ensure -v -update github.com/ethereum/go-ethereum`.
3. Update vendor files in `status-go`, and apply patches by running `make dep-ensure`.
4. Commit patches.
5. Commit `Gopkg.lock`, `Gopkg.toml` and `vendor` directories.
Use the `update-geth` make target. For major releases, provide the GETH_BRANCH parameter. (e.g. `make update-geth GETH_BRANCH=release/1.9`). If there were any changes made, they will be committed while running this target.
## Commiting changes