- every execution of dirname costs time
- less repeating
Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>
| ... | ... |
@@ -25,6 +25,7 @@ set -o pipefail |
| 25 | 25 |
|
| 26 | 26 |
export DOCKER_PKG='github.com/docker/docker' |
| 27 | 27 |
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
| 28 |
+export MAKEDIR="$SCRIPTDIR/make" |
|
| 28 | 29 |
|
| 29 | 30 |
# We're a nice, sexy, little shell script, and people might try to run us; |
| 30 | 31 |
# but really, they shouldn't. We want to be in a container! |
| ... | ... |
@@ -5,7 +5,7 @@ DEST=$1 |
| 5 | 5 |
|
| 6 | 6 |
# subshell so that we can export PATH without breaking other things |
| 7 | 7 |
( |
| 8 |
- source "$(dirname "$BASH_SOURCE")/.integration-daemon-start" |
|
| 8 |
+ source "${MAKEDIR}/.integration-daemon-start"
|
|
| 9 | 9 |
|
| 10 | 10 |
# we need to wrap up everything in between integration-daemon-start and |
| 11 | 11 |
# integration-daemon-stop to make sure we kill the daemon and don't hang, |
| ... | ... |
@@ -76,7 +76,7 @@ DEST=$1 |
| 76 | 76 |
# clean up after ourselves |
| 77 | 77 |
rm -f Dockerfile.build |
| 78 | 78 |
|
| 79 |
- source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop" |
|
| 79 |
+ source "${MAKEDIR}/.integration-daemon-stop"
|
|
| 80 | 80 |
|
| 81 | 81 |
[ -z "$didFail" ] # "set -e" ftw |
| 82 | 82 |
) 2>&1 | tee -a $DEST/test.log |
| ... | ... |
@@ -28,6 +28,6 @@ for platform in $DOCKER_CROSSPLATFORMS; do |
| 28 | 28 |
export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms |
| 29 | 29 |
export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported
|
| 30 | 30 |
fi |
| 31 |
- source "$(dirname "$BASH_SOURCE")/binary" "$DEST/$platform" |
|
| 31 |
+ source "${MAKEDIR}/binary" "$DEST/$platform"
|
|
| 32 | 32 |
) |
| 33 | 33 |
done |
| ... | ... |
@@ -4,7 +4,7 @@ set -e |
| 4 | 4 |
DEST=$1 |
| 5 | 5 |
|
| 6 | 6 |
if [ -z "$DOCKER_CLIENTONLY" ]; then |
| 7 |
- source "$(dirname "$BASH_SOURCE")/.dockerinit" |
|
| 7 |
+ source "${MAKEDIR}/.dockerinit"
|
|
| 8 | 8 |
|
| 9 | 9 |
hash_files "$DEST/dockerinit-$VERSION" |
| 10 | 10 |
else |
| ... | ... |
@@ -18,5 +18,5 @@ fi |
| 18 | 18 |
export LDFLAGS_STATIC_DOCKER='' |
| 19 | 19 |
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
|
| 20 | 20 |
export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
|
| 21 |
- source "$(dirname "$BASH_SOURCE")/binary" |
|
| 21 |
+ source "${MAKEDIR}/binary"
|
|
| 22 | 22 |
) |
| ... | ... |
@@ -4,7 +4,7 @@ set -e |
| 4 | 4 |
DEST=$1 |
| 5 | 5 |
|
| 6 | 6 |
if [ -z "$DOCKER_CLIENTONLY" ]; then |
| 7 |
- source "$(dirname "$BASH_SOURCE")/.dockerinit-gccgo" |
|
| 7 |
+ source "${MAKEDIR}/.dockerinit-gccgo"
|
|
| 8 | 8 |
|
| 9 | 9 |
hash_files "$DEST/dockerinit-$VERSION" |
| 10 | 10 |
else |
| ... | ... |
@@ -19,5 +19,5 @@ fi |
| 19 | 19 |
export LDFLAGS_STATIC_DOCKER='' |
| 20 | 20 |
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
|
| 21 | 21 |
export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
|
| 22 |
- source "$(dirname "$BASH_SOURCE")/gccgo" |
|
| 22 |
+ source "${MAKEDIR}/gccgo"
|
|
| 23 | 23 |
) |
| ... | ... |
@@ -6,7 +6,7 @@ BINARY_NAME="docker-$VERSION" |
| 6 | 6 |
BINARY_EXTENSION="$(binary_extension)" |
| 7 | 7 |
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION" |
| 8 | 8 |
|
| 9 |
-source "$(dirname "$BASH_SOURCE")/.go-autogen" |
|
| 9 |
+source "${MAKEDIR}/.go-autogen"
|
|
| 10 | 10 |
|
| 11 | 11 |
go build -compiler=gccgo \ |
| 12 | 12 |
-o "$DEST/$BINARY_FULLNAME" \ |
| ... | ... |
@@ -5,7 +5,7 @@ DEST=$1 |
| 5 | 5 |
|
| 6 | 6 |
# subshell so that we can export PATH without breaking other things |
| 7 | 7 |
( |
| 8 |
- source "$(dirname "$BASH_SOURCE")/.integration-daemon-start" |
|
| 8 |
+ source "${MAKEDIR}/.integration-daemon-start"
|
|
| 9 | 9 |
|
| 10 | 10 |
# we need to wrap up everything in between integration-daemon-start and |
| 11 | 11 |
# integration-daemon-stop to make sure we kill the daemon and don't hang, |
| ... | ... |
@@ -24,7 +24,7 @@ DEST=$1 |
| 24 | 24 |
didFail=1 |
| 25 | 25 |
fi |
| 26 | 26 |
|
| 27 |
- source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop" |
|
| 27 |
+ source "${MAKEDIR}/.integration-daemon-stop"
|
|
| 28 | 28 |
|
| 29 | 29 |
[ -z "$didFail" ] # "set -e" ftw |
| 30 | 30 |
) 2>&1 | tee -a $DEST/test.log |
| ... | ... |
@@ -9,23 +9,23 @@ bundle_test_integration_cli() {
|
| 9 | 9 |
|
| 10 | 10 |
# subshell so that we can export PATH without breaking other things |
| 11 | 11 |
( |
| 12 |
- source "$(dirname "$BASH_SOURCE")/.integration-daemon-start" |
|
| 12 |
+ source "${MAKEDIR}/.integration-daemon-start"
|
|
| 13 | 13 |
|
| 14 | 14 |
# we need to wrap up everything in between integration-daemon-start and |
| 15 | 15 |
# integration-daemon-stop to make sure we kill the daemon and don't hang, |
| 16 | 16 |
# even and especially on test failures |
| 17 | 17 |
didFail= |
| 18 | 18 |
if ! {
|
| 19 |
- source "$(dirname "$BASH_SOURCE")/.ensure-frozen-images" |
|
| 20 |
- source "$(dirname "$BASH_SOURCE")/.ensure-httpserver" |
|
| 21 |
- source "$(dirname "$BASH_SOURCE")/.ensure-emptyfs" |
|
| 19 |
+ source "${MAKEDIR}/.ensure-frozen-images"
|
|
| 20 |
+ source "${MAKEDIR}/.ensure-httpserver"
|
|
| 21 |
+ source "${MAKEDIR}/.ensure-emptyfs"
|
|
| 22 | 22 |
|
| 23 | 23 |
bundle_test_integration_cli |
| 24 | 24 |
}; then |
| 25 | 25 |
didFail=1 |
| 26 | 26 |
fi |
| 27 | 27 |
|
| 28 |
- source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop" |
|
| 28 |
+ source "${MAKEDIR}/.integration-daemon-stop"
|
|
| 29 | 29 |
|
| 30 | 30 |
[ -z "$didFail" ] # "set -e" ftw |
| 31 |
-) 2>&1 | tee -a $DEST/test.log |
|
| 31 |
+) 2>&1 | tee -a "$DEST/test.log" |
| ... | ... |
@@ -39,12 +39,12 @@ bundle_test_unit() {
|
| 39 | 39 |
mkdir -p "$HOME/.parallel" |
| 40 | 40 |
touch "$HOME/.parallel/ignored_vars" |
| 41 | 41 |
|
| 42 |
- echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --env _ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir" |
|
| 42 |
+ echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --env _ "${MAKEDIR}/.go-compile-test-dir"
|
|
| 43 | 43 |
rm -rf "$HOME" |
| 44 | 44 |
else |
| 45 | 45 |
# aww, no "parallel" available - fall back to boring |
| 46 | 46 |
for test_dir in $TESTDIRS; do |
| 47 |
- "$(dirname "$BASH_SOURCE")/.go-compile-test-dir" "$test_dir" || true |
|
| 47 |
+ "${MAKEDIR}/.go-compile-test-dir" "$test_dir" || true
|
|
| 48 | 48 |
# don't let one directory that fails to build tank _all_ our tests! |
| 49 | 49 |
done |
| 50 | 50 |
fi |