Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MetricMike/asdf-awscli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: MetricMike/asdf-awscli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.1
Choose a head ref
  • 5 commits
  • 7 files changed
  • 2 contributors

Commits on May 16, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5f3cff5 View commit details
  2. Copy the full SHA
    e75e57b View commit details
  3. Copy the full SHA
    0eaca73 View commit details

Commits on Jun 13, 2023

  1. fix: resolve coreutils/macos incompatiblity (#29)

    * swap `cr -a` for `cr -LR`
    * add test with latest coreutils on all platforms
    MetricMike authored Jun 13, 2023
    Copy the full SHA
    485a11e View commit details
  2. chore(main): release 1.0.1

    github-actions[bot] authored and MetricMike committed Jun 13, 2023
    Copy the full SHA
    2e31396 View commit details
Showing with 74 additions and 30 deletions.
  1. +3 −0 .editorconfig
  2. +25 −0 .github/workflows/build.yml
  3. +7 −0 CHANGELOG.md
  4. +8 −0 asdf-awscli.code-workspace
  5. +9 −12 bin/install
  6. +14 −14 bin/list-all
  7. +8 −4 lib/utils.bash
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -6,3 +6,6 @@ indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.bash]
indent_style = tab
25 changes: 25 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -30,12 +30,37 @@ jobs:
cli-version:
- "latest:1"
- "latest:2"
coreutils:
- default
- latest
runs-on: ${{ matrix.os }}
steps:
- name: Setup homebrew if using latest coreutils
if: matrix.coreutils == 'latest'
uses: Homebrew/actions/setup-homebrew@master

