Browse code

move deps installation to vendor.sh script

Wes Morgan authored on 2013/08/27 07:51:22
Showing 3 changed files
... ...
@@ -14,3 +14,4 @@ docs/_templates
14 14
 .gopath/
15 15
 .dotcloud
16 16
 *.test
17
+vendor/
... ...
@@ -35,7 +35,7 @@ run	apt-get install -y -q mercurial
35 35
 # Install Go
36 36
 run	curl -s https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz | tar -v -C /usr/local -xz
37 37
 env	PATH	/usr/local/go/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
38
-env	GOPATH	/go
38
+env	GOPATH	/go:/vendor
39 39
 env	CGO_ENABLED 0
40 40
 run	cd /tmp && echo 'package main' > t.go && go test -a -i -v
41 41
 # Ubuntu stuff
... ...
@@ -50,15 +50,10 @@ run	/bin/echo -e '[default]\naccess_key=$AWS_ACCESS_KEY\nsecret_key=$AWS_SECRET_
50 50
 # Runtime dependencies
51 51
 run	apt-get install -y -q iptables
52 52
 run	apt-get install -y -q lxc
53
-# Download dependencies
54
-run	PKG=github.com/kr/pty REV=27435c699;		 git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV
55
-run	PKG=github.com/gorilla/context/ REV=708054d61e5; git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV
56
-run	PKG=github.com/gorilla/mux/ REV=9b36453141c;	 git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV
57
-run	PKG=github.com/dotcloud/tar/ REV=e5ea6bb21a3294;	 git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV
58
-run	PKG=code.google.com/p/go.net/ REV=84a4013f96e0;  hg  clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && hg  checkout    $REV
59 53
 volume	/var/lib/docker
60 54
 workdir	/go/src/github.com/dotcloud/docker
61 55
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
62 56
 entrypoint ["hack/dind"]
63 57
 # Upload docker source
58
+add 	vendor	/vendor
64 59
 add	.       /go/src/github.com/dotcloud/docker
65 60
new file mode 100755
... ...
@@ -0,0 +1,29 @@
0
+#!/bin/bash
1
+
2
+# Downloads dependencies into vendor/ directory
3
+if [[ ! -d vendor ]]; then
4
+  mkdir vendor
5
+fi
6
+vendor_dir=${PWD}/vendor
7
+
8
+git_clone () {
9
+  PKG=$1
10
+  REV=$2
11
+  if [[ ! -d src/$PKG ]]; then
12
+    cd $vendor_dir && git clone http://$PKG src/$PKG && cd src/$PKG && git checkout -f $REV
13
+  fi
14
+}
15
+
16
+git_clone github.com/kr/pty 27435c699
17
+
18
+git_clone github.com/gorilla/context/ 708054d61e5
19
+
20
+git_clone github.com/gorilla/mux/ 9b36453141c
21
+
22
+git_clone github.com/dotcloud/tar/ d06045a6d9
23
+
24
+# Docker requires code.google.com/p/go.net/websocket
25
+PKG=code.google.com/p/go.net REV=84a4013f96e0
26
+if [[ ! -d src/$PKG ]]; then
27
+  cd $vendor_dir && hg clone https://$PKG src/$PKG && cd src/$PKG && hg checkout -r $REV
28
+fi