Skip to content

Commit 3895e4f

Browse files
committedJun 3, 2024··
Merge ruby-build v20230330
* commit 'refs/rbtags/v20230330': ruby-build 20230330 Avoid shellcheck CI job commenting on every PR Upgrade from OpenSSL 3.0 to OpenSSL 3.1 Add definitions for Ruby 2.7.8, 3.0.6, 3.1.4, 3.2.2 (#2174) Remove AWS access key ID from version control (#2163) ruby-build 20230309 Add JRuby 9.4.2.0 ruby-build 20230306 appease linter add stub_repeated test helper automatically detect and use Homebrew's libyaml Add mruby-3.2.0 ruby-build 20230222 Update truffleruby+graalvm-dev builds to use the latest Java LTS build as a base. Update truffleruby-dev to use builds based on Ubuntu 20.04. Remove brew update instruction (#2151) release script: handle multiple releases on the same day ruby-build 20230208.1 Add Ruby 3.2.1 http://topazruby.com/ is 404 now ruby-build 20230208 bump openssl version to 1.1.1t bump openssl version to 3.0.8 Update sha2 for JRuby 1.7.2 Removed definitions that are already removed from official site Use the current JRuby download url Bump redhat-plumbers-in-action/differential-shellcheck from 3 to 4 Bump mislav/bump-homebrew-formula-action from 1 to 2 Bump actions/checkout from 2 to 3 Added dependabot update for GitHub Actions Remove patch for openssl-1.1.1q Add JRuby 9.4.1.0 ruby-build 20230202 Add JRuby 9.3.10.0 graalvm-ce-dev-builds are now using JDK 19
2 parents 78662a5 + 855b963 commit 3895e4f

File tree

7 files changed

+98
-21
lines changed

7 files changed

+98
-21
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ brew install node-build
4747

4848
Upgrade with:
4949
```sh
50-
brew update && brew upgrade node-build
50+
brew upgrade node-build
5151
```
5252

5353
### Clone as nodenv plugin using git

‎bin/nodenv-install

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ if [ "$STATUS" == "2" ]; then
244244
echo -n "If the version you need is missing, try upgrading node-build"
245245
if [ "$here" != "${here#$(brew --prefix 2>/dev/null)}" ]; then
246246
printf ":\\n\\n"
247-
echo " brew update && brew upgrade node-build"
247+
echo " brew upgrade node-build"
248248
elif [ -d "${here}/.git" ]; then
249249
printf ":\\n\\n"
250250
echo " git -C ${here} pull"

‎test/build.bats

+19-7
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ assert_build_log() {
6060
@test "apply node patch before building" {
6161
cached_tarball "node-v4.0.0"
6262

63-
stub brew false
63+
stub_repeated uname '-s : echo Linux'
64+
stub_repeated brew false
6465
stub_make_install
6566
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
6667

@@ -71,6 +72,8 @@ diff -pU3 align.c align.c
7172
PATCH
7273
assert_success
7374

75+
unstub uname
76+
unstub brew
7477
unstub make
7578
unstub patch
7679

@@ -85,7 +88,8 @@ OUT
8588
@test "striplevel node patch before building" {
8689
cached_tarball "node-v4.0.0"
8790

88-
stub brew false
91+
stub_repeated uname '-s : echo Linux'
92+
stub_repeated brew false
8993
stub_make_install
9094
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
9195

@@ -96,6 +100,8 @@ diff -pU3 a/configure b/configure
96100
PATCH
97101
assert_success
98102

103+
unstub uname
104+
unstub brew
99105
unstub make
100106
unstub patch
101107

@@ -110,7 +116,8 @@ OUT
110116
@test "apply node patch from git diff before building" {
111117
cached_tarball "node-v4.0.0"
112118

113-
stub brew false
119+
stub_repeated uname '-s : echo Linux'
120+
stub_repeated brew false
114121
stub_make_install
115122
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
116123

@@ -122,6 +129,8 @@ index 4760c31..66a237a 100755
122129
PATCH
123130
assert_success
124131

132+
unstub uname
133+
unstub brew
125134
unstub make
126135
unstub patch
127136

@@ -136,7 +145,7 @@ OUT
136145
@test "number of CPU cores defaults to 2" {
137146
cached_tarball "node-v4.0.0"
138147

139-
stub uname '-s : echo Darwin'
148+
stub_repeated uname '-s : echo Darwin'
140149
stub sysctl false
141150
stub_make_install
142151

@@ -159,7 +168,7 @@ OUT
159168
@test "number of CPU cores is detected on Mac" {
160169
cached_tarball "node-v4.0.0"
161170

162-
stub uname '-s : echo Darwin'
171+
stub_repeated uname '-s : echo Darwin'
163172
stub sysctl '-n hw.ncpu : echo 4'
164173
stub_make_install
165174

@@ -183,7 +192,7 @@ OUT
183192
@test "number of CPU cores is detected on FreeBSD" {
184193
cached_tarball "node-v4.0.0"
185194

186-
stub uname '-s : echo FreeBSD'
195+
stub_repeated uname '-s : echo FreeBSD'
187196
stub sysctl '-n hw.ncpu : echo 1'
188197
stub_make_install
189198

@@ -207,6 +216,7 @@ OUT
207216
@test "setting NODE_MAKE_INSTALL_OPTS to a multi-word string" {
208217
cached_tarball "node-v4.0.0"
209218

219+
stub_repeated uname '-s : echo Linux'
210220
stub_make_install
211221

212222
export NODE_MAKE_INSTALL_OPTS="DOGE=\"such wow\""
@@ -227,6 +237,7 @@ OUT
227237
@test "setting MAKE_INSTALL_OPTS to a multi-word string" {
228238
cached_tarball "node-v4.0.0"
229239

240+
stub_repeated uname '-s : echo Linux'
230241
stub_make_install
231242

232243
export MAKE_INSTALL_OPTS="DOGE=\"such wow\""
@@ -256,7 +267,7 @@ OUT
256267
@test "make on FreeBSD defaults to gmake" {
257268
cached_tarball "node-v4.0.0"
258269

259-
stub uname "-s : echo FreeBSD"
270+
stub_repeated uname "-s : echo FreeBSD"
260271
MAKE=gmake stub_make_install
261272

262273
MAKE= install_fixture definitions/vanilla-node
@@ -275,6 +286,7 @@ apply -p1 -i /my/patch.diff
275286
exec ./configure "\$@"
276287
CONF
277288

289+
stub_repeated uname '-s : echo Linux'
278290
stub apply 'echo apply "$@" >> build.log'
279291
stub_make_install
280292

‎test/compiler.bats

+60-6
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,66 @@ export -n CFLAGS
77
export -n CC
88
export -n NODE_CONFIGURE_OPTS
99

10+
@test "require_gcc on OS X 10.9" {
11+
stub_repeated uname '-s : echo Darwin'
12+
stub sw_vers '-productVersion : echo 10.9.5'
13+
stub_repeated gcc '--version : echo 4.2.1'
14+
15+
run_inline_definition <<DEF
16+
require_gcc
17+
echo CC=\$CC
18+
echo MACOSX_DEPLOYMENT_TARGET=\${MACOSX_DEPLOYMENT_TARGET-no}
19+
DEF
20+
assert_success
21+
assert_output <<OUT
22+
CC=${TMP}/bin/gcc
23+
MACOSX_DEPLOYMENT_TARGET=no
24+
OUT
25+
26+
unstub uname
27+
unstub sw_vers
28+
unstub gcc
29+
}
30+
31+
@test "require_gcc on OS X 10.10" {
32+
stub_repeated uname '-s : echo Darwin'
33+
stub sw_vers '-productVersion : echo 10.10'
34+
stub_repeated gcc '--version : echo 4.2.1'
35+
36+
run_inline_definition <<DEF
37+
require_gcc
38+
echo CC=\$CC
39+
echo MACOSX_DEPLOYMENT_TARGET=\${MACOSX_DEPLOYMENT_TARGET-no}
40+
DEF
41+
assert_success
42+
assert_output <<OUT
43+
CC=${TMP}/bin/gcc
44+
MACOSX_DEPLOYMENT_TARGET=10.9
45+
OUT
46+
47+
unstub uname
48+
unstub sw_vers
49+
unstub gcc
50+
}
51+
52+
@test "require_gcc silences warnings" {
53+
stub gcc '--version : echo warning >&2; echo 4.2.1' '--version : echo warning >&2; echo 4.2.1'
54+
55+
run_inline_definition <<DEF
56+
require_gcc
57+
echo \$CC
58+
DEF
59+
assert_success "${TMP}/bin/gcc"
60+
}
61+
1062
@test "CC=clang by default on OS X 10.10" {
1163
mkdir -p "$INSTALL_ROOT"
1264
cd "$INSTALL_ROOT"
1365

14-
stub uname '-s : echo Darwin' '-s : echo Darwin'
66+
stub_repeated uname '-s : echo Darwin'
1567
stub sw_vers '-productVersion : echo 10.10'
16-
stub cc 'false'
17-
stub brew 'false'
18-
stub make \
19-
'echo make $@' \
20-
'echo make $@'
68+
stub_repeated brew 'false'
69+
stub_repeated make 'echo make $@'
2170

2271
cat > ./configure <<CON
2372
#!${BASH}
@@ -40,4 +89,9 @@ CFLAGS=no
4089
make -j 2
4190
make install
4291
OUT
92+
93+
unstub uname
94+
unstub sw_vers
95+
unstub brew
96+
unstub make
4397
}

‎test/nodenv.bats

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ OUT
8282
}
8383

8484
@test "nonexistent version" {
85-
stub brew false
85+
stub_repeated brew false
8686
stub_node_build 'echo ERROR >&2 && exit 2' \
8787
"--definitions : echo 0.8.7 0.10.4 0.10.6 1.0.0 4.1.2 | tr ' ' $'\\n'"
8888

@@ -102,6 +102,7 @@ If the version you need is missing, try upgrading node-build:
102102
git -C ${BATS_TEST_DIRNAME}/.. pull
103103
OUT
104104

105+
unstub brew
105106
unstub node-build
106107
}
107108

@@ -119,7 +120,7 @@ See all available versions with \`nodenv install --list'.
119120
120121
If the version you need is missing, try upgrading node-build:
121122
122-
brew update && brew upgrade node-build
123+
brew upgrade node-build
123124
OUT
124125

125126
unstub brew

‎test/stubs/stub

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
status=0
4+
status=127
55
program="${0##*/}"
66
PROGRAM="$(echo "$program" | tr a-z- A-Z_)"
77
[ -n "$TMPDIR" ] || TMPDIR="/tmp"
88

99
_STUB_PLAN="${PROGRAM}_STUB_PLAN"
1010
_STUB_RUN="${PROGRAM}_STUB_RUN"
1111
_STUB_INDEX="${PROGRAM}_STUB_INDEX"
12+
_STUB_NOINDEX="${PROGRAM}_STUB_NOINDEX"
1213
_STUB_RESULT="${PROGRAM}_STUB_RESULT"
1314
_STUB_END="${PROGRAM}_STUB_END"
1415
_STUB_DEBUG="${PROGRAM}_STUB_DEBUG"
@@ -32,7 +33,7 @@ index=0
3233
while IFS= read -r line; do
3334
index=$(($index + 1))
3435

35-
if [ -z "${!_STUB_END}" ] && [ $index -eq "${!_STUB_INDEX}" ]; then
36+
if [[ -z "${!_STUB_END}" && -n "${!_STUB_NOINDEX}" || $index -eq "${!_STUB_INDEX}" ]]; then
3637
# We found the plan line we're interested in.
3738
# Start off by assuming success.
3839
result=0
@@ -72,7 +73,8 @@ while IFS= read -r line; do
7273
( eval "$command" )
7374
status="$?"
7475
set -e
75-
else
76+
[ -z "${!_STUB_NOINDEX}" ] || break
77+
elif [ -z "${!_STUB_NOINDEX}" ]; then
7678
eval "${_STUB_RESULT}"=1
7779
fi
7880
fi
@@ -95,7 +97,7 @@ if [ -n "${!_STUB_END}" ]; then
9597
else
9698
# If the requested index is larger than the number
9799
# of lines in the plan file, we failed.
98-
if [ "${!_STUB_INDEX}" -gt $index ]; then
100+
if [[ -z "${!_STUB_NOINDEX}" && "${!_STUB_INDEX}" -gt $index ]]; then
99101
eval "${_STUB_RESULT}"=1
100102
fi
101103

‎test/test_helper.bash

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ teardown() {
4141
rm -fr "${BATS_TMPDIR:?}"/*
4242
}
4343

44+
stub_repeated() {
45+
local program="$1"
46+
# shellcheck disable=SC2155
47+
local prefix="$(echo "$program" | tr a-z- A-Z_)"
48+
export "${prefix}_STUB_NOINDEX"=1
49+
stub "$@"
50+
}
51+
4452
run_inline_definition() {
4553
local definition="${BATS_TMPDIR}/build-definition"
4654
cat > "$definition"

0 commit comments

Comments
 (0)
Please sign in to comment.