|
@@ -5,10 +5,18 @@ PROJECT=github.com/docker/docker
|
|
|
# Downloads dependencies into vendor/ directory
|
|
|
mkdir -p vendor
|
|
|
|
|
|
-rm -rf .gopath
|
|
|
-mkdir -p .gopath/src/github.com/docker
|
|
|
-ln -sf ../../../.. .gopath/src/${PROJECT}
|
|
|
-export GOPATH="${PWD}/.gopath:${PWD}/vendor"
|
|
|
+if ! go list github.com/docker/docker/docker &> /dev/null; then
|
|
|
+ rm -rf .gopath
|
|
|
+ mkdir -p .gopath/src/github.com/docker
|
|
|
+ ln -sf ../../../.. .gopath/src/${PROJECT}
|
|
|
+ export GOPATH="${PWD}/.gopath:${PWD}/vendor"
|
|
|
+fi
|
|
|
+export GOPATH="$GOPATH:${PWD}/vendor"
|
|
|
+
|
|
|
+find='find'
|
|
|
+if [ "$(go env GOHOSTOS)" = 'windows' ]; then
|
|
|
+ find='/usr/bin/find'
|
|
|
+fi
|
|
|
|
|
|
clone() {
|
|
|
local vcs="$1"
|
|
@@ -120,15 +128,15 @@ clean() {
|
|
|
findArgs+=( -path "vendor/src/$import" )
|
|
|
done
|
|
|
local IFS=$'\n'
|
|
|
- local prune=( $(find vendor -depth -type d -not '(' "${findArgs[@]}" ')') )
|
|
|
+ local prune=( $($find vendor -depth -type d -not '(' "${findArgs[@]}" ')') )
|
|
|
unset IFS
|
|
|
for dir in "${prune[@]}"; do
|
|
|
- find "$dir" -maxdepth 1 -not -type d -not -name 'LICENSE*' -not -name 'COPYING*' -exec rm -v -f '{}' +
|
|
|
+ $find "$dir" -maxdepth 1 -not -type d -not -name 'LICENSE*' -not -name 'COPYING*' -exec rm -v -f '{}' ';'
|
|
|
rmdir "$dir" 2>/dev/null || true
|
|
|
done
|
|
|
|
|
|
echo -n 'pruning unused files, '
|
|
|
- find vendor -type f -name '*_test.go' -exec rm -v '{}' +
|
|
|
+ $find vendor -type f -name '*_test.go' -exec rm -v '{}' ';'
|
|
|
|
|
|
echo done
|
|
|
}
|
|
@@ -140,5 +148,5 @@ fix_rewritten_imports () {
|
|
|
local target="vendor/src/$pkg"
|
|
|
|
|
|
echo "$pkg: fixing rewritten imports"
|
|
|
- find "$target" -name \*.go -exec sed -i -e "s|\"${remove}|\"|g" {} \;
|
|
|
+ $find "$target" -name \*.go -exec sed -i -e "s|\"${remove}|\"|g" {} \;
|
|
|
}
|