buildscripts: compress release binaries.

Fix update command as well to show compressed files in updates.
This commit is contained in:
Harshavardhana 2016-03-18 13:02:06 -07:00
parent a90faf5996
commit 41cba3a457
3 changed files with 43 additions and 6 deletions

View File

@ -138,10 +138,10 @@ dockerimage: checkdocker verifiers $(UI_ASSETS)
@rm minio.dockerimage
release: verifiers
@MINIO_RELEASE=RELEASE GO15VENDOREXPERIMENT=1 ./buildscripts/build.sh
@MINIO_RELEASE=RELEASE ./buildscripts/build.sh
experimental: verifiers
@MINIO_RELEASE=EXPERIMENTAL GO15VENDOREXPERIMENT=1 ./buildscripts/build.sh
@MINIO_RELEASE=EXPERIMENTAL ./buildscripts/build.sh
clean:
@echo "Cleaning up all the generated files:"

View File

@ -24,6 +24,12 @@ _init() {
# List of supported architectures
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"
}
go_build() {
@ -33,7 +39,37 @@ go_build() {
package=$(go list -f '{{.ImportPath}}')
echo -n "-->"
printf "%15s:%s\n" "${osarch}" "${package}"
GO15VENDOREXPERIMENT=1 GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_str/$os-$arch/$(basename $package).$release_tag
# Release binary name
release_bin="$release_str/$os-$arch/$(basename $package).$release_tag"
# Release binary downloadable name
release_real_bin="$release_str/$os-$arch/$(basename $package)"
# 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"
# 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
# Calculate shasum
$SHASUM $release_bin > $release_shasum
# Create a compressed file.
if [ $os == "windows" ]; then
$ZIP -r $release_real_zip $release_real_bin
elif [ $os == "darwin" ]; then
$ZIP -r $release_real_zip $release_real_bin
elif [ $os == "linux" ]; then
$GZIP -c $release_real_bin > $release_real_gz
else
echo "$os operating system is not supported."
exit 1
fi
}
main() {

View File

@ -172,11 +172,12 @@ func getReleaseUpdate(updateURL string) {
}
var downloadURL string
if runtime.GOOS == "windows" {
downloadURL = newUpdateURLPrefix + "/minio.exe"
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
downloadURL = newUpdateURLPrefix + "/minio.zip"
} else {
downloadURL = newUpdateURLPrefix + "/minio"
downloadURL = newUpdateURLPrefix + "/minio.gz"
}
updateMsg := updateMessage{
Download: downloadURL,
Version: minioVersion,