Skip to content

Commit

Permalink
feat(dart): support arm64 and checksums (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice authored Mar 17, 2023
1 parent 718f218 commit a239248
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 31 deletions.
21 changes: 19 additions & 2 deletions src/usr/local/buildpack/tools/v2/dart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@ function prepare_tool() {

# https://storage.googleapis.com/dart-archive/channels/stable/release/1.11.0/sdk/dartsdk-linux-x64-release.zip
# https://storage.googleapis.com/dart-archive/channels/stable/release/2.18.0/sdk/dartsdk-linux-x64-release.zip
# https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.4/sdk/dartsdk-linux-x64-release.zip.sha256sum
# https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.4/sdk/dartsdk-linux-arm64-release.zip
# https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.4/sdk/dartsdk-linux-arm64-release.zip.sha256sum
function install_tool () {
local versioned_tool_path
local DART_SDK_CHANNEL="stable"
local DART_SDK_URL="https://storage.googleapis.com/dart-archive/channels/${DART_SDK_CHANNEL}/release/${TOOL_VERSION}/sdk/dartsdk-linux-x64-release.zip"
local DART_SDK_URL="https://storage.googleapis.com/dart-archive/channels/${DART_SDK_CHANNEL}/release/${TOOL_VERSION}/sdk"
local file
local arch=x64

local dart_file
local checksum_file
local expected_checksum

if [[ "${ARCHITECTURE}" = "aarch64" ]]; then
arch=arm64
fi

# do we need those old unsupported dart versions?
# if [[ $MAJOR -lt 1 || ($MAJOR -eq 1 && $MINOR -lt 11) ]]; then
Expand All @@ -27,7 +39,12 @@ function install_tool () {
exit 1
fi

file=$(get_from_url "$DART_SDK_URL")
dart_file="dartsdk-linux-${arch}-release.zip"
checksum_file=$(get_from_url "${DART_SDK_URL}/${dart_file}.sha256sum")
# get checksum from file
expected_checksum=$(grep "\\*${dart_file}" "${checksum_file}" | cut -d' ' -f1)

file=$(get_from_url "${DART_SDK_URL}/${dart_file}" "${dart_file}" "${expected_checksum}" "sha256sum")

versioned_tool_path=$(create_versioned_tool_path)
bsdtar -C "${versioned_tool_path}" --strip 1 -xf "${file}"
Expand Down
4 changes: 4 additions & 0 deletions src/usr/local/buildpack/utils/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ export TEMP_DIR=/tmp

# used to source helper from tools
export BUILDPACK_DIR=$ROOT_DIR/buildpack

# Used to find matching tool downloads
ARCHITECTURE=$(uname -p)
export ARCHITECTURE
52 changes: 30 additions & 22 deletions test/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RUN install-buildpack
# renovate: datasource=github-tags packageName=git/git
RUN install-tool git v2.39.2

# lerna fails for some unknown reason
ARG IGNORED_TOOLS=erlang,elixir,flutter,lerna,php,composer,python,hashin,pipenv,poetry,ruby,bundler,cocoapods,swift

#--------------------------------------
# Image: test
Expand All @@ -27,23 +29,29 @@ ARG APT_HTTP_PROXY

RUN uname -p | tee | grep aarch64

# renovate datasource=docker
RUN install-tool dart 2.18.0

# renovate: datasource=github-releases packageName=moby/moby
RUN install-tool docker v23.0.1

# renovate: datasource=dotnet packageName=dotnet-sdk
RUN install-tool dotnet 7.0.202

# renovate: datasource=github-releases packageName=containerbase/erlang-prebuild versioning=docker
#RUN install-tool erlang 25.2.2.0
RUN install-tool erlang 25.3.0.0
# renovate: datasource=docker versioning=docker
#RUN install-tool elixir 1.14.3
RUN install-tool elixir 1.14.3

# renovate datasource=flutter-version
#RUN install-tool flutter 3.0.2
RUN install-tool flutter 3.0.2

# renovate: datasource=github-releases packageName=fluxcd/flux2
RUN install-tool flux v0.39.0

# renovate: datasource=github-releases packageName=git-lfs/git-lfs
RUN install-tool git-lfs v3.3.0

# renovate: datasource=docker versioning=docker
RUN install-tool golang 1.20.0

Expand All @@ -54,59 +62,59 @@ RUN install-tool helm v3.11.2
RUN install-tool helmfile v0.150.0

# renovate: datasource=adoptium-java packageName=java-jre
#RUN install-tool java 17.0.6+10
RUN install-tool java 17.0.6+10
# renovate: datasource=gradle-version packageName=gradle versioning=gradle
#RUN install-tool gradle 7.6
RUN install-tool gradle 7.6


# renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize
RUN install-tool kustomize 5.0.0

# renovate: datasource=github-tags packageName=NixOS/nix
RUN install-tool nix 2.13.2

# renovate: datasource=node
RUN install-tool node v18.14.0
RUN install-tool node v18.15.0
# renovate: datasource=npm
RUN install-tool pnpm 7.26.2
# renovate: datasource=npm
RUN install-tool yarn 1.22.19
# renovate: datasource=npm
# fails for some reason
#RUN install-tool lerna 6.4.1
RUN install-tool lerna 6.5.1

# renovate: datasource=github-releases packageName=containerbase/php-prebuild
#RUN install-tool php 8.2.2
RUN install-tool php 8.2.3
# renovate: datasource=github-releases packageName=composer/composer
#RUN install-tool composer 2.5.2
RUN install-tool composer 2.5.4

# renovate: datasource=github-releases packageName=PowerShell/PowerShell
RUN install-tool powershell v7.3.2
RUN install-tool powershell v7.3.3

# renovate: datasource=github-releases packageName=containerbase/python-prebuild
#RUN install-tool python 3.11.1
RUN install-tool python 3.11.2
# renovate: datasource=pypi
#RUN install-pip pipenv 2023.2.4
RUN install-tool pipenv 2023.2.18
# renovate: datasource=pypi
#RUN install-pip hashin 0.17.0
RUN install-tool hashin 0.17.0
# renovate: datasource=pypi
#RUN install-tool poetry 1.3.2
RUN install-tool poetry 1.4.0

# renovate: datasource=github-releases packageName=containerbase/ruby-prebuild versioning=ruby
#RUN install-tool ruby 3.2.0
RUN install-tool ruby 3.2.1
# renovate: datasource=rubygems versioning=ruby
#RUN install-tool bundler 2.4.6
RUN install-tool bundler 2.4.8
# renovate: datasource=rubygems versioning=ruby
#RUN install-tool cocoapods 1.11.3
RUN install-tool cocoapods 1.12.0

# renovate: datasource=docker versioning=docker
RUN install-tool rust 1.67.0

# renovate: datasource=docker versioning=docker
#RUN install-tool swift 5.7.3
RUN install-tool swift 5.7.3

# renovate: datasource=docker packageName=hashicorp/terraform versioning=docker
RUN install-tool terraform 1.3.7

# renovate: datasource=github-releases packageName=git-lfs/git-lfs
RUN install-tool git-lfs v3.3.0

# renovate: datasource=github-releases packageName=jsonnet-bundler/jsonnet-bundler
RUN install-tool jb v0.5.1

Expand Down
16 changes: 9 additions & 7 deletions test/Dockerfile.jammy
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ FROM base as test

ARG APT_HTTP_PROXY

# renovate datasource=docker
RUN install-tool dart 2.18.0

# renovate: datasource=dotnet packageName=dotnet-sdk
RUN install-tool dotnet 7.0.202

Expand All @@ -39,12 +42,12 @@ RUN install-tool flutter 3.0.2
# renovate: datasource=github-releases packageName=fluxcd/flux2
RUN install-tool flux v0.41.1

# renovate: datasource=github-releases packageName=git-lfs/git-lfs
RUN install-tool git-lfs v3.3.0

# renovate: datasource=docker versioning=docker
RUN install-tool golang 1.20.2

# renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize
RUN install-tool kustomize 5.0.0

# renovate: datasource=github-releases packageName=helm/helm
RUN install-tool helm v3.11.2

Expand All @@ -56,6 +59,9 @@ RUN install-tool java 17.0.6+10
# renovate: datasource=gradle-version packageName=gradle versioning=gradle
RUN install-tool gradle 8.0.2

# renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize
RUN install-tool kustomize 5.0.0

# renovate: datasource=github-tags packageName=NixOS/nix
RUN install-tool nix 2.14.1

Expand Down Expand Up @@ -101,10 +107,6 @@ RUN install-tool swift 5.7.3
# renovate: datasource=docker packageName=hashicorp/terraform versioning=docker
RUN install-tool terraform 1.4.1

# renovate: datasource=github-releases packageName=git-lfs/git-lfs
RUN install-tool git-lfs v3.3.0
RUN git lfs version

# renovate: datasource=github-releases packageName=jsonnet-bundler/jsonnet-bundler
RUN install-tool jb v0.5.1

Expand Down

0 comments on commit a239248

Please sign in to comment.