diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | HACKING.md | 13 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | debian/control | 15 | ||||
| -rw-r--r-- | debian/gbp.conf | 1 | ||||
| -rw-r--r-- | debian/not-installed | 1 | ||||
| -rwxr-xr-x | debian/rules | 21 | ||||
| -rw-r--r-- | dependencies.tsv | 16 | ||||
| -rwxr-xr-x | get-deps.sh | 6 | ||||
| -rwxr-xr-x | run-checks | 30 | ||||
| -rw-r--r-- | spread.yaml | 6 | ||||
| -rw-r--r-- | vendor/vendor.json | 122 |
12 files changed, 172 insertions, 62 deletions
diff --git a/.gitignore b/.gitignore index c075f9adab..ad133b9f3a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ tags cmd/version_generated.go *~ *.swp +vendor/*/ diff --git a/HACKING.md b/HACKING.md index 7947f12e8b..498eec505e 100644 --- a/HACKING.md +++ b/HACKING.md @@ -53,20 +53,19 @@ dependent packages will also be available inside `$GOPATH`. ### Dependencies handling -To generate dependencies.tsv you need `godeps`, so +Dependencies are handled via `govendor`. Get it via: - go get launchpad.net/godeps + go get -u github.com/kardianos/govendor -To obtain the correct dependencies for the project, run (from the -projects root directory): +After a fresh checkout, run: - godeps -t -u dependencies.tsv + govendor sync You can use the script `get-deps.sh` to run the two previous steps. -If the dependencies need updating, run (from the projects root directory): +If a dependency need updating - godeps -t ./... > dependencies.tsv + govendor fetch github.com/path/of/dependency ### Building @@ -4,7 +4,7 @@ The snapd and snap tools enable systems to work with .snap files. See [snapcraft.io](http://snapcraft.io) for a high level overview about snap files and the snapd application. - + ## Development To get started with development off the snapd code itself, please check diff --git a/debian/control b/debian/control index d8c10928c5..9bea781128 100644 --- a/debian/control +++ b/debian/control @@ -9,22 +9,7 @@ Build-Depends: bash-completion, fakeroot, gettext, gnupg2, - golang-check.v1-dev, golang-go, - golang-go-flags-dev, - golang-go.crypto-dev, - golang-github-coreos-go-systemd-dev, - golang-github-gorilla-mux-dev, - golang-github-gosexy-gettext-dev, - golang-github-mvo5-goconfigparser-dev, - golang-github-peterh-liner-dev, - golang-pb-dev, - golang-pty-dev, - golang-github-mvo5-uboot-go-dev, - golang-yaml.v2-dev, - golang-gopkg-macaroon.v1-dev, - golang-gopkg-tomb.v2-dev, - golang-websocket-dev, python3, python3-markdown, squashfs-tools diff --git a/debian/gbp.conf b/debian/gbp.conf index 00883c141c..70910254ba 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -1,3 +1,4 @@ [DEFAULT] debian-branch = master export-dir = ../build-area +postexport = govendor sync diff --git a/debian/not-installed b/debian/not-installed new file mode 100644 index 0000000000..708d871fab --- /dev/null +++ b/debian/not-installed @@ -0,0 +1 @@ +debian/tmp/usr/bin/uboot-go diff --git a/debian/rules b/debian/rules index ecc1743e52..0af8cd3d7f 100755 --- a/debian/rules +++ b/debian/rules @@ -12,6 +12,20 @@ export PATH:=${PATH}:${CURDIR} RELEASE = $(shell lsb_release -c -s) +# The go tool does not fully support vendoring with gccgo, but we can +# work around that by constructing the appropriate -I flag by hand. +GCCGO := $(shell go tool dist env > /dev/null 2>&1 && echo no || echo yes) + +GCCGOFLAGS= +ifeq ($(GCCGO),yes) +GOARCH := $(shell go env GOARCH) +GOOS := $(shell go env GOOS) + +GCCGOFLAGS=-gccgoflags="-I $(CURDIR)/_build/pkg/gccgo_$(GOOS)_$(GOARCH)/$(DH_GOPKG)/vendor" +export DH_GOLANG_GO_GENERATE=0 +endif + +# check if we need to include the testkeys in the binary TAGS= ifneq (,$(filter testkeys,$(DEB_BUILD_OPTIONS))) TAGS=-tags withtestkeys @@ -23,10 +37,11 @@ endif override_dh_auto_build: mkdir -p _build/src/$(DH_GOPKG)/cmd/snap/test-data cp -a cmd/snap/test-data/*.gpg _build/src/$(DH_GOPKG)/cmd/snap/test-data/ - dh_auto_build -- $(TAGS) + dh_auto_build -- $(TAGS) $(GCCGOFLAGS) + override_dh_auto_test: - dh_auto_test + dh_auto_test -- $(GCCGOFLAGS) ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) # check that only the main trusted account-key is included [ $$(strings _build/bin/snapd|grep -c -E "public-key-sha3-384: [a-zA-Z0-9_-]{64}") -eq 1 ] @@ -89,6 +104,8 @@ override_dh_auto_install: snap.8 rm -rf ${CURDIR}/debian/snapd/usr/share/gocode # we do not like /usr/bin/snappy anymore rm -f ${CURDIR}/debian/tmp/usr/bin/snappy + # no uboot-go + rm -f ${CURDIR}/debian/tmp/usr/bin/uboot-go snap.8: $(CURDIR)/_build/bin/snap help --man > $@ diff --git a/dependencies.tsv b/dependencies.tsv deleted file mode 100644 index 745bc52a7a..0000000000 --- a/dependencies.tsv +++ /dev/null @@ -1,16 +0,0 @@ -github.com/cheggaaa/pb git e8c7cc515bfde3e267957a3b110080ceed51354e 2014-12-02T07:01:21Z -github.com/coreos/go-systemd git f743bc15d6bddd23662280b4ad20f7c874cdd5ad 2014-05-03T19:37:39Z -github.com/gorilla/context git 1c83b3eabd45b6d76072b66b746c20815fb2872d 2015-08-20T05:12:45Z -github.com/gorilla/mux git ee1815431e497d3850809578c93ab6705f1a19f7 2015-08-20T05:15:06Z -github.com/gorilla/websocket git 234959944d9cf05229b02e8b386e5cffe1e4e04a 2016-01-28T16:48:56Z -github.com/gosexy/gettext git 98b7b91596d20b96909e6b60d57411547dd9959c 2013-02-21T11:21:43Z -github.com/jessevdk/go-flags git 6b9493b3cb60367edd942144879646604089e3f7 2016-02-27T09:34:38Z -github.com/mvo5/goconfigparser git 26426272dda20cc76aa1fa44286dc743d2972fe8 2015-02-12T09:37:50Z -github.com/mvo5/uboot-go git 361f6ebcbb54f389d15dc9faefa000e996ba3e37 2015-07-22T06:53:46Z -github.com/testing-cabal/subunit-go git 00b258565a5cf3adaa24b68d31c9e6ec3d2cdbe7 2015-11-09T18:16:47Z -golang.org/x/crypto git 611beeb3d5df450a45f4b67f9e25235f54beda72 2016-08-03T21:26:26Z -gopkg.in/check.v1 git 64131543e7896d5bcc6bd5a76287eb75ea96c673 2014-10-24T13:38:53Z -gopkg.in/macaroon.v1 git ab3940c6c16510a850e1c2dd628b919f0f3f1464 2015-01-21T11:42:31Z -gopkg.in/tomb.v2 git 14b3d72120e8d10ea6e6b7f87f7175734b1faab8 2014-06-26T14:46:23Z -gopkg.in/tylerb/graceful.v1 git 842f31108f8d3512ce3176d00bf1a32db1d5e3af 2016-08-15T06:12:21Z -gopkg.in/yaml.v2 git 49c95bdc21843256fb6c4e0d370a05f24a0bf213 2015-02-24T22:57:58Z diff --git a/get-deps.sh b/get-deps.sh index 6438ab485b..230ae50ae6 100755 --- a/get-deps.sh +++ b/get-deps.sh @@ -2,9 +2,9 @@ set -eu -echo Installing godeps -go get launchpad.net/godeps +echo Installing govendor +go get -u github.com/kardianos/govendor export PATH=$PATH:$GOPATH/bin echo Obtaining dependencies -godeps -u dependencies.tsv +govendor sync diff --git a/run-checks b/run-checks index 0e75ee457d..454effc31d 100755 --- a/run-checks +++ b/run-checks @@ -81,30 +81,26 @@ if [ "$STATIC" = 1 ]; then ./mdlint.py docs/*.md echo Checking formatting - fmt=$(gofmt -l .) + fmt="" + for pkg in $(go list ./... | grep -v '/vendor/' ); do + s="$(gofmt -l $GOPATH/src/$pkg)" + if [ -n "$s" ]; then + fmt="$s\n$fmt" + fi + done if [ -n "$fmt" ]; then - echo "Formatting wrong in following files" + echo "Formatting wrong in following files:" echo "$fmt" exit 1 fi # go vet echo Running vet - go vet ./... - - # golint - echo Install golint - go get github.com/golang/lint/golint - export PATH=$PATH:$GOPATH/bin - - echo Running lint - lint=$(golint ./...) - if [ -n "$lint" ]; then - echo "Lint complains:" - echo "$lint" - # don't exit 1 - fi + for pkg in $(go list ./... | grep -v '/vendor/' ); do + go vet $pkg + done + fi if [ "$UNIT" = 1 ]; then @@ -120,7 +116,7 @@ if [ "$UNIT" = 1 ]; then # tests echo Running tests from $(pwd) - for pkg in $(go list ./...); do + for pkg in $(go list ./... | grep -v '/vendor/' ); do $goctest -v -coverprofile=.coverage/profile.out $pkg append_coverage .coverage/profile.out done diff --git a/spread.yaml b/spread.yaml index 7364b2c560..b6a5958427 100644 --- a/spread.yaml +++ b/spread.yaml @@ -71,7 +71,7 @@ prepare: | apt purge -y snapd || true apt update # utilities - apt install -y devscripts expect jq rng-tools software-properties-common + apt install -y devscripts expect jq rng-tools software-properties-common git # needed so that we have golang-gopkg-macaroon.v1 which is not (yet) # in trusty @@ -81,6 +81,10 @@ prepare: | apt build-dep -y ./ + # update vendoring + go get -u github.com/kardianos/govendor + govendor sync + # FIXME: this can be removed once snap-confine 1.0.38-0ubuntu0.16.04.8 # hits xenial-updates apt install -y snap-confine diff --git a/vendor/vendor.json b/vendor/vendor.json new file mode 100644 index 0000000000..b7c7b0a59a --- /dev/null +++ b/vendor/vendor.json @@ -0,0 +1,122 @@ +{ + "comment": "", + "ignore": "test", + "package": [ + { + "checksumSHA1": "f4UJKXymPS31lDRMfsmPA4PvwVw=", + "path": "github.com/cheggaaa/pb", + "revision": "6e9d17711bb763b26b68b3931d47f24c1323abab", + "revisionTime": "2016-08-12T10:57:48Z" + }, + { + "checksumSHA1": "ab0MZfSfbTzqPQ1lVEJWpzZ5PJM=", + "path": "github.com/coreos/go-systemd/activation", + "revision": "f743bc15d6bddd23662280b4ad20f7c874cdd5ad", + "revisionTime": "2014-05-03T19:37:39Z" + }, + { + "checksumSHA1": "iIUYZyoanCQQTUaWsu8b+iOSPt4=", + "path": "github.com/gorilla/context", + "revision": "1c83b3eabd45b6d76072b66b746c20815fb2872d", + "revisionTime": "2015-08-20T05:12:45Z" + }, + { + "checksumSHA1": "8jXj6IMkk1B0LdIYgVG5Vn01/NU=", + "path": "github.com/gorilla/mux", + "revision": "ee1815431e497d3850809578c93ab6705f1a19f7", + "revisionTime": "2015-08-20T05:15:06Z" + }, + { + "checksumSHA1": "2fapauoMahGWxKJdjdqpKfJpAOM=", + "path": "github.com/gorilla/websocket", + "revision": "234959944d9cf05229b02e8b386e5cffe1e4e04a", + "revisionTime": "2016-01-28T16:48:56Z" + }, + { + "checksumSHA1": "e0K21bVI674WQms/1HjP1m1hOVE=", + "path": "github.com/gosexy/gettext", + "revision": "98b7b91596d20b96909e6b60d57411547dd9959c", + "revisionTime": "2013-02-21T11:21:43Z" + }, + { + "checksumSHA1": "Fsff4Yngdyqbq9ulSyTT4LGrxck=", + "path": "github.com/jessevdk/go-flags", + "revision": "6b9493b3cb60367edd942144879646604089e3f7", + "revisionTime": "2016-02-27T09:34:14Z" + }, + { + "checksumSHA1": "bzUdFxQ29mPK0lwgFVcF0GFN74Q=", + "path": "github.com/mvo5/goconfigparser", + "revision": "26426272dda20cc76aa1fa44286dc743d2972fe8", + "revisionTime": "2015-02-12T09:37:50Z" + }, + { + "checksumSHA1": "VV5OVESr0GIy7mRuCjpve1U4/zM=", + "path": "github.com/mvo5/uboot-go", + "revision": "361f6ebcbb54f389d15dc9faefa000e996ba3e37", + "revisionTime": "2015-07-22T06:53:40Z" + }, + { + "checksumSHA1": "33255TmqBPhD+hcO4kzuzyJc23o=", + "path": "github.com/mvo5/uboot-go/uenv", + "revision": "361f6ebcbb54f389d15dc9faefa000e996ba3e37", + "revisionTime": "2015-07-22T06:53:40Z" + }, + { + "checksumSHA1": "G1Zy6KNKWSz6Nx6GAgaKM2yPDLg=", + "path": "github.com/testing-cabal/subunit-go", + "revision": "00b258565a5cf3adaa24b68d31c9e6ec3d2cdbe7", + "revisionTime": "2015-11-09T18:16:47Z" + }, + { + "checksumSHA1": "E28iXtNf9DZVsymruqAnTFGNNnE=", + "path": "golang.org/x/crypto", + "revision": "351dc6a5bf92a5f2ae22fadeee08eb6a45aa2d93", + "revisionTime": "2016-08-24T13:50:57Z", + "tree": true + }, + { + "checksumSHA1": "9jjO5GjLa0XF/nfWihF02RoH4qc=", + "path": "golang.org/x/net/context", + "revision": "6250b412798208e6c90b03b7c4f226de5aa299e2", + "revisionTime": "2016-08-24T22:20:41Z" + }, + { + "checksumSHA1": "WHc3uByvGaMcnSoI21fhzYgbOgg=", + "path": "golang.org/x/net/context/ctxhttp", + "revision": "6250b412798208e6c90b03b7c4f226de5aa299e2", + "revisionTime": "2016-08-24T22:20:41Z" + }, + { + "checksumSHA1": "XeOje6FklwIZfFMTgE583al/ZDo=", + "path": "gopkg.in/check.v1", + "revision": "64131543e7896d5bcc6bd5a76287eb75ea96c673", + "revisionTime": "2014-10-24T13:38:53Z" + }, + { + "checksumSHA1": "mWrTCVjXPLevlqKUqpzSoEM3tu8=", + "path": "gopkg.in/macaroon.v1", + "revision": "ab3940c6c16510a850e1c2dd628b919f0f3f1464", + "revisionTime": "2015-01-21T11:42:31Z" + }, + { + "checksumSHA1": "WiyCOMvfzRdymImAJ3ME6aoYUdM=", + "path": "gopkg.in/tomb.v2", + "revision": "14b3d72120e8d10ea6e6b7f87f7175734b1faab8", + "revisionTime": "2014-06-26T14:46:23Z" + }, + { + "checksumSHA1": "hiOUviIMDKo7y918uBiEhfJyOkk=", + "path": "gopkg.in/tylerb/graceful.v1", + "revision": "50a48b6e73fcc75b45e22c05b79629a67c79e938", + "revisionTime": "2016-08-29T01:00:30Z" + }, + { + "checksumSHA1": "TXfll3dCoaPKSntwHO0yR8eZ4JY=", + "path": "gopkg.in/yaml.v2", + "revision": "49c95bdc21843256fb6c4e0d370a05f24a0bf213", + "revisionTime": "2015-02-24T22:57:58Z" + } + ], + "rootPath": "github.com/snapcore/snapd" +} |
