diff --git a/hack/make.sh b/hack/make.sh index 7af07a1dd0..69bb580301 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -198,13 +198,13 @@ go_test_dir() { # if our current go install has -cover, we want to use it :) mkdir -p "$DEST/coverprofiles" coverprofile="docker${dir#.}" - coverprofile="$DEST/coverprofiles/${coverprofile//\//-}" + coverprofile="$ABS_DEST/coverprofiles/${coverprofile//\//-}" testcover=( -cover -coverprofile "$coverprofile" $coverpkg ) fi ( - export DEST echo '+ go test' $TESTFLAGS "${DOCKER_PKG}${dir#.}" cd "$dir" + export DEST="$ABS_DEST" # we're in a subshell, so this is safe -- our integration-cli tests need DEST, and "cd" screws it up test_env go test ${testcover[@]} -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS ) } @@ -217,7 +217,7 @@ test_env() { DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \ DOCKER_HOST="$DOCKER_HOST" \ GOPATH="$GOPATH" \ - HOME="$DEST/fake-HOME" \ + HOME="$ABS_DEST/fake-HOME" \ PATH="$PATH" \ TEMP="$TEMP" \ TEST_DOCKERINIT_PATH="$TEST_DOCKERINIT_PATH" \ @@ -272,11 +272,9 @@ hash_files() { } bundle() { - bundlescript=$1 - bundle=$(basename $bundlescript) - echo "---> Making bundle: $bundle (in bundles/$VERSION/$bundle)" - mkdir -p "bundles/$VERSION/$bundle" - source "$bundlescript" "$(pwd)/bundles/$VERSION/$bundle" + local bundle="$1"; shift + echo "---> Making bundle: $(basename "$bundle") (in $DEST)" + source "$SCRIPTDIR/make/$bundle" "$@" } main() { @@ -302,7 +300,14 @@ main() { bundles=($@) fi for bundle in ${bundles[@]}; do - bundle "$SCRIPTDIR/make/$bundle" + export DEST="bundles/$VERSION/$(basename "$bundle")" + # Cygdrive paths don't play well with go build -o. + if [[ "$(uname -s)" == CYGWIN* ]]; then + export DEST="$(cygpath -mw "$DEST")" + fi + mkdir -p "$DEST" + ABS_DEST="$(cd "$DEST" && pwd -P)" + bundle "$bundle" echo done } diff --git a/hack/make/.integration-daemon-start b/hack/make/.integration-daemon-start index eecf682efa..ba1d47bc69 100644 --- a/hack/make/.integration-daemon-start +++ b/hack/make/.integration-daemon-start @@ -2,7 +2,7 @@ # see test-integration-cli for example usage of this script -export PATH="$DEST/../binary:$DEST/../dynbinary:$DEST/../gccgo:$DEST/../dyngccgo:$PATH" +export PATH="$ABS_DEST/../binary:$ABS_DEST/../dynbinary:$ABS_DEST/../gccgo:$ABS_DEST/../dyngccgo:$PATH" if ! command -v docker &> /dev/null; then echo >&2 'error: binary or dynbinary must be run before .integration-daemon-start' diff --git a/hack/make/binary b/hack/make/binary index 7b2af5c849..d7643364db 100644 --- a/hack/make/binary +++ b/hack/make/binary @@ -1,16 +1,10 @@ #!/bin/bash set -e -DEST=$1 BINARY_NAME="docker-$VERSION" BINARY_EXTENSION="$(binary_extension)" BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION" -# Cygdrive paths don't play well with go build -o. -if [[ "$(uname -s)" == CYGWIN* ]]; then - DEST=$(cygpath -mw $DEST) -fi - source "${MAKEDIR}/.go-autogen" echo "Building: $DEST/$BINARY_FULLNAME" diff --git a/hack/make/build-deb b/hack/make/build-deb index 36e11777c3..223b4938a6 100644 --- a/hack/make/build-deb +++ b/hack/make/build-deb @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST=$1 - # subshell so that we can export PATH without breaking other things ( source "${MAKEDIR}/.integration-daemon-start" diff --git a/hack/make/build-rpm b/hack/make/build-rpm index 0f3ff6d00e..3a7bfd4134 100644 --- a/hack/make/build-rpm +++ b/hack/make/build-rpm @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST=$1 - # subshell so that we can export PATH without breaking other things ( source "$(dirname "$BASH_SOURCE")/.integration-daemon-start" diff --git a/hack/make/cover b/hack/make/cover index ca772d03bc..624943b8aa 100644 --- a/hack/make/cover +++ b/hack/make/cover @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST="$1" - bundle_cover() { coverprofiles=( "$DEST/../"*"/coverprofiles/"* ) for p in "${coverprofiles[@]}"; do diff --git a/hack/make/cross b/hack/make/cross index 368ebc5ab9..b5eab68124 100644 --- a/hack/make/cross +++ b/hack/make/cross @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST=$1 - # explicit list of os/arch combos that support being a daemon declare -A daemonSupporting daemonSupporting=( @@ -21,13 +19,15 @@ fi for platform in $DOCKER_CROSSPLATFORMS; do ( - mkdir -p "$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION + export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION + mkdir -p "$DEST" + ABS_DEST="$(cd "$DEST" && pwd -P)" export GOOS=${platform%/*} export GOARCH=${platform##*/} if [ -z "${daemonSupporting[$platform]}" ]; then export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported fi - source "${MAKEDIR}/binary" "$DEST/$platform" + source "${MAKEDIR}/binary" ) done diff --git a/hack/make/dynbinary b/hack/make/dynbinary index e1b65b48ef..e5fc0be262 100644 --- a/hack/make/dynbinary +++ b/hack/make/dynbinary @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST=$1 - if [ -z "$DOCKER_CLIENTONLY" ]; then source "${MAKEDIR}/.dockerinit" diff --git a/hack/make/dyngccgo b/hack/make/dyngccgo index 7bdd404f10..df76ac7f5f 100644 --- a/hack/make/dyngccgo +++ b/hack/make/dyngccgo @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST=$1 - if [ -z "$DOCKER_CLIENTONLY" ]; then source "${MAKEDIR}/.dockerinit-gccgo" diff --git a/hack/make/gccgo b/hack/make/gccgo index 896c2d46c1..972934abe2 100644 --- a/hack/make/gccgo +++ b/hack/make/gccgo @@ -1,7 +1,6 @@ #!/bin/bash set -e -DEST=$1 BINARY_NAME="docker-$VERSION" BINARY_EXTENSION="$(binary_extension)" BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION" diff --git a/hack/make/test-docker-py b/hack/make/test-docker-py index ac5ef35833..cbd59adddb 100644 --- a/hack/make/test-docker-py +++ b/hack/make/test-docker-py @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST=$1 - # subshell so that we can export PATH without breaking other things ( source "${MAKEDIR}/.integration-daemon-start" diff --git a/hack/make/test-integration-cli b/hack/make/test-integration-cli index db1cb298fd..61d62f160a 100644 --- a/hack/make/test-integration-cli +++ b/hack/make/test-integration-cli @@ -1,8 +1,6 @@ #!/bin/bash set -e -DEST=$1 - bundle_test_integration_cli() { go_test_dir ./integration-cli } diff --git a/hack/make/test-unit b/hack/make/test-unit index 7b6ce089e2..1053f61518 100644 --- a/hack/make/test-unit +++ b/hack/make/test-unit @@ -1,7 +1,6 @@ #!/bin/bash set -e -DEST=$1 : ${PARALLEL_JOBS:=$(nproc 2>/dev/null || echo 1)} # if nproc fails (usually because we don't have it), let's not parallelize by default RED=$'\033[31m' @@ -26,10 +25,9 @@ bundle_test_unit() { export LDFLAGS export TESTFLAGS export HAVE_GO_TEST_COVER - export DEST # some hack to export array variables - export BUILDFLAGS_FILE="buildflags_file" + export BUILDFLAGS_FILE="$DEST/buildflags-file" ( IFS=$'\n'; echo "${BUILDFLAGS[*]}" ) > "$BUILDFLAGS_FILE" if command -v parallel &> /dev/null; then @@ -59,7 +57,7 @@ go_run_test_dir() { while read dir; do echo echo '+ go test' $TESTFLAGS "${DOCKER_PKG}${dir#.}" - precompiled="$DEST/precompiled/$dir.test$(binary_extension)" + precompiled="$ABS_DEST/precompiled/$dir.test$(binary_extension)" if ! ( cd "$dir" && test_env "$precompiled" $TESTFLAGS ); then TESTS_FAILED+=("$dir") echo diff --git a/hack/make/tgz b/hack/make/tgz index fa297e1f5e..a512b832d2 100644 --- a/hack/make/tgz +++ b/hack/make/tgz @@ -1,6 +1,5 @@ #!/bin/bash -DEST="$1" CROSS="$DEST/../cross" set -e diff --git a/hack/make/ubuntu b/hack/make/ubuntu index 7543789a18..07265b4a65 100644 --- a/hack/make/ubuntu +++ b/hack/make/ubuntu @@ -1,7 +1,5 @@ #!/bin/bash -DEST=$1 - PKGVERSION="${VERSION//-/'~'}" # if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better if [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then @@ -37,7 +35,7 @@ PACKAGE_LICENSE="Apache-2.0" # Build docker as an ubuntu package using FPM and REPREPRO (sue me). # bundle_binary must be called first. bundle_ubuntu() { - DIR=$DEST/build + DIR="$ABS_DEST/build" # Include our udev rules mkdir -p "$DIR/etc/udev/rules.d" @@ -140,9 +138,9 @@ EOF # create lxc-docker-VERSION package fpm -s dir -C "$DIR" \ --name "lxc-docker-$VERSION" --version "$PKGVERSION" \ - --after-install "$DEST/postinst" \ - --before-remove "$DEST/prerm" \ - --after-remove "$DEST/postrm" \ + --after-install "$ABS_DEST/postinst" \ + --before-remove "$ABS_DEST/prerm" \ + --after-remove "$ABS_DEST/postrm" \ --architecture "$PACKAGE_ARCHITECTURE" \ --prefix / \ --depends iptables \