Update `README`s to document `dep`-based workflow. (#606)

This commit is contained in:
Igor Mandrigin 2018-02-02 18:44:29 +01:00 committed by GitHub
parent 77de41d0fa
commit 6728dcf06d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 47 deletions

View File

@ -14,7 +14,7 @@ It's written in Go and requires Go 1.8 or above.
It uses Makefile to do most common actions. See `make help` output for available commands.
status-go uses [forked ethereum-go](https://github.com/status-im/go-ethereum) with [some patches applied](https://github.com/status-im/status-go/geth-patches/) in it, located under [`vendor/` dir](https://github.com/status-im/status-go/tree/develop/vendor/github.com/ethereum/go-ethereum). See [geth-patches README](https://github.com/status-im/status-go/tree/develop/geth-patches) for more info.
status-go uses [forked ethereum-go](https://github.com/status-im/go-ethereum) with [some patches applied](./geth-patches/) in it, located under [`vendor/`](./vendor/github.com/ethereum/go-ethereum) directory. See [geth-patches README](./geth-patches/README.md) for more info.
# Build
There are two main modes status-go can be built:

View File

@ -9,13 +9,14 @@ We try to minimize number and amount of changes in those patches as much as poss
# Patches
- `0000-accounts-hd-keys.patch` — adds support for HD extended keys (links/docs?)
- `0002-les-api-status.patch` — adds StatusBackend into LES code (need to be inspected, some things can and should be done outside of les code)
- `0003-dockerfiles-wnode-swarm.patch` — adds Dockerfiles (who uses this?)
- `0004-whisper-notifications.patch` — adds Whisper notifications (need to be reviewed and documented)
- `0006-latest-cht.patch` updates CHT root hashes, should be updated regularly to keep sync fast, until proper Trusted Checkpoint sync is not implemented as part of LES/2 protocol.
- `0007-README.patch` — update upstream README.md.
- `0008-tx-pool-nonce.patch` - On GetTransactionCount request with PendingBlockNumber get the nonce from transaction pool
- [`0000-accounts-hd-keys.patch`](./0000-accounts-hd-keys.patch) — adds support for HD extended keys (links/docs?)
- [`0002-les-api-status.patch`](./0002-les-api-status.patch) — adds StatusBackend into LES code (need to be inspected, some things can and should be done outside of les code
- [`0003-dockerfiles-wnode-swarm.patch`](./0003-dockerfiles-wnode-swarm.patch) — adds Dockerfiles (who uses this?)
- [`0004-whisper-notifications.patch`](./0004-whisper-notifications.patch) — adds Whisper notifications (need to be reviewed and documented)
- [`0006-latest-cht.patch`](./0006-latest-cht.patch) updates CHT root hashes, should be updated regularly to keep sync fast, until proper Trusted Checkpoint sync is not implemented as part of LES/2 protocol.
- [`0007-README.patch`](./0007-README.patch) — update upstream README.md.
- [`0008-tx-pool-nonce.patch`](./0008-tx-pool-nonce.patch) - On GetTransactionCount request with PendingBlockNumber get the nonce from transaction pool
- [`0010-geth-17-fix-npe-in-filter-system.patch`](./0010-geth-17-fix-npe-in-filter-system.patch) - Temp patch for 1.7.x to fix a NPE in the filter system
# Updating upstream version
@ -23,31 +24,24 @@ When a new stable release of `go-ethereum` comes out, we need to upgrade our for
**Note: The process is completely repeatable, so it's safe to remove current `go-ethereum` directory, clone latest upstream version and apply patches from scratch.**
## How to update forked version
Make sure you have `status-go` in your `$GOPATH/src/github.com/status-im/` first.
### From very scratch
Use this method if you're up to nuke forked repo for some reason and apply patches from scratch:
```
# from scratch
rm -rf $GOPATH/src/github.com/status-im/go-ethereum
cd $GOPATH/src/github.com/status-im/
git clone https://github.com/ethereum/go-ethereum
# update remote url to point to our fork repo
git remote set-url origin git@github.com:status-im/go-ethereum.git
```
### Using existing fork repo (recommended)
```
# merge upstream release branch into local master
git pull git@github.com:ethereum/go-ethereum.git release/1.7:master
#### I. In our fork at /status-im/go-ethereum.
1. Remove the local `develop` branch.
```bash
git branch -D develop
```
### Apply patches
2. Pull upstream release branch into `develop` branch.
```bash
git pull git@github.com:ethereum/go-ethereum.git <release_branch>:develop
```
In our case `<release_branch>` would be `release/1.7` because the current stable version is
1.7.x.
3. Apply patches
```bash
for patch in $GOPATH/src/github.com/status-im/status-go/geth-patches/*.patch;
do
patch -p1 < $patch;
@ -55,29 +49,27 @@ done
```
Once patches applied, you might want to inspect changes between current vendored version and newly patched version by this command:
```
```bash
diff -Nru -x "*_test.go" -x "vendor" -x ".git" -x "tests" -x "build" --brief $GOPATH/src/github.com/status-im/go-ethereum $GOPATH/src/github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum
```
# Vendor patched version
## Using `dep` tool
TBD
## Manually
This method should be used only while `dep` tool workflow is not set up.
4. Push `develop` branch to our remote, rewriting history
```bash
git push -f origin develop
```
# remove existing version from vendor
rm -rf $GOPATH/src/github.com/status-im/vendor/github.com/ethereum/go-ethereum/
# copy whole directory
cp -a $GOPATH/src/github.com/status-im/go-ethereum $GOPATH/src/github.com/status-im/status-go/vendor/github.com/ethereum/
#### II. In status-go repository
# remove unneeded folders
cd $GOPATH/src/github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum
rm -rf .git tests build vendor
# remove _test.go files
find . -type f -name "*_test.go" -exec rm '{}' ';'
1. Update vendored `go-ethereum` (note that we use upstream's address there, we override the download link to our fork address in `Gopkg.toml`)
```bash
dep ensure --update github.com/ethereum/go-ethereum
```
`Gopkg.lock` will change and files within `vendor/ethereum/go-ethereum`.
2. Run tests
```bash
make ci
```
3. Commit & push changes, create a PR