- name: Try installing latest GNU coreutils
if: matrix.coreutils == 'latest'
run: |
brew update
brew install coreutils
echo "$(brew --prefix)/opt/coreutils/libexec/gnubin" >> "${GITHUB_PATH}"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Check paths and coreutils version if using latest
if: matrix.coreutils == 'latest'
run: |
which cp
cp --version
which python
python --version
"${pythonLocation}/bin/python" --version
echo "${GITHUB_PATH}"
echo "${PATH}"
- name: asdf_plugin_test
uses: asdf-vm/actions/plugin-test@v2
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.0.1](https://github.com/MetricMike/asdf-awscli/compare/v1.0.0...v1.0.1) (2023-06-13)


### Bug Fixes

* resolve coreutils/macos incompatiblity ([#29](https://github.com/MetricMike/asdf-awscli/issues/29)) ([485a11e](https://github.com/MetricMike/asdf-awscli/commit/485a11e88822d98e235aa3077a64fccea0d07616))

## 1.0.0 (2023-04-25)


8 changes: 8 additions & 0 deletions asdf-awscli.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
21 changes: 9 additions & 12 deletions bin/install
Original file line number Diff line number Diff line change
@@ -9,16 +9,15 @@ plugin_dir=$(dirname "$(dirname "${current_script_path}")")
. "${plugin_dir}/lib/utils.bash"

TOOL_NAME="awscli"
TOOL_TEST="aws --version"
TOOL_CMD="aws"

install_source() {
local version download_path install_path major_version make_concurrency tool_cmd
local version download_path install_path major_version make_concurrency
version="$1"
download_path="$2"
install_path="$3"
make_concurrency="$4"
major_version="${version:0:1}"
tool_cmd="$(echo "${TOOL_TEST}" | cut -d' ' -f1)"

(
if [[ "${major_version}" = "2" ]]; then
@@ -35,8 +34,8 @@ install_source() {
fail "asdf-${TOOL_NAME} does not support installing from source for major version v${major_version}"
fi

test -x "${install_path}/bin/${tool_cmd}" || fail "Expected ${install_path}/bin/${tool_cmd} to be executable."
echo "asdf-${TOOL_NAME} ${version} installation was successful!"
test -x "${install_path}/bin/${TOOL_CMD}" || fail "Expected ${install_path}/bin/${TOOL_CMD} to be executable."
printfn "asdf-${TOOL_NAME} ${version} installation was successful!"
) || (
rm -rf "${install_path}"
fail "An error ocurred while installing awscli ${version}."
@@ -71,10 +70,8 @@ install_release() {
fail "asdf-${TOOL_NAME} does not support major version v${major_version}"
fi

local tool_cmd
tool_cmd="$(echo "${TOOL_TEST}" | cut -d' ' -f1)"
test -x "${install_path}/bin/${tool_cmd}" || fail "Expected ${install_path}/bin/${tool_cmd} to be executable."
echo "asdf-${TOOL_NAME} ${version} installation was successful!"
test -x "${install_path}/bin/${TOOL_CMD}" || fail "Expected ${install_path}/bin/${TOOL_CMD} to be executable."
printfn "asdf-${TOOL_NAME} ${version} installation was successful!"
) || (
rm -rf "${install_path}"
fail "An error ocurred while installing awscli ${version}."
@@ -107,9 +104,9 @@ install_v2_macos_bundled_installer() {
install_path="$2"
# requires rosetta on M1 macs

mkdir -p "${install_path}/bin"
pkgutil --expand-full "${download_path}/AWSCLIV2.pkg" "${download_path}/tmp-awscliv2"
cp -a "${download_path}/tmp-awscliv2/aws-cli.pkg/Payload/aws-cli/" "${install_path}"
cp -LR "${download_path}/tmp-awscliv2/aws-cli.pkg/Payload/aws-cli/"* "${install_path}"
mkdir -p "${install_path}/bin"
ln -snf "${install_path}/aws" "${install_path}/bin/aws"
ln -snf "${install_path}/aws_completer" "${install_path}/bin/aws_completer"
rm -rf "${download_path}/tmp-awscliv2"
@@ -129,7 +126,7 @@ install_v2_windows_bundled_installer() {
if [ -z "${ASDF_DOWNLOAD_PATH:-}" ]; then
tmp_download_dir=$(mktemp -d -t asdf_asdf-awscli_XXXXXX)
trap 'rm -rf "${tmp_download_dir}"' EXIT
printf "run download script for older versions of asdf\\n"
printfn "run download script for older versions of asdf"
export ASDF_DOWNLOAD_PATH="${tmp_download_dir}"

# download
28 changes: 14 additions & 14 deletions bin/list-all
Original file line number Diff line number Diff line change
@@ -8,23 +8,23 @@ plugin_dir=$(dirname "$(dirname "${current_script_path}")")
# shellcheck source=../lib/utils.bash
. "${plugin_dir}/lib/utils.bash"

GIT_REMINDER_FILE="$(mktemp -t asdf_asdf-awscli_upgradegit_XXXXXX)"
GIT_REMINDER_FILE_FUZZY="${GIT_REMINDER_FILE%_*}"
GH_REPO="https://github.com/aws/aws-cli"
GIT_VERSION=$(git --version)
GIT_VERSION="${GIT_VERSION##* }"

git_supports_sort() {
awk '{ split($0,a,"."); if ((a[1] < 2) || (a[2] < 18)) { print "1" } else { print "0" } }' <<<"$1"
}

if [ "$(git_supports_sort "${GIT_VERSION}")" -eq 0 ]; then
rm -f "${GIT_REMINDER_FILE}"
# shellcheck disable=2207
GIT_VERSION_STRING=($(git --version))
# shellcheck disable=2206
GIT_VERSION=(${GIT_VERSION_STRING[2]//./ })
GIT_MAJOR_VERSION="${GIT_VERSION[0]}"
GIT_MINOR_VERSION="${GIT_VERSION[1]}"

# need git 2.18.0+ for version sorting
if [ "${GIT_MAJOR_VERSION}" -ge 2 ] && [ "${GIT_MINOR_VERSION}" -ge 18 ]; then
GIT_SUPPORTS_SORT=0
else
GIT_SUPPORTS_SORT=1
GIT_REMINDER_FILE="$(mktemp -t asdf_asdf-awscli_upgradegit_XXXXXX)"
GIT_REMINDER_FILE_FUZZY="${GIT_REMINDER_FILE%_*}"
if [ ! -f "${GIT_REMINDER_FILE_FUZZY}" ]; then
printf "consider upgrading git to a version >= 2.18.0 for faster asdf - you have v%s\n" "${GIT_VERSION}"
printfn "consider upgrading git to a version >= 2.18.0 for faster asdf - you have v${GIT_VERSION_STRING[2]}"
touch "${GIT_REMINDER_FILE_FUZZY}"
fi
fi
@@ -41,7 +41,7 @@ list_remote_tags() {
-c 'versionsort.suffix=r' -c 'versionsort.suffix=p' \
-c 'versionsort.suffix=-' -c 'versionsort.suffix=_' \
ls-remote --exit-code --tags --refs --sort="version:refname" "${GH_REPO}" |
awk -F'[/v]' '$NF ~ /^[0-9]+.*/ { print $NF }' || fail "no releases found"
awk -F'[/v]' '$NF ~ /^[0-9]+.*/ { printf "%s%s", (NR==1 ? "" : " "), $NF } END { print "" }' || fail "no releases found"
else
git ls-remote --exit-code --tags --refs "${GH_REPO}" |
awk -F'[/v]' '$NF ~ /^[0-9]+.*/ { print $NF }' || fail "no releases found"
@@ -56,4 +56,4 @@ list_all_versions() {
fi
}

list_all_versions | xargs echo
list_all_versions
12 changes: 8 additions & 4 deletions lib/utils.bash
Original file line number Diff line number Diff line change
@@ -4,10 +4,14 @@
set -euo pipefail

fail() {
echo -e "asdf-awscli: $*"
printfn "$*"
exit 1
}

IFS=" " read -r -a OS_INFO <<<"$(uname -sm)"
OS_NAME="${OS_INFO[0]}"
OS_ARCH="${OS_INFO[1]}"
printfn() {
printf "asdf-awscli: %s\\n" "$*"
}

OS_INFO="$(uname -sm)"
OS_NAME="${OS_INFO% *}"
OS_ARCH="${OS_INFO#* }"