|
| 1 | +# Dependency management in netplugin |
| 2 | +This document explains the steps for vendoring update packages in netplugin |
| 3 | + |
| 4 | +## Table of Contents |
| 5 | +- [Audience](#audience) |
| 6 | +- [Restoring dependencies](#restoring-dependencies) |
| 7 | +- [Adding new dependencies](#adding-new-dependencies) |
| 8 | +- [Updating existing dependencies](#updating-existing-dependencies) |
| 9 | + |
| 10 | +## Audience |
| 11 | +This document is targeted towards the developers looking into or working on |
| 12 | +adding/updating vendored packages in netplugin/Godeps. |
| 13 | + |
| 14 | +## Restoring dependencies |
| 15 | +- netplugin/Godeps/Godeps.json has information about the vendored packages. |
| 16 | +- `godep restore` can be used to copy these packages to $GOPATH/src |
| 17 | +- It restores the packages in $GOPATH to a state expected by netplugin |
| 18 | +- note: changes(if any) in $GOPATH/src will be over-written |
| 19 | +``` |
| 20 | +cd netplugin |
| 21 | +godep restore |
| 22 | +``` |
| 23 | + |
| 24 | +## Adding new dependencies |
| 25 | + |
| 26 | +- Add the new package to your $GOPATH/src |
| 27 | +``` |
| 28 | +go get pkg_url |
| 29 | +``` |
| 30 | + |
| 31 | +- From within the netplugin directory run `godep save`, which will copy relevant |
| 32 | +packages from `$GOPATH/src` to `netplugin/Godeps/_workspace`. It will also update |
| 33 | +`netplugin/Godeps/Godeps.json` |
| 34 | + |
| 35 | +``` |
| 36 | +cd netplugin |
| 37 | +godep save ./... |
| 38 | +``` |
| 39 | + |
| 40 | +- Verify the changes by running `git status` in netplugin directory. |
| 41 | +Verify that package is added to `Godeps/_workspace/src` and that |
| 42 | +`Godeps/Godeps.json` also reflects it |
| 43 | + |
| 44 | +``` |
| 45 | +git status |
| 46 | +``` |
| 47 | + |
| 48 | +## Updating existing dependencies |
| 49 | +- Go to the `$GOPATH/directory` which hosts the package and update the package |
| 50 | +``` |
| 51 | +cd $GOPATH/src/github.com/samalba/dockerclient |
| 52 | +
|
| 53 | +# update the package to the master |
| 54 | +git checkout master |
| 55 | +``` |
| 56 | + |
| 57 | +- From within the netplugin directory execute a `godep update pkg` to update the |
| 58 | +Godeps |
| 59 | +``` |
| 60 | +godep udpate github.com/samalba/dockerclient |
| 61 | +``` |
| 62 | + |
| 63 | +- Verify the changes by running `git status` in netplugin directory. |
| 64 | +Verify that package is added to `Godeps/_workspace/src` and that |
| 65 | +`Godeps/Godeps.json` also reflects the version change |
| 66 | + |
| 67 | +``` |
| 68 | +git status |
| 69 | +``` |
| 70 | + |
| 71 | + |
0 commit comments