Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(composer): use getcomposer.org with checksum #734

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/usr/local/buildpack/tools/v2/composer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@ function install_tool () {
local versioned_tool_path
local file

local checksum_file
local original_checksum

checksum_file=$(get_from_url "https://getcomposer.org/download/${TOOL_VERSION}/composer.phar.sha256sum")
# get checksum from file
original_checksum=$(grep "composer.phar" "${checksum_file}" | cut -d' ' -f1)

versioned_tool_path=$(create_versioned_tool_path)
file=$(get_from_url "https://github.com/composer/composer/releases/download/${TOOL_VERSION}/composer.phar")
file=$(get_from_url \
"https://getcomposer.org/download/${TOOL_VERSION}/composer.phar" \
"composer.phar" \
"${original_checksum}" \
"sha256sum" )

create_folder "${versioned_tool_path}/bin"
cp "${file}" "${versioned_tool_path}/bin/composer"
Expand Down
3 changes: 3 additions & 0 deletions src/usr/local/buildpack/tools/v2/maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function install_tool () {
local versioned_tool_path
versioned_tool_path=$(create_versioned_tool_path)

local checksum_file
local original_checksum

viceice marked this conversation as resolved.
Show resolved Hide resolved
local file
# https://downloads.apache.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
local URL='https://downloads.apache.org'
Expand Down
7 changes: 5 additions & 2 deletions src/usr/local/buildpack/tools/v2/node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ function install_tool () {
local npm # temp npm executable
local arch=linux-x64

checksums=$(get_from_url "https://nodejs.org/dist/v${TOOL_VERSION}/SHASUMS256.txt")
local checksum_file
local original_checksum

checksum_file=$(get_from_url "https://nodejs.org/dist/v${TOOL_VERSION}/SHASUMS256.txt")
viceice marked this conversation as resolved.
Show resolved Hide resolved

# get checksum from file
original_checksum=$(grep "node-v${TOOL_VERSION}-${arch}.tar.xz" "${checksums}" | cut -d' ' -f1)
original_checksum=$(grep "node-v${TOOL_VERSION}-${arch}.tar.xz" "${checksum_file}" | cut -d' ' -f1)

# download file
file=$(get_from_url \
Expand Down
2 changes: 1 addition & 1 deletion src/usr/local/buildpack/utils/cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function verify_checksum () {
;;
esac
if [ "$real_checksum" != "$expected_checksum" ]; then
echo "Checksum does not match for file ${file}. Expected: ${expected_checksum} - Got: ${real_checksum}" >&2
echo "Checksum does not match for file ${file}. Expected: '${expected_checksum}' - Got: '${real_checksum}'" >&2
return 1
fi
return 0
Expand Down