From d3a7889c078d2874b9cc3ba5736ae62c0879ab92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 22 Mar 2024 16:14:21 +0100 Subject: [PATCH] Simplify `truffleruby+graalvm-dev` build definition re: download redirect The `http get ` utility had a bug with aria2c downloader where it couldn't properly save to destfile if it was an absolute path. I have tried having `http get -` output the downloaded file to stdout, but this conflicted with the output of `log_command` (which is also to stdout) so for now let's keep using the temporary file to resolve manual URL redirects. --- bin/ruby-build | 11 +++++++++-- share/ruby-build/truffleruby+graalvm-dev | 18 ++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/bin/ruby-build b/bin/ruby-build index 1fc15433dd..db6cb3fde7 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -423,8 +423,15 @@ http_head_aria2c() { } http_get_aria2c() { - # shellcheck disable=SC2086 - log_command aria2c --allow-overwrite=true --no-conf=true --console-log-level=warn --stderr $ARIA2_OPTS -o "$2" "$1" 2>&3 + local destfile="$2" + if [[ $destfile == /* ]]; then + # the "-o" option to aria2c cannot be an absolute path, but we can achieve that with "--dir" + # shellcheck disable=SC2086 + log_command aria2c --allow-overwrite=true --no-conf=true --console-log-level=warn --stderr $ARIA2_OPTS --dir "${destfile%/*}" -o "${destfile##*/}" "$1" 2>&3 + else + # shellcheck disable=SC2086 + log_command aria2c --allow-overwrite=true --no-conf=true --console-log-level=warn --stderr $ARIA2_OPTS -o "$destfile" "$1" 2>&3 + fi } http_head_curl() { diff --git a/share/ruby-build/truffleruby+graalvm-dev b/share/ruby-build/truffleruby+graalvm-dev index 231e2e33fb..a6e65edb76 100644 --- a/share/ruby-build/truffleruby+graalvm-dev +++ b/share/ruby-build/truffleruby+graalvm-dev @@ -1,16 +1,16 @@ platform="$(uname -s)-$(uname -m)" case $platform in Linux-x86_64) - url="https://raw.githubusercontent.com/graalvm/graal-languages-ea-builds/main/truffleruby/versions/latest-jvm-linux-amd64.url" + url="https://github.com/graalvm/graal-languages-ea-builds/raw/HEAD/truffleruby/versions/latest-jvm-linux-amd64.url" ;; Linux-aarch64) - url="https://raw.githubusercontent.com/graalvm/graal-languages-ea-builds/main/truffleruby/versions/latest-jvm-linux-aarch64.url" + url="https://github.com/graalvm/graal-languages-ea-builds/raw/HEAD/truffleruby/versions/latest-jvm-linux-aarch64.url" ;; Darwin-x86_64) - url="https://raw.githubusercontent.com/graalvm/graal-languages-ea-builds/main/truffleruby/versions/latest-jvm-darwin-amd64.url" + url="https://github.com/graalvm/graal-languages-ea-builds/raw/HEAD/truffleruby/versions/latest-jvm-darwin-amd64.url" ;; Darwin-arm64) - url="https://raw.githubusercontent.com/graalvm/graal-languages-ea-builds/main/truffleruby/versions/latest-jvm-darwin-aarch64.url" + url="https://github.com/graalvm/graal-languages-ea-builds/raw/HEAD/truffleruby/versions/latest-jvm-darwin-aarch64.url" ;; *) colorize 1 "Unsupported platform: $platform" @@ -18,9 +18,7 @@ Darwin-arm64) ;; esac -pushd "$BUILD_PATH" >/dev/null -http get $url url.txt -url=$(