From 59ee5a547cb93f46ea6f394695fbb030dd1b5a22 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 21 Mar 2016 15:47:43 -0700 Subject: [PATCH] release: gz doesn't preserve permissions use tar.gz And fix various other issues with release script. --- Makefile | 4 ++-- buildscripts/build.sh | 35 ++++++++++++++++++++++++----------- update-main.go | 2 +- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index c5f78e23f..7e47178ec 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ getdeps: checks @go get -u github.com/remyoudompheng/go-misc/deadcode && echo "Installed deadcode:" @go get -u github.com/client9/misspell/cmd/misspell && echo "Installed misspell:" -verifiers: getdeps vet fmt lint cyclo spelling +verifiers: vet fmt lint cyclo spelling vet: @echo "Running $@:" @@ -137,7 +137,7 @@ pkg-list: install: gomake-all -dockerimage: checkdocker verifiers $(UI_ASSETS) +dockerimage: checkdocker getdeps verifiers $(UI_ASSETS) @echo "Building docker image:" minio:$(TAG) @GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 go build --ldflags $(DOCKER_LDFLAGS) -o docker/minio.dockerimage @cd docker; mkdir -p export; sudo docker build --rm --tag=minio/minio:$(TAG) . diff --git a/buildscripts/build.sh b/buildscripts/build.sh index 8fc744767..9d5d4046f 100755 --- a/buildscripts/build.sh +++ b/buildscripts/build.sh @@ -26,10 +26,12 @@ _init() { SUPPORTED_OSARCH='linux/386 linux/amd64 linux/arm windows/386 windows/amd64 darwin/amd64' ## System binaries - CP="/bin/cp" - SHASUM="/usr/bin/shasum" - GZIP="/usr/bin/gzip" - ZIP="/usr/bin/zip" + CP=`which cp` + SHASUM=`which shasum` + GZIP=`which gzip` + ZIP=`which zip` + SED=`which sed` + TAR=`which tar` } go_build() { @@ -47,25 +49,36 @@ go_build() { # Release shasum name release_shasum="$release_str/$os-$arch/$(basename $package).shasum" # Release zip file. - release_real_zip="$release_str/$os-$arch/$(basename $package).zip" - release_real_gz="$release_str/$os-$arch/$(basename $package).gz" + release_real_zip="$(basename $package).zip" + release_real_tgz="$(basename $package).tgz" # Go build to build the binary. GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin # Create copy - $CP -p $release_bin $release_real_bin + if [ $os == "windows" ]; then + $CP -p $release_bin ${release_real_bin}.exe + else + $CP -p $release_bin $release_real_bin + fi # Calculate shasum - $SHASUM $release_bin > $release_shasum + shasum_str=$(${SHASUM} ${release_bin}) + echo ${shasum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_shasum # Create a compressed file. if [ $os == "windows" ]; then - $ZIP -r $release_real_zip $release_real_bin + cd "$release_str/$os-$arch" + $ZIP -r $release_real_zip $(basename $package).exe + cd - elif [ $os == "darwin" ]; then - $ZIP -r $release_real_zip $release_real_bin + cd "$release_str/$os-$arch" + $ZIP -r $release_real_zip $(basename $package) + cd - elif [ $os == "linux" ]; then - $GZIP -c $release_real_bin > $release_real_gz + cd "$release_str/$os-$arch" + $TAR -czf $release_real_tgz $(basename $package) + cd - else echo "$os operating system is not supported." exit 1 diff --git a/update-main.go b/update-main.go index 5f9cd4882..c4c1553bd 100644 --- a/update-main.go +++ b/update-main.go @@ -148,7 +148,7 @@ func getReleaseUpdate(updateURL string, noError bool) updateMessage { downloadURL = newUpdateURLPrefix + "/minio.zip" default: // For all other operating systems. - downloadURL = newUpdateURLPrefix + "/minio.gz" + downloadURL = newUpdateURLPrefix + "/minio.tgz" } // Initialize update message.