From d9f769930be1c361ac69f9d8479774f37bb39d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Fri, 9 Aug 2013 17:38:48 -0700 Subject: [PATCH] =?UTF-8?q?Cosmetic=20changes:=20rewrapping,=20``=20?= =?UTF-8?q?=E2=86=92=20$()=E2=80=A6=20before=20starting=20the=20real=20wor?= =?UTF-8?q?k?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- make.sh | 50 +++++++++++++++++++++++++++++++++----------------- release.sh | 13 +++++++------ 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/make.sh b/make.sh index 9a6986bb07..411271895b 100755 --- a/make.sh +++ b/make.sh @@ -1,41 +1,54 @@ #!/bin/sh -# This script builds various binary artifacts from a checkout of the docker source code. +# This script builds various binary artifacts from a checkout of the docker +# source code. # # Requirements: -# - The current directory should be a checkout of the docker source code (http://github.com/dotcloud/docker). Whatever version is checked out will be built. -# - The script is intented to be run as part of a docker build, as defined in the Dockerfile at the root of the source. -# - If you don't call this script from the official Dockerfile, or a container built by the official Dockerfile, you're probably doing it wrong. +# - The current directory should be a checkout of the docker source code +# (http://github.com/dotcloud/docker). Whatever version is checked out +# will be built. +# - The VERSION file, at the root of the repository, should exist, and +# will be used as Docker binary version and package version. +# - The hash of the git commit will also be included in the Docker binary, +# with the suffix +CHANGES if the repository isn't clean. +# - The script is intented to be run as part of a docker build, as defined +# in the Dockerfile at the root of the source. In other words: +# DO NOT CALL THIS SCRIPT DIRECTLY. +# - The right way to call this script is to invoke "docker build ." from +# your checkout of the Docker repository. # set -e set -x -VERSION=`cat ./VERSION` +VERSION=$(cat ./VERSION) GIT_COMMIT=$(git rev-parse --short HEAD) -GIT_CHANGES=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true) +GIT_CHANGES=$(test -n "$(git status --porcelain)" && echo "+CHANGES" || true) -# "bundles" indicate the different types of build artifacts: static binary, ubuntu package, etc. +# Each "bundle" is a different type of build artefact: static binary, Ubuntu +# package, etc. -# Build docker as a static binary file +# Build Docker as a static binary file bundle_binary() { mkdir -p bundles/$VERSION/binary - go build -o bundles/$VERSION/binary/docker-$VERSION -ldflags "-X main.GITCOMMIT $GIT_COMMIT$GIT_CHANGES -X main.VERSION $VERSION -d -w" ./docker + go build -o bundles/$VERSION/binary/docker-$VERSION \ + -ldflags "-X main.GITCOMMIT $GIT_COMMIT$GIT_CHANGES -X main.VERSION $VERSION -d -w" \ + ./docker } -# Build docker's test suite as a collection of binary files (one per sub-package to test) +# Build Docker's test suite as a collection of binary files (one per +# sub-package to test) bundle_test() { mkdir -p bundles/$VERSION/test - for test_dir in `find_test_dirs`; do - test_binary=` + for test_dir in $(find_test_dirs); do + test_binary=$( cd $test_dir go test -c -v -ldflags "-X main.GITCOMMIT $GIT_COMMIT$GIT_CHANGES -X main.VERSION $VERSION -d -w" >&2 find . -maxdepth 1 -type f -name '*.test' -executable - ` + ) cp $test_dir/$test_binary bundles/$VERSION/test/ done - } # Build docker as an ubuntu package using FPM and REPREPRO (sue me). @@ -84,10 +97,13 @@ EOF } -# This helper function walks the current directory looking for directories holding Go test files, -# and prints their paths on standard output, one per line. +# This helper function walks the current directory looking for directories +# holding Go test files, and prints their paths on standard output, one per +# line. find_test_dirs() { - find . -name '*_test.go' | { while read f; do dirname $f; done; } | sort -u + find . -name '*_test.go' | + { while read f; do dirname $f; done; } | + sort -u } diff --git a/release.sh b/release.sh index e9acc2a1e1..58e6dd3ceb 100755 --- a/release.sh +++ b/release.sh @@ -1,12 +1,13 @@ #!/bin/sh -# This script looks for bundles built by make.sh, and releases them on a public S3 bucket. +# This script looks for bundles built by make.sh, and releases them on a +# public S3 bucket. # # Bundles should be available for the VERSION string passed as argument. # -# The correct way to call this script is inside a container built by the official Dockerfile -# at the root of the docker source code. The Dockerfile, make.sh and release.sh should all -# be from the same source code revision. +# The correct way to call this script is inside a container built by the +# official Dockerfile at the root of the Docker source code. The Dockerfile, +# make.sh and release.sh should all be from the same source code revision. set -x set -e @@ -48,9 +49,9 @@ release_ubuntu() { s3cmd --acl-public --verbose --delete-removed --follow-symlinks sync bundles/$VERSION/ubuntu/apt/ s3://$BUCKET/ubuntu/ cat <