From 86986d81a21b12ceac8f6d4ae85a64ed4f9a2904 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 17 Jan 2018 17:43:13 -0500 Subject: [PATCH 1/4] Prep for v1.3.0 release --- CHANGELOG.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b06ae3b..b7c839d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added -- Code of Conduct - ### Changed -- `1.8` and `1.9` are now build-from-source bootstrapping candidates - ### Deprecated ### Removed @@ -20,6 +16,20 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Security +## [1.3.0] - 2018-01-17 + +### Added + +- Code of Conduct + +### Changed + +- `1.8` and `1.9` are now build-from-source bootstrapping candidates + +### Fixed +- paginate bucket when fetching 'stable' alias +- account for future 1.1x releases in version regex + ## [1.2.0] - 2017-07-09 ### Added From 33fea9583ac1926e696cca9f884c76d2e6307dbb Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 18 Jan 2018 17:37:43 -0500 Subject: [PATCH 2/4] Refresh test binary versions, shfmt & shellcheck versions and include fixes/changes from said shfmt & shellcheck versions --- .testdata/binary-darwin | 2 + .testdata/binary-linux | 2 + .testdata/stubheader-sample | 1 - .travis.yml | 17 ++-- gimme | 184 ++++++++++++++++++------------------ 5 files changed, 106 insertions(+), 100 deletions(-) diff --git a/.testdata/binary-darwin b/.testdata/binary-darwin index cd8faa2..2b9e5ba 100644 --- a/.testdata/binary-darwin +++ b/.testdata/binary-darwin @@ -74,3 +74,5 @@ 1.3.1 1.3 1.2.2 +1.10beta2 +1.10beta1 diff --git a/.testdata/binary-linux b/.testdata/binary-linux index cd8faa2..2b9e5ba 100644 --- a/.testdata/binary-linux +++ b/.testdata/binary-linux @@ -74,3 +74,5 @@ 1.3.1 1.3 1.2.2 +1.10beta2 +1.10beta1 diff --git a/.testdata/stubheader-sample b/.testdata/stubheader-sample index eb40f8f..c7dffc4 100644 --- a/.testdata/stubheader-sample +++ b/.testdata/stubheader-sample @@ -7,6 +7,5 @@ # Instead we include: # * all versions of the current release series # * the last formal release in all previous series -# * at least one beta and rc # diff --git a/.travis.yml b/.travis.yml index e6db1f1..149b640 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,13 @@ sudo: false dist: trusty os: - linux -- osx +# Disabling, potentially permanently, given ongoing sadness :crying_cat_face: +# - osx cache: directories: - "${HOME}/bin" -osx_image: xcode7.3 +# Disabling, potentially permanently, given ongoing sadness :crying_cat_face: +# osx_image: xcode7.3 env: global: - GIMME_TMP="${TRAVIS_BUILD_DIR}/tmp" @@ -15,8 +17,8 @@ env: - GO_BOOTSTRAP_VERSION=1.8.3 - GOPATH="${HOME}/gopath" - PATH="${HOME}/bin:${PATH}" - - SHELLCHECK_URL="https://s3.amazonaws.com/travis-blue-public/binaries/ubuntu/14.04/x86_64/shellcheck-0.4.6.tar.bz2" - - SHFMT_URL="https://github.com/mvdan/sh/releases/download/v1.3.1/shfmt_v1.3.1_linux_amd64" + - SHELLCHECK_URL="https://www.googleapis.com/download/storage/v1/b/shellcheck/o/shellcheck-v0.4.7.linux.x86_64.tar.xz?alt=media" + - SHFMT_URL="https://github.com/mvdan/sh/releases/download/v2.2.0/shfmt_v2.2.0_linux_amd64" matrix: - TARGET=native GO_VERSIONS="$(sed -n -e '/^[^#]/p' < .testdata/sample-binary-$UNAME) $(sed -n -e '/^[^#]/p' < .testdata/source-$UNAME)" - TARGET=arm GO_VERSIONS="master" @@ -30,11 +32,12 @@ addons: before_script: - mkdir -p "${GIMME_TMP}" script: -- if [ $UNAME = linux ] && ! shellcheck --version; then - curl -sSL "${SHELLCHECK_URL}" | tar -C "${HOME}/bin" -xjf -; + - if [ $UNAME = linux ] && [[ $(shellcheck --version | awk '/^version:/ { print $2 }') != 0.4.7 ]] ; then + curl -sSL -o "${GIMME_TMP}/shellcheck.tar.xz" "${SHELLCHECK_URL}"; + tar -C "${HOME}/bin" --exclude='*.txt' --strip-components=1 -xf "${GIMME_TMP}/shellcheck.tar.xz"; shellcheck --version; fi -- if [ $UNAME = linux ] && [[ $(shfmt -version 2>/dev/null) != v1.3.1 ]] ; then +- if [ $UNAME = linux ] && [[ $(shfmt -version 2>/dev/null) != v2.2.0 ]] ; then curl -sSL "${SHFMT_URL}" -o "${HOME}/bin/shfmt"; chmod +x "${HOME}/bin/shfmt"; shfmt -version; diff --git a/gimme b/gimme index 736c325..f43c402 100755 --- a/gimme +++ b/gimme @@ -49,9 +49,9 @@ set -o pipefail [[ ${GIMME_DEBUG} ]] && set -x -GIMME_VERSION="v1.2.0" -GIMME_COPYRIGHT="Copyright (c) 2016 Dan Buch, Tianon Gravi, Travis CI GmbH" -GIMME_LICENSE_URL="https://raw.githubusercontent.com/travis-ci/gimme/v1.2.0/LICENSE" +GIMME_VERSION="v1.3.0" +GIMME_COPYRIGHT="Copyright (c) 2018 Dan Buch, Tianon Gravi, Travis CI GmbH" +GIMME_LICENSE_URL="https://raw.githubusercontent.com/travis-ci/gimme/v1.3.0/LICENSE" export GIMME_VERSION export GIMME_COPYRIGHT export GIMME_LICENSE_URL @@ -152,11 +152,11 @@ _fetch() { _checkout() { _fetch "${2}" (cd "${2}" && { - git reset -q --hard "origin/${1}" \ - || git reset -q --hard "origin/go${1}" \ - || { [ "${1}" = 'tip' ] && git reset -q --hard origin/master; } \ - || git reset -q --hard "refs/tags/${1}" \ - || git reset -q --hard "refs/tags/go${1}" + git reset -q --hard "origin/${1}" || + git reset -q --hard "origin/go${1}" || + { [ "${1}" = 'tip' ] && git reset -q --hard origin/master; } || + git reset -q --hard "refs/tags/${1}" || + git reset -q --hard "refs/tags/go${1}" } 2>/dev/null) } @@ -293,18 +293,18 @@ _env_alias() { _try_existing() { case "${1}" in - binary) - local existing_ver="${GIMME_VERSION_PREFIX}/go${GIMME_GO_VERSION}.${GIMME_OS}.${GIMME_ARCH}" - local existing_env="${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.${GIMME_OS}.${GIMME_ARCH}.env" - ;; - source) - local existing_ver="${GIMME_VERSION_PREFIX}/go${GIMME_GO_VERSION}.src" - local existing_env="${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.src.env" - ;; - *) - _try_existing binary || _try_existing source - return $? - ;; + binary) + local existing_ver="${GIMME_VERSION_PREFIX}/go${GIMME_GO_VERSION}.${GIMME_OS}.${GIMME_ARCH}" + local existing_env="${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.${GIMME_OS}.${GIMME_ARCH}.env" + ;; + source) + local existing_ver="${GIMME_VERSION_PREFIX}/go${GIMME_GO_VERSION}.src" + local existing_env="${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.src.env" + ;; + *) + _try_existing binary || _try_existing source + return $? + ;; esac if [[ -x "${existing_ver}/bin/go" && -s "${existing_env}" ]]; then @@ -398,7 +398,7 @@ _list_versions() { } _list_known() { - local exp="go([[:alnum:]\.]*)\.src.*" # :alnum: catches beta versions too + local exp="go([[:alnum:]\\.]*)\\.src.*" # :alnum: catches beta versions too local list="${GIMME_TMP}/known-versions" local known @@ -408,7 +408,7 @@ _list_known() { while read -r line; do if [[ "${line}" =~ ${exp} ]]; then - known="$known\n${BASH_REMATCH[1]}" + known="$known\\n${BASH_REMATCH[1]}" fi done <"${list}" @@ -451,7 +451,7 @@ _update_stable() { while nextPageToken=$(jq --exit-status --raw-output '.nextPageToken' <"$tmp_versions"); do _do_curl "${url}&pageToken=${nextPageToken}" "${tmp_versions}" - vers="${vers}\n$(jq -r '.items[].name | capture("go(?[[:digit:]\\.]*)\\.src.*").ver' <"$tmp_versions")" + vers="${vers}\\n$(jq -r '.items[].name | capture("go(?[[:digit:]\\.]*)\\.src.*").ver' <"$tmp_versions")" done rm -f "${tmp_versions}" &>/dev/null @@ -461,12 +461,12 @@ _update_stable() { _stat_unix() { local filename="${1}" case "${GIMME_HOSTOS}" in - darwin | *bsd) - stat -f %a "${filename}" - ;; - linux) - stat -c %Y "${filename}" - ;; + darwin | *bsd) + stat -f %a "${filename}" + ;; + linux) + stat -c %Y "${filename}" + ;; esac } @@ -503,24 +503,24 @@ _exclude_from_backups() { # Please avoid anything which requires elevated privileges or is obnoxious # enough to offend the invoker case "${GIMME_HOSTOS}" in - darwin) - # Darwin: Time Machine is "standard", we can add others. The default - # mechanism is sticky, as an attribute on the dir, requires no - # privileges, is idempotent (and doesn't support -- to end flags). - tmutil addexclusion "$@" - ;; + darwin) + # Darwin: Time Machine is "standard", we can add others. The default + # mechanism is sticky, as an attribute on the dir, requires no + # privileges, is idempotent (and doesn't support -- to end flags). + tmutil addexclusion "$@" + ;; esac } _versint() { - local args=(${1//[^0-9]/ }) + IFS=" " read -r -a args <<<"${1//[^0-9]/ }" printf '1%03d%03d%03d%03d' "${args[@]}" } _to_goarch() { case "${1}" in - aarch64) echo "arm64" ;; - *) echo "${1}" ;; + aarch64) echo "arm64" ;; + *) echo "${1}" ;; esac } @@ -539,12 +539,12 @@ _to_goarch() { # The version prefix must be an absolute path case "${GIMME_VERSION_PREFIX}" in - /*) true ;; - *) - echo >&2 " Fixing GIMME_VERSION_PREFIX from relative: $GIMME_VERSION_PREFIX" - GIMME_VERSION_PREFIX="$(pwd)/${GIMME_VERSION_PREFIX}" - echo >&2 " to: $GIMME_VERSION_PREFIX" - ;; +/*) true ;; +*) + echo >&2 " Fixing GIMME_VERSION_PREFIX from relative: $GIMME_VERSION_PREFIX" + GIMME_VERSION_PREFIX="$(pwd)/${GIMME_VERSION_PREFIX}" + echo >&2 " to: $GIMME_VERSION_PREFIX" + ;; esac if [[ "${GIMME_OS}" == mingw* ]]; then @@ -560,40 +560,40 @@ fi while [[ $# -gt 0 ]]; do case "${1}" in - -h | --help | help | wat) - _old_ifs="$IFS" - IFS=';' - awk '/^#\+ / { + -h | --help | help | wat) + _old_ifs="$IFS" + IFS=';' + awk '/^#\+ / { sub(/^#\+ /, "", $0) ; sub(/-$/, "", $0) ; print $0 }' "$0" | while read -r line; do - eval "echo \"$line\"" - done - IFS="$_old_ifs" - exit 0 - ;; - -V | --version | version) - echo "${GIMME_VERSION}" - exit 0 - ;; - -l | --list | list) - _list_versions - exit 0 - ;; - -k | --known | known) - _list_known - exit 0 - ;; - -f | --force | force) - force=1 - ;; - -i | install) - true # ignore a dummy argument - ;; - *) - break - ;; + eval "echo \"$line\"" + done + IFS="$_old_ifs" + exit 0 + ;; + -V | --version | version) + echo "${GIMME_VERSION}" + exit 0 + ;; + -l | --list | list) + _list_versions + exit 0 + ;; + -k | --known | known) + _list_known + exit 0 + ;; + -f | --force | force) + force=1 + ;; + -i | install) + true # ignore a dummy argument + ;; + *) + break + ;; esac shift done @@ -606,26 +606,26 @@ if [[ -n "${2}" ]]; then fi case "${GIMME_ARCH}" in - x86_64) GIMME_ARCH=amd64 ;; - x86) GIMME_ARCH=386 ;; - arm64) - if [[ "${GIMME_GO_VERSION}" != master && "$(_versint "${GIMME_GO_VERSION}")" < "$(_versint 1.5)" ]]; then - echo >&2 "error: ${GIMME_ARCH} is not supported by this go version" - echo >&2 "try go1.5 or newer" - exit 1 - fi - if [[ "${GIMME_HOSTOS}" == "linux" && "${GIMME_HOSTARCH}" != "${GIMME_ARCH}" ]]; then - : "${GIMME_CC_FOR_TARGET:="aarch64-linux-gnu-gcc"}" - fi - ;; - arm*) GIMME_ARCH=arm ;; +x86_64) GIMME_ARCH=amd64 ;; +x86) GIMME_ARCH=386 ;; +arm64) + if [[ "${GIMME_GO_VERSION}" != master && "$(_versint "${GIMME_GO_VERSION}")" < "$(_versint 1.5)" ]]; then + echo >&2 "error: ${GIMME_ARCH} is not supported by this go version" + echo >&2 "try go1.5 or newer" + exit 1 + fi + if [[ "${GIMME_HOSTOS}" == "linux" && "${GIMME_HOSTARCH}" != "${GIMME_ARCH}" ]]; then + : "${GIMME_CC_FOR_TARGET:="aarch64-linux-gnu-gcc"}" + fi + ;; +arm*) GIMME_ARCH=arm ;; esac case "${GIMME_HOSTARCH}" in - x86_64) GIMME_HOSTARCH=amd64 ;; - x86) GIMME_HOSTARCH=386 ;; - arm64) ;; - arm*) GIMME_HOSTARCH=arm ;; +x86_64) GIMME_HOSTARCH=amd64 ;; +x86) GIMME_HOSTARCH=386 ;; +arm64) ;; +arm*) GIMME_HOSTARCH=arm ;; esac if [[ "${GIMME_GO_VERSION}" == "stable" ]]; then @@ -665,7 +665,7 @@ if ! case "${GIMME_TYPE}" in echo >&2 " Try 'auto', 'binary', 'source', or 'git'." exit 1 ;; -esac; then + esac; then echo >&2 "I don't have any idea what to do with '${GIMME_GO_VERSION}'." echo >&2 " (using type '${GIMME_TYPE}')" exit 1 From 0d68b1a9696a5004b7643a60d22afcaf391ff4b3 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 18 Jan 2018 17:41:41 -0500 Subject: [PATCH 3/4] Fix a sad spacing YAML issue --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 149b640..7d831b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,9 +32,9 @@ addons: before_script: - mkdir -p "${GIMME_TMP}" script: - - if [ $UNAME = linux ] && [[ $(shellcheck --version | awk '/^version:/ { print $2 }') != 0.4.7 ]] ; then +- if [ $UNAME = linux ] && [[ $(shellcheck --version | awk '/^version:/ { print $2 }') != 0.4.7 ]] ; then curl -sSL -o "${GIMME_TMP}/shellcheck.tar.xz" "${SHELLCHECK_URL}"; - tar -C "${HOME}/bin" --exclude='*.txt' --strip-components=1 -xf "${GIMME_TMP}/shellcheck.tar.xz"; + tar -C "${HOME}/bin" --exclude="*.txt" --strip-components=1 -xf "${GIMME_TMP}/shellcheck.tar.xz"; shellcheck --version; fi - if [ $UNAME = linux ] && [[ $(shfmt -version 2>/dev/null) != v2.2.0 ]] ; then From 4ce33c3578da6de2aa0af6d8232285be4fbf3937 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 18 Jan 2018 18:36:21 -0500 Subject: [PATCH 4/4] Adjust copyright year(s) and shellcheck ignored rules per feedback --- gimme | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gimme b/gimme index f43c402..99ae890 100755 --- a/gimme +++ b/gimme @@ -50,7 +50,7 @@ set -o pipefail [[ ${GIMME_DEBUG} ]] && set -x GIMME_VERSION="v1.3.0" -GIMME_COPYRIGHT="Copyright (c) 2018 Dan Buch, Tianon Gravi, Travis CI GmbH" +GIMME_COPYRIGHT="Copyright (c) 2015-2018 Dan Buch, Tianon Gravi, Travis CI GmbH" GIMME_LICENSE_URL="https://raw.githubusercontent.com/travis-ci/gimme/v1.3.0/LICENSE" export GIMME_VERSION export GIMME_COPYRIGHT @@ -398,7 +398,8 @@ _list_versions() { } _list_known() { - local exp="go([[:alnum:]\\.]*)\\.src.*" # :alnum: catches beta versions too + # shellcheck disable=SC1117 + local exp="go([[:alnum:]\.]*)\.src.*" # :alnum: catches beta versions too local list="${GIMME_TMP}/known-versions" local known @@ -408,7 +409,8 @@ _list_known() { while read -r line; do if [[ "${line}" =~ ${exp} ]]; then - known="$known\\n${BASH_REMATCH[1]}" + # shellcheck disable=SC1117 + known="$known\n${BASH_REMATCH[1]}" fi done <"${list}" @@ -451,7 +453,8 @@ _update_stable() { while nextPageToken=$(jq --exit-status --raw-output '.nextPageToken' <"$tmp_versions"); do _do_curl "${url}&pageToken=${nextPageToken}" "${tmp_versions}" - vers="${vers}\\n$(jq -r '.items[].name | capture("go(?[[:digit:]\\.]*)\\.src.*").ver' <"$tmp_versions")" + # shellcheck disable=SC1117 + vers="${vers}\n$(jq -r '.items[].name | capture("go(?[[:digit:]\\.]*)\\.src.*").ver' <"$tmp_versions")" done rm -f "${tmp_versions}" &>/dev/null