diff options
| author | Tim Hockin <thockin@google.com> | 2016-05-16 12:26:55 -0700 |
|---|---|---|
| committer | Tim Hockin <thockin@google.com> | 2016-05-16 13:15:39 -0700 |
| commit | f11086ed30e2d7db46de6e3cd7017b02ee366849 (patch) | |
| tree | 165bd7806f49db21760adca96e09de3bc83a6ab1 /development.md | |
| parent | b2bfe549a34be0ae48fb7360c9431b03201afc5d (diff) | |
Document godep updates better
`godep update` doesn't work. It just says 'nothing to update'. Drop it, and
use The Big Hammer instead.
Diffstat (limited to 'development.md')
| -rw-r--r-- | development.md | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/development.md b/development.md index 46020fb5..9e008191 100644 --- a/development.md +++ b/development.md @@ -244,25 +244,46 @@ godep restore 4) Next, you can either add a new dependency or update an existing one. +To add a new dependency is simple (if a bit slow): + ```sh -# To add a new dependency, do: cd $KPATH/src/k8s.io/kubernetes -godep get path/to/dependency +DEP=example.com/path/to/dependency +godep get $DEP/... # Now change code in Kubernetes to use the dependency. -hack/godep-save.sh +./hack/godep-save.sh +``` +To update an existing dependency is a bit more complicated. Godep has an +`update` command, but none of us can figure out how to actually make it work. +Instead, this procedure seems to work reliably: -# To update an existing dependency, do: +```sh cd $KPATH/src/k8s.io/kubernetes -go get -u path/to/dependency -# Change code in Kubernetes accordingly if necessary. -godep update path/to/dependency +DEP=example.com/path/to/dependency +# NB: For the next step, $DEP is assumed be the repo root. If it is actually a +# subdir of the repo, use the repo root here. This is required to keep godep +# from getting angry because `godep restore` left the tree in a "detached head" +# state. +rm -rf $KPATH/src/$DEP # repo root +godep get $DEP/... +# Change code in Kubernetes, if necessary. +rm -rf Godeps +rm -rf vendor +./hack/godep-save.sh +git co -- $(git st -s | grep "^ D" | awk '{print $2}' | grep ^Godeps) ``` _If `go get -u path/to/dependency` fails with compilation errors, instead try `go get -d -u path/to/dependency` to fetch the dependencies without compiling them. This is unusual, but has been observed._ +After all of this is done, `git status` should show you what files have been +modified and added/removed. Make sure to `git add` and `git rm` them. It is +commonly advised to make one `git commit` which includes just the dependency +update and Godeps files, and another `git commit` that includes changes to +Kubernetes code to use the new/updated dependency. These commits can go into a +single pull request. 5) Before sending your PR, it's a good idea to sanity check that your Godeps.json file and the contents of `vendor/ `are ok by running `hack/verify-godeps.sh` @@ -276,9 +297,6 @@ It is sometimes expedient to manually fix the /Godeps/Godeps.json file to minimize the changes. However without great care this can lead to failures with `hack/verify-godeps.sh`. This must pass for every PR. -Please send dependency updates in separate commits within your PR, for easier -reviewing. - 6) If you updated the Godeps, please also update `Godeps/LICENSES` by running `hack/update-godep-licenses.sh`. |
