diff --git a/hack/make.sh b/hack/make.sh index 7af07a1dd064254f3583eb4b3e77d43184943f25..69bb58030193f9ad846dbd5060e9173dd8e14043 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 eecf682efa318486b16dbf36b7941c570ffd846f..ba1d47bc69b61a3717f5fa4ab0a3986c737bcf6a 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 7b2af5c84974345c21d3f7beadaac281dbaa229a..d7643364dbd5c53082a39ba96283f209d56e45f2 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 36e11777c349405c56016fdcbc35e704cf3c8c89..223b4938a6eeb23c2fdb84300a781a92943a524b 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 0f3ff6d00e73b7676ffcadfa158fa4cce82cd998..3a7bfd413497a7e5d039da3ebfa291ae949453e3 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 ca772d03bc755afda7d9940431b4e05a3b030c62..624943b8aa153eddfcc26be62abb2bc002ee826a 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 368ebc5ab970a60ebf9c8f43ee55c0ff703dcea4..b5eab68124d841e5685f8e1551dc71c7b8562f75 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 e1b65b48efc4151e7f4455c1c21023b1c078abf7..e5fc0be2625f35bc84dd5d798c9683ac77ea0dd8 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 7bdd404f105731357156ddc5166b931322473190..df76ac7f5f7221b4c255ed442dc619503644101c 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 896c2d46c1bc6ae262fbab128ce3711b15f95dc5..972934abe2ee9843b33d02f94f51fd7aaa5d28e0 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 ac5ef3583344c5d7a1001a597d0bee8dc27db370..cbd59adddbbd13e5f98abc3ea16ceeba05ca36be 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 db1cb298fd5924fbaa92d309ee169062fbd5c207..61d62f160ac674e6533d7e7b2c81c47e70c0b557 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 7b6ce089e2cdb36ed9bb105c6b7631be591e222c..1053f61518494db8f477cd43b3e9ace0938ba82f 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 fa297e1f5e85784b87bdecb6d6c0c3c388ed2e1d..a512b832d26b329f543dcb5456d4a55af8630df3 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 7543789a187d9786cd736bf458c643cb81b49163..07265b4a6591927aaa4a879ef604c0c256de7a66 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 \