Browse code

Change the windows .tgz to a .zip file

Signed-off-by: Ken Cochrane <kencochrane@gmail.com>
(cherry picked from commit fda99a7e1653e045ec5901955a59ff1123016d93)

Ken Cochrane authored on 2016/04/01 01:27:50
Showing 4 changed files
... ...
@@ -74,6 +74,7 @@ RUN apt-get update && apt-get install -y \
74 74
 	xfsprogs \
75 75
 	libzfs-dev \
76 76
 	tar \
77
+	zip \
77 78
 	--no-install-recommends \
78 79
 	&& pip install awscli==1.10.15 \
79 80
 	&& ln -snf /usr/bin/clang-3.8 /usr/local/bin/clang \
... ...
@@ -69,10 +69,11 @@ bundles:
69 69
 cross: build
70 70
 	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary binary cross
71 71
 
72
-
73 72
 win: build
74 73
 	$(DOCKER_RUN_DOCKER) hack/make.sh win
75 74
 
75
+tgz: build
76
+	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary binary cross tgz
76 77
 
77 78
 deb: build
78 79
 	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-deb
... ...
@@ -15,9 +15,17 @@ for d in "$CROSS/"*/*; do
15 15
 	export GOOS="$(basename "$(dirname "$d")")"
16 16
 	BINARY_NAME="docker-$VERSION"
17 17
 	BINARY_EXTENSION="$(export GOOS && binary_extension)"
18
+	if [ "$GOOS" = 'windows' ]; then
19
+		# if windows use a zip, not tgz
20
+		BUNDLE_EXTENSION=".zip"
21
+		IS_TAR="false"
22
+	else
23
+		BUNDLE_EXTENSION=".tgz"
24
+		IS_TAR="true"
25
+	fi
18 26
 	BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
19 27
 	mkdir -p "$DEST/$GOOS/$GOARCH"
20
-	TGZ="$DEST/$GOOS/$GOARCH/$BINARY_NAME.tgz"
28
+	TGZ="$DEST/$GOOS/$GOARCH/$BINARY_NAME$BUNDLE_EXTENSION"
21 29
 
22 30
 	# The staging directory for the files in the tgz
23 31
 	BUILD_PATH="$DEST/build"
... ...
@@ -35,8 +43,21 @@ for d in "$CROSS/"*/*; do
35 35
 	# copy over all the containerd binaries
36 36
 	copy_containerd $TAR_PATH
37 37
 
38
-	echo "Creating tgz from $BUILD_PATH and naming it $TGZ"
39
-	tar --numeric-owner --owner 0 -C "$BUILD_PATH" -czf "$TGZ" $TAR_BASE_DIRECTORY
38
+	if [ "$IS_TAR" == "true" ]; then
39
+		echo "Creating tgz from $BUILD_PATH and naming it $TGZ"
40
+		tar --numeric-owner --owner 0 -C "$BUILD_PATH" -czf "$TGZ" $TAR_BASE_DIRECTORY
41
+	else
42
+		# ZIP needs to full absolute dir path, not the absolute path
43
+		ZIP=`pwd`"/$TGZ"
44
+		# keep track of where we are, for later.
45
+		pushd .
46
+		# go into the BUILD_PATH since zip does not have a -C equivalent.
47
+		cd $BUILD_PATH
48
+		echo "Creating zip from $BUILD_PATH and naming it $ZIP"
49
+		zip -q -r $ZIP $TAR_BASE_DIRECTORY
50
+		# go back to where we started
51
+		popd
52
+	fi
40 53
 
41 54
 	hash_files "$TGZ"
42 55
 
... ...
@@ -181,7 +181,9 @@ release_build() {
181 181
 	binDir=bundles/$VERSION/cross/$GOOS/$GOARCH
182 182
 	tgzDir=bundles/$VERSION/tgz/$GOOS/$GOARCH
183 183
 	binary=docker-$VERSION
184
-	tgz=docker-$VERSION.tgz
184
+	zipExt=".tgz"
185
+	binaryExt=""
186
+	tgz=$binary$zipExt
185 187
 
186 188
 	latestBase=
187 189
 	if [ -z "$NOLATEST" ]; then
... ...
@@ -204,11 +206,12 @@ release_build() {
204 204
 			s3Os=Linux
205 205
 			;;
206 206
 		windows)
207
+			# this is windows use the .zip and .exe extentions for the files.
207 208
 			s3Os=Windows
208
-			binary+='.exe'
209
-			if [ "$latestBase" ]; then
210
-				latestBase+='.exe'
211
-			fi
209
+			zipExt=".zip"
210
+			binaryExt=".exe"
211
+			tgz=$binary$zipExt
212
+			binary+=$binaryExt
212 213
 			;;
213 214
 		*)
214 215
 			echo >&2 "error: can't convert $s3Os to an appropriate value for 'uname -s'"
... ...
@@ -235,11 +238,13 @@ release_build() {
235 235
 	esac
236 236
 
237 237
 	s3Dir="s3://$BUCKET_PATH/builds/$s3Os/$s3Arch"
238
-	latest=
238
+	# latest=
239 239
 	latestTgz=
240 240
 	if [ "$latestBase" ]; then
241
-		latest="$s3Dir/$latestBase"
242
-		latestTgz="$s3Dir/$latestBase.tgz"
241
+		# commented out since we aren't uploading binaries right now.
242
+		# latest="$s3Dir/$latestBase$binaryExt"
243
+		# we don't include the $binaryExt because we don't want docker.exe.zip
244
+		latestTgz="$s3Dir/$latestBase$zipExt"
243 245
 	fi
244 246
 
245 247
 	if [ ! -f "$tgzDir/$tgz" ]; then
... ...
@@ -308,6 +313,6 @@ echo "We have just pushed $VERSION to $(s3_url). You can download it with the fo
308 308
 echo
309 309
 echo "Darwin/OSX 64bit client tgz: $(s3_url)/builds/Darwin/x86_64/docker-$VERSION.tgz"
310 310
 echo "Linux 64bit tgz: $(s3_url)/builds/Linux/x86_64/docker-$VERSION.tgz"
311
-echo "Windows 64bit client tgz: $(s3_url)/builds/Windows/x86_64/docker-$VERSION.tgz"
312
-echo "Windows 32bit client tgz: $(s3_url)/builds/Windows/i386/docker-$VERSION.tgz"
311
+echo "Windows 64bit client tgz: $(s3_url)/builds/Windows/x86_64/docker-$VERSION.zip"
312
+echo "Windows 32bit client tgz: $(s3_url)/builds/Windows/i386/docker-$VERSION.zip"
313 313
 echo