From f99987e47c57db9f343838d51851fe429e3658c5 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 6 Jun 2017 11:25:06 -0700 Subject: [PATCH] Generate sha1sum as well for release for backward compatibility. (#4475) Additionally remove support for arm6vl in release, since go 1.8 the support for armv6 has been dropped and we do not see high usage events from this platform. --- buildscripts/build.sh | 76 +++++++++++++------------------------------ 1 file changed, 23 insertions(+), 53 deletions(-) diff --git a/buildscripts/build.sh b/buildscripts/build.sh index 15421e5db..849e3565f 100755 --- a/buildscripts/build.sh +++ b/buildscripts/build.sh @@ -28,6 +28,7 @@ _init() { ## System binaries CP=`which cp` SHASUM=`which shasum` + SHA256SUM="${SHASUM} -a 256" SED=`which sed` } @@ -43,67 +44,36 @@ go_build() { release_bin="$release_str/$os-$arch/$(basename $package).$release_tag" # Release binary downloadable name release_real_bin="$release_str/$os-$arch/$(basename $package)" + + # Release sha1sum name + release_shasum="$release_str/$os-$arch/$(basename $package).${release_tag}.shasum" + # Release sha1sum default + release_shasum_default="$release_str/$os-$arch/$(basename $package).shasum" + # Release sha256sum name release_sha256sum="$release_str/$os-$arch/$(basename $package).${release_tag}.sha256sum" # Release sha256sum default release_sha256sum_default="$release_str/$os-$arch/$(basename $package).sha256sum" # Go build to build the binary. - if [ "${arch}" == "arm" ]; then - # Release binary downloadable name - release_real_bin_6="$release_str/$os-${arch}6vl/$(basename $package)" - - release_bin_6="$release_str/$os-${arch}6vl/$(basename $package).$release_tag" - ## Support building for ARM6vl - GOARM=6 GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin_6 - - ## Copy - $CP -p $release_bin_6 $release_real_bin_6 - - # Release sha256sum name - release_sha256sum_6="$release_str/$os-${arch}6vl/$(basename $package).${release_tag}.sha256sum" - # Release sha256sum default - release_sha256sum_default_6="$release_str/$os-${arch}6vl/$(basename $package).sha256sum" - - # Calculate shasum - shasum_str=$(${SHASUM} -a 256 ${release_bin_6}) - echo ${shasum_str} | $SED "s/$release_str\/$os-${arch}6vl\///g" > $release_sha256sum_6 - $CP -p $release_sha256sum_6 $release_sha256sum_default_6 - - # Release binary downloadable name - release_real_bin_7="$release_str/$os-$arch/$(basename $package)" - - release_bin_7="$release_str/$os-$arch/$(basename $package).$release_tag" - ## Support building for ARM7vl - GOARM=7 GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin_7 - - ## Copy - $CP -p $release_bin_7 $release_real_bin_7 - - # Release sha256sum name - release_sha256sum_7="$release_str/$os-$arch/$(basename $package).${release_tag}.sha256sum" - # Release sha256sum default - release_sha256sum_default_7="$release_str/$os-${arch}/$(basename $package).sha256sum" - - # Calculate sha256sum - shasum_str=$(${SHASUM} -a 256 ${release_bin_7}) - echo ${shasum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_sha256sum_7 - $CP -p $release_sha256sum_7 $release_sha256sum_default_7 + CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin + + # Create copy + if [ $os == "windows" ]; then + $CP -p $release_bin ${release_real_bin}.exe else - GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin - - # Create copy - if [ $os == "windows" ]; then - $CP -p $release_bin ${release_real_bin}.exe - else - $CP -p $release_bin $release_real_bin - fi - - # Calculate shasum - sha256sum_str=$(${SHASUM} -a 256 ${release_bin}) - echo ${sha256sum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_sha256sum - $CP -p $release_sha256sum $release_sha256sum_default + $CP -p $release_bin $release_real_bin fi + + # Calculate sha1sum + shasum_str=$(${SHASUM} ${release_bin}) + echo ${shasum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_shasum + $CP -p $release_shasum $release_shasum_default + + # Calculate sha256sum + sha256sum_str=$(${SHA256SUM} ${release_bin}) + echo ${sha256sum_str} | $SED "s/$release_str\/$os-$arch\///g" > $release_sha256sum + $CP -p $release_sha256sum $release_sha256sum_default } main() {