Add "update-vendor.sh" script and vendor our current deps (minus Docker, since that'd make a circle)

Also, updated .travis.yml to use the new "vendor" directory (since this is pretty pointless without that :D)

Signed-off-by: Andrew Page <admwiggin@gmail.com>
This commit is contained in:
Tianon Gravi 2014-08-04 13:31:58 -06:00
parent 68ea1234a0
commit e9f44b52de
5 changed files with 75 additions and 8 deletions

View File

@ -13,13 +13,15 @@ env:
- _GOOS=linux _GOARCH=arm CGO_ENABLED=0 - _GOOS=linux _GOARCH=arm CGO_ENABLED=0
install: install:
- go get code.google.com/p/go.tools/cmd/cover
- mkdir -pv "${GOPATH%%:*}/src/github.com/docker" && [ -d "${GOPATH%%:*}/src/github.com/docker/libcontainer" ] || ln -sv "$(readlink -f .)" "${GOPATH%%:*}/src/github.com/docker/libcontainer" - mkdir -pv "${GOPATH%%:*}/src/github.com/docker" && [ -d "${GOPATH%%:*}/src/github.com/docker/libcontainer" ] || ln -sv "$(readlink -f .)" "${GOPATH%%:*}/src/github.com/docker/libcontainer"
- if [ -z "$TRAVIS_GLOBAL_WTF" ]; then - if [ -z "$TRAVIS_GLOBAL_WTF" ]; then
gvm cross "$_GOOS" "$_GOARCH"; gvm cross "$_GOOS" "$_GOARCH";
export GOOS="$_GOOS" GOARCH="$_GOARCH"; export GOOS="$_GOOS" GOARCH="$_GOARCH";
fi fi
- export GOPATH="$GOPATH:$(pwd)/vendor"
- if [ -z "$TRAVIS_GLOBAL_WTF" ]; then go env; fi - if [ -z "$TRAVIS_GLOBAL_WTF" ]; then go env; fi
- go get -d -v ./... - go get -d -v ./... # TODO remove this if /docker/docker gets purged from our includes
- if [ "$TRAVIS_GLOBAL_WTF" ]; then - if [ "$TRAVIS_GLOBAL_WTF" ]; then
export DOCKER_PATH="${GOPATH%%:*}/src/github.com/docker/docker"; export DOCKER_PATH="${GOPATH%%:*}/src/github.com/docker/docker";
mkdir -p "$DOCKER_PATH/hack/make"; mkdir -p "$DOCKER_PATH/hack/make";
@ -30,5 +32,5 @@ install:
script: script:
- if [ "$TRAVIS_GLOBAL_WTF" ]; then bash "$DOCKER_PATH/hack/make/validate-dco"; fi - if [ "$TRAVIS_GLOBAL_WTF" ]; then bash "$DOCKER_PATH/hack/make/validate-dco"; fi
- if [ "$TRAVIS_GLOBAL_WTF" ]; then bash "$DOCKER_PATH/hack/make/validate-gofmt"; fi - if [ "$TRAVIS_GLOBAL_WTF" ]; then bash "$DOCKER_PATH/hack/make/validate-gofmt"; fi
- if [ -z "$TRAVIS_GLOBAL_WTF" ]; then go build -v ./...; fi - if [ -z "$TRAVIS_GLOBAL_WTF" ]; then make direct-build; fi
- if [ -z "$TRAVIS_GLOBAL_WTF" -a "$GOARCH" != 'arm' ]; then go test -test.short -v ./...; fi - if [ -z "$TRAVIS_GLOBAL_WTF" -a "$GOARCH" != 'arm' ]; then make direct-test-short; fi

View File

@ -1,6 +1,6 @@
FROM crosbymichael/golang FROM crosbymichael/golang
RUN apt-get update && apt-get install -y gcc RUN apt-get update && apt-get install -y gcc make
RUN go get code.google.com/p/go.tools/cmd/cover RUN go get code.google.com/p/go.tools/cmd/cover
# setup a playground for us to spawn containers in # setup a playground for us to spawn containers in
@ -14,8 +14,10 @@ COPY . /go/src/github.com/docker/libcontainer
WORKDIR /go/src/github.com/docker/libcontainer WORKDIR /go/src/github.com/docker/libcontainer
RUN cp sample_configs/minimal.json /busybox/container.json RUN cp sample_configs/minimal.json /busybox/container.json
ENV GOPATH $GOPATH:/go/src/github.com/docker/libcontainer/vendor
RUN go get -d -v ./... RUN go get -d -v ./...
RUN go install -v ./... RUN make direct-install
ENTRYPOINT ["/dind"] ENTRYPOINT ["/dind"]
CMD ["go", "test", "-cover", "./..."] CMD ["make", "direct-test"]

View File

@ -2,3 +2,4 @@ Michael Crosby <michael@docker.com> (@crosbymichael)
Rohit Jnagal <jnagal@google.com> (@rjnagal) Rohit Jnagal <jnagal@google.com> (@rjnagal)
Victor Marmol <vmarmol@google.com> (@vmarmol) Victor Marmol <vmarmol@google.com> (@vmarmol)
.travis.yml: Tianon Gravi <admwiggin@gmail.com> (@tianon) .travis.yml: Tianon Gravi <admwiggin@gmail.com> (@tianon)
update-vendor.sh: Tianon Gravi <admwiggin@gmail.com> (@tianon)

View File

@ -4,7 +4,21 @@ all:
test: test:
# we need NET_ADMIN for the netlink tests and SYS_ADMIN for mounting # we need NET_ADMIN for the netlink tests and SYS_ADMIN for mounting
docker run --rm --cap-add NET_ADMIN --cap-add SYS_ADMIN docker/libcontainer docker run --rm -it --cap-add NET_ADMIN --cap-add SYS_ADMIN docker/libcontainer
sh: sh:
docker run --rm -ti -w /busybox --rm --cap-add NET_ADMIN --cap-add SYS_ADMIN docker/libcontainer nsinit exec sh docker run --rm -it --cap-add NET_ADMIN --cap-add SYS_ADMIN -w /busybox docker/libcontainer nsinit exec sh
GO_PACKAGES = $(shell find . -not \( -wholename ./vendor -prune \) -name '*.go' -print0 | xargs -0n1 dirname | sort -u)
direct-test:
go test -cover -v $(GO_PACKAGES)
direct-test-short:
go test -cover -test.short -v $(GO_PACKAGES)
direct-build:
go build -v $(GO_PACKAGES)
direct-install:
go install -v $(GO_PACKAGES)

48
update-vendor.sh Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "$BASH_SOURCE")"
# Downloads dependencies into vendor/ directory
mkdir -p vendor
cd vendor
clone() {
vcs=$1
pkg=$2
rev=$3
pkg_url=https://$pkg
target_dir=src/$pkg
echo -n "$pkg @ $rev: "
if [ -d $target_dir ]; then
echo -n 'rm old, '
rm -fr $target_dir
fi
echo -n 'clone, '
case $vcs in
git)
git clone --quiet --no-checkout $pkg_url $target_dir
( cd $target_dir && git reset --quiet --hard $rev )
;;
hg)
hg clone --quiet --updaterev $rev $pkg_url $target_dir
;;
esac
echo -n 'rm VCS, '
( cd $target_dir && rm -rf .{git,hg} )
echo done
}
# the following lines are in sorted order, FYI
clone git github.com/codegangsta/cli 1.1.0
clone git github.com/coreos/go-systemd v2
clone git github.com/godbus/dbus v1
clone git github.com/syndtr/gocapability 3c85049eae
# intentionally not vendoring Docker itself... that'd be a circle :)