Skip to content

Commit 3bab6e1

Browse files
committed
Support all ruby-build http clients
The http function doesn't support "-" as stdout when using the aria2c client.
1 parent 44a551e commit 3bab6e1

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

rubies/truffleruby+graalvm-gftc-dev

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
http_get_stdout () {
2+
local f="$(mktemp "ruby-build.http.XXXXXX")"
3+
http get "$1" "$f"
4+
cat "$f"
5+
rm -f "$f"
6+
}
7+
18
sort_release_urls () {
29
# With release names like /^(jdk-)?24.1.0-dev-20240207_2228$/
310
# strip everything up to the last dash so we can use the date as the sort field.
@@ -14,11 +21,11 @@ find_asset_url () {
1421
# The releases page hides assets behind an "expanded_assets" url
1522
# so we gather those, sort them according to "sort_release_urls" and store
1623
# them in an array to loop over next.
17-
IFS=$'\n' read -d '' -r -a assets_urls < <(http get "$releases_prefix" - | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
24+
IFS=$'\n' read -d '' -r -a assets_urls < <(http_get_stdout "$releases_prefix" | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
1825

1926
# For each release look in the assets output for a download link to the specified filename.
2027
for assets_url in "${assets_urls[@]}"; do
21-
path="$(http get "$assets_url" - | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
28+
path="$(http_get_stdout "$assets_url" | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
2229
if [[ -n "$path" ]]; then
2330
echo "https://github.com/$path"
2431
return 0

rubies/truffleruby-gftc-dev

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
http_get_stdout () {
2+
local f="$(mktemp "ruby-build.http.XXXXXX")"
3+
http get "$1" "$f"
4+
cat "$f"
5+
rm -f "$f"
6+
}
7+
18
sort_release_urls () {
29
# With release names like /^(jdk-)?24.1.0-dev-20240207_2228$/
310
# strip everything up to the last dash so we can use the date as the sort field.
@@ -14,11 +21,11 @@ find_asset_url () {
1421
# The releases page hides assets behind an "expanded_assets" url
1522
# so we gather those, sort them according to "sort_release_urls" and store
1623
# them in an array to loop over next.
17-
IFS=$'\n' read -d '' -r -a assets_urls < <(http get "$releases_prefix" - | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
24+
IFS=$'\n' read -d '' -r -a assets_urls < <(http_get_stdout "$releases_prefix" | grep -oE "$releases_prefix/expanded_assets/[^\"]+" | $sort_release_urls)
1825

1926
# For each release look in the assets output for a download link to the specified filename.
2027
for assets_url in "${assets_urls[@]}"; do
21-
path="$(http get "$assets_url" - | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
28+
path="$(http_get_stdout "$assets_url" | grep -m1 -oE "/$repo/releases/download/[^/]+/$filename")"
2229
if [[ -n "$path" ]]; then
2330
echo "https://github.com/$path"
2431
return 0

0 commit comments

Comments
 (0)