mirror of https://github.com/minio/minio.git
build/release: Generate sha256sums also without the release tag. (#4318)
Ref #4306
This commit is contained in:
parent
0404e747cf
commit
c63afabc9b
|
@ -45,6 +45,8 @@ go_build() {
|
|||
release_real_bin="$release_str/$os-$arch/$(basename $package)"
|
||||
# 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
|
||||
|
@ -60,10 +62,13 @@ go_build() {
|
|||
|
||||
# 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)"
|
||||
|
@ -77,10 +82,13 @@ go_build() {
|
|||
|
||||
# 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
|
||||
else
|
||||
GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin
|
||||
|
||||
|
@ -94,6 +102,7 @@ go_build() {
|
|||
# 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
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,6 @@ func downloadReleaseData(releaseChecksumURL string, timeout time.Duration, mode
|
|||
if resp.StatusCode != http.StatusOK {
|
||||
return data, fmt.Errorf("Error downloading URL %s. Response: %v", releaseChecksumURL, resp.Status)
|
||||
}
|
||||
|
||||
dataBytes, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return data, fmt.Errorf("Error reading response. %s", err)
|
||||
|
@ -185,7 +184,11 @@ func downloadReleaseData(releaseChecksumURL string, timeout time.Duration, mode
|
|||
|
||||
// DownloadReleaseData - downloads release data from minio official server.
|
||||
func DownloadReleaseData(timeout time.Duration, mode string) (data string, err error) {
|
||||
return downloadReleaseData(minioReleaseURL+"minio.shasum", timeout, mode)
|
||||
data, err = downloadReleaseData(minioReleaseURL+"minio.shasum", timeout, mode)
|
||||
if err == nil {
|
||||
return data, nil
|
||||
}
|
||||
return downloadReleaseData(minioReleaseURL+"minio.sha256sum", timeout, mode)
|
||||
}
|
||||
|
||||
func parseReleaseData(data string) (releaseTime time.Time, err error) {
|
||||
|
|
Loading…
Reference in New Issue