diff --git a/.gitignore b/.gitignore index a9041f93..fb904bc9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tmp/ cookbooks/ .bundle/ vendor/bundle +*.sublime-workspace diff --git a/.ruby-version b/.ruby-version index a603bb50..ef538c28 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.5 +3.1.2 diff --git a/.rubygems-version b/.rubygems-version index e852534b..86fb6504 100644 --- a/.rubygems-version +++ b/.rubygems-version @@ -1 +1 @@ -3.2.33 +3.3.7 diff --git a/.sublime-text/sprout-wrap.sublime-project b/.sublime-text/sprout-wrap.sublime-project new file mode 100644 index 00000000..ee4f1124 --- /dev/null +++ b/.sublime-text/sprout-wrap.sublime-project @@ -0,0 +1,8 @@ +{ + "folders": + [ + { + "path": "../." + } + ] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..d34d678e --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "davidanson.vscode-markdownlint", + "elagil.pre-commit-helper", + "cschleiden.vscode-github-actions" + ] +} diff --git a/.vscode/sprout-wrap.code-workspace b/.vscode/sprout-wrap.code-workspace new file mode 100644 index 00000000..64bfb872 --- /dev/null +++ b/.vscode/sprout-wrap.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": ".." + } + ], + "settings": {} +} diff --git a/Gemfile b/Gemfile index 62de427c..be0f5d67 100644 --- a/Gemfile +++ b/Gemfile @@ -32,4 +32,4 @@ group :development do gem 'fauxhai', '~> 6.0.0', require: false # versions after 6.0.1 remove `node['etc']` end -gem 'chef-zero', '~> 13.1', require: false # versions after 14.x require ruby 2.4 +#gem 'chef-zero', '~> 13.1', require: false # versions after 14.x require ruby 2.4 diff --git a/Gemfile.lock b/Gemfile.lock index 46071713..cc6cbb21 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,62 +5,94 @@ GEM public_suffix (>= 2.0.2, < 5.0) ast (2.4.2) awesome_print (1.9.2) + bcrypt_pbkdf (1.1.0.rc1) builder (3.2.4) byebug (11.1.3) - chef (13.10.0) + chef (16.7.61) addressable + bcrypt_pbkdf (= 1.1.0.rc1) bundler (>= 1.10) - chef-config (= 13.10.0) - chef-zero (~> 13.0) - diff-lcs (~> 1.2, >= 1.2.4) + chef-config (= 16.7.61) + chef-utils (= 16.7.61) + chef-vault + chef-zero (>= 14.0.11) + diff-lcs (>= 1.2.4, < 1.4.0) + ed25519 (~> 1.2) erubis (~> 2.7) + ffi (>= 1.9.25) + ffi-libarchive (~> 1.0, >= 1.0.3) ffi-yajl (~> 2.2) - highline (~> 1.6, >= 1.6.9) + highline (>= 1.6.9, < 3) iniparse (~> 1.4) - iso8601 (~> 0.9.1) - mixlib-archive (~> 0.4) - mixlib-authentication (~> 1.4) - mixlib-cli (~> 1.7) - mixlib-log (~> 1.3) - mixlib-shellout (~> 2.0) - net-sftp (~> 2.1, >= 2.1.2) - net-ssh (>= 2.9, < 5.0) + license-acceptance (>= 1.0.5, < 3) + mixlib-archive (>= 0.4, < 2.0) + mixlib-authentication (>= 2.1, < 4) + mixlib-cli (>= 2.1.1, < 3.0) + mixlib-log (>= 2.0.3, < 4.0) + mixlib-shellout (>= 3.1.1, < 4.0) + net-sftp (>= 2.1.2, < 4.0) + net-ssh (>= 4.2, < 7) net-ssh-multi (~> 1.2, >= 1.2.1) - ohai (~> 13.0) + ohai (~> 16.0) + pastel plist (~> 3.2) proxifier (~> 1.0) - rspec-core (~> 3.5) - rspec-expectations (~> 3.5) - rspec-mocks (~> 3.5) - rspec_junit_formatter (~> 0.2.0) - serverspec (~> 2.7) - specinfra (~> 2.10) syslog-logger (~> 1.6) + train-core (~> 3.2, >= 3.2.28) + train-winrm (>= 0.2.5) + tty-prompt (~> 0.21) + tty-screen (~> 0.6) + tty-table (~> 0.11) uuidtools (~> 2.1.5) - chef-config (13.10.0) + chef-cli (5.6.1) + addressable (>= 2.3.5, < 2.9) + chef (>= 16.0) + cookbook-omnifetch (~> 0.5) + diff-lcs (>= 1.0, < 1.4) + ffi-yajl (>= 1.0, < 3.0) + license-acceptance (>= 1.0.11, < 3) + minitar (~> 0.6) + mixlib-cli (>= 1.7, < 3.0) + mixlib-shellout (>= 2.0, < 4.0) + pastel (~> 0.7) + solve (> 2.0, < 5.0) + chef-config (16.7.61) addressable + chef-utils (= 16.7.61) fuzzyurl - mixlib-config (>= 2.2.12, < 3.0) - mixlib-shellout (~> 2.0) + mixlib-config (>= 2.2.12, < 4.0) + mixlib-shellout (>= 2.0, < 4.0) tomlrb (~> 1.2) - chef-zero (13.1.0) + chef-utils (16.7.61) + chef-vault (4.1.10) + chef-zero (15.0.11) ffi-yajl (~> 2.2) - hashie (>= 2.0, < 4.0) - mixlib-log (~> 1.3) - rack (~> 2.0) + hashie (>= 2.0, < 5.0) + mixlib-log (>= 2.0, < 4.0) + rack (~> 2.0, >= 2.0.6) uuidtools (~> 2.1) - chefspec (7.3.4) - chef (>= 12.16.42) - fauxhai (>= 4) + webrick + chefspec (9.3.3) + chef (>= 15) + chef-cli + fauxhai-ng (>= 7.5) rspec (~> 3.0) coderay (1.1.3) + cookbook-omnifetch (0.11.1) + mixlib-archive (>= 0.4, < 2.0) coolline (0.5.0) unicode_utils (~> 1.4) - diff-lcs (1.5.0) + diff-lcs (1.3) + ed25519 (1.3.0) + erubi (1.10.0) erubis (2.7.0) fauxhai (6.0.1) net-ssh + fauxhai-ng (9.3.0) + net-ssh ffi (1.15.5) + ffi-libarchive (1.1.3) + ffi (~> 1.0) ffi-yajl (2.4.0) libyajl2 (>= 1.2) foodcritic (16.3.0) @@ -72,6 +104,8 @@ GEM treetop (~> 1.4) formatador (0.3.0) fuzzyurl (0.9.0) + gssapi (1.3.1) + ffi (>= 1.0.1) guard (2.18.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) @@ -93,11 +127,15 @@ GEM guard-shell (0.7.2) guard (>= 2.0.0) guard-compat (~> 1.0) + gyoku (1.4.0) + builder (>= 2.1.2) + rexml (~> 3.0) hashie (2.1.2) - highline (1.7.10) + highline (2.0.3) + httpclient (2.8.3) iniparse (1.5.0) ipaddress (0.8.3) - iso8601 (0.9.1) + json (2.6.1) librarian (0.1.2) highline thor (~> 0.15) @@ -106,34 +144,44 @@ GEM librarian (~> 0.1.0) minitar (>= 0.5.2) libyajl2 (2.1.0) + license-acceptance (2.1.13) + pastel (~> 0.7) + tomlrb (>= 1.2, < 3.0) + tty-box (~> 0.6) + tty-prompt (~> 0.20) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + little-plugger (1.1.4) + logging (2.3.0) + little-plugger (~> 1.1) + multi_json (~> 1.14) lumberjack (1.2.8) method_source (1.0.0) mini_portile2 (2.7.1) minitar (0.9) - mixlib-archive (0.4.20) + mixlib-archive (1.1.7) mixlib-log - mixlib-authentication (1.4.2) - mixlib-cli (1.7.0) - mixlib-config (2.2.18) + mixlib-authentication (3.0.10) + mixlib-cli (2.1.8) + mixlib-config (3.0.9) tomlrb - mixlib-log (1.7.1) - mixlib-shellout (2.4.4) + mixlib-log (3.0.9) + mixlib-shellout (3.2.7) + chef-utils + molinillo (0.8.0) multi_json (1.15.0) nenv (0.3.0) net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) - net-sftp (2.1.2) - net-ssh (>= 2.6.5) - net-ssh (4.2.0) + net-sftp (3.0.0) + net-ssh (>= 5.0.0, < 7.0.0) + net-ssh (6.1.0) net-ssh-gateway (2.0.0) net-ssh (>= 4.0.0) net-ssh-multi (1.2.1) net-ssh (>= 2.6.5) net-ssh-gateway (>= 1.2.0) - net-telnet (0.1.1) nokogiri (1.13.1) mini_portile2 (~> 2.7.0) racc (~> 1.4) @@ -143,24 +191,28 @@ GEM racc (~> 1.4) nokogiri (1.13.1-x86_64-linux) racc (~> 1.4) + nori (2.6.0) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - ohai (13.12.6) - chef-config (>= 12.5.0.alpha.1, < 14) + ohai (16.17.0) + chef-config (>= 14.12, < 17) + chef-utils (>= 16.0, < 17) ffi (~> 1.9) ffi-yajl (~> 2.2) ipaddress - mixlib-cli (< 2.0) - mixlib-config (~> 2.0) - mixlib-log (>= 1.7.1, < 2.0) - mixlib-shellout (~> 2.0) + mixlib-cli (>= 1.7.0) + mixlib-config (>= 2.0, < 4.0) + mixlib-log (>= 2.0.1, < 4.0) + mixlib-shellout (~> 3.2, >= 3.2.5) plist (~> 3.1) - systemu (~> 2.6.4) + train-core wmi-lite (~> 1.0) - parallel (1.21.0) + parallel (1.22.1) parser (3.1.0.0) ast (~> 2.4.1) + pastel (0.8.0) + tty-color (~> 0.5) plist (3.6.0) polyglot (0.3.5) proxifier (1.0.3) @@ -173,7 +225,7 @@ GEM pry-coolline (0.2.6) coolline (~> 0.5) pry (~> 0.13) - public_suffix (4.0.6) + public_suffix (4.0.7) racc (1.6.0) rack (2.2.3) rainbow (3.1.1) @@ -183,25 +235,19 @@ GEM ffi (~> 1.0) regexp_parser (2.2.0) rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rspec (3.11.0) + rspec-core (~> 3.11.0) + rspec-expectations (~> 3.11.0) + rspec-mocks (~> 3.11.0) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-its (1.3.0) - rspec-core (>= 3.0.0) - rspec-expectations (>= 3.0.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.11.0) + rspec-mocks (3.11.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.3) - rspec_junit_formatter (0.2.3) - builder (< 4) - rspec-core (>= 2, < 4, != 2.12.0) + rspec-support (~> 3.11.0) + rspec-support (3.11.0) rubocop (1.24.1) parallel (~> 1.10) parser (>= 3.0.0.0) @@ -214,13 +260,10 @@ GEM rubocop-ast (1.15.1) parser (>= 3.0.1.1) ruby-progressbar (1.11.0) + rubyntlm (0.6.3) + rubyzip (2.3.2) rufus-lru (1.1.0) - serverspec (2.41.8) - multi_json - rspec (~> 3.0) - rspec-its - specinfra (~> 2.72) - sfl (2.3) + semverse (3.0.0) shellany (0.0.1) soloist (1.0.3) awesome_print @@ -229,32 +272,84 @@ GEM librarian-chef net-ssh thor - specinfra (2.83.1) - net-scp - net-ssh (>= 2.7) - net-telnet (= 0.1.1) - sfl + solve (4.0.4) + molinillo (~> 0.6) + semverse (>= 1.1, < 4.0) + strings (0.2.1) + strings-ansi (~> 0.2) + unicode-display_width (>= 1.5, < 3.0) + unicode_utils (~> 1.4) + strings-ansi (0.2.0) syslog-logger (1.6.8) - systemu (2.6.5) thor (0.20.3) tomlrb (1.3.0) + train-core (3.9.2) + addressable (~> 2.5) + ffi (!= 1.13.0) + json (>= 1.8, < 3.0) + mixlib-shellout (>= 2.0, < 4.0) + net-scp (>= 1.2, < 4.0) + net-ssh (>= 2.9, < 7.0) + train-winrm (0.2.13) + winrm (>= 2.3.6, < 3.0) + winrm-elevated (~> 1.2.2) + winrm-fs (~> 1.0) treetop (1.6.11) polyglot (~> 0.3) + tty-box (0.7.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-cursor (~> 0.7) + tty-color (0.6.0) + tty-cursor (0.7.1) + tty-prompt (0.23.1) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.9.0) + tty-cursor (~> 0.7) + tty-screen (~> 0.8) + wisper (~> 2.0) + tty-screen (0.8.1) + tty-table (0.12.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-screen (~> 0.8) unicode-display_width (2.1.0) unicode_utils (1.4.0) uuidtools (2.1.5) - wmi-lite (1.0.5) + webrick (1.7.0) + winrm (2.3.6) + builder (>= 2.1.2) + erubi (~> 1.8) + gssapi (~> 1.2) + gyoku (~> 1.0) + httpclient (~> 2.2, >= 2.2.0.2) + logging (>= 1.6.1, < 3.0) + nori (~> 2.0) + rubyntlm (~> 0.6.0, >= 0.6.3) + winrm-elevated (1.2.3) + erubi (~> 1.8) + winrm (~> 2.0) + winrm-fs (~> 1.0) + winrm-fs (1.3.5) + erubi (~> 1.8) + logging (>= 1.6.1, < 3.0) + rubyzip (~> 2.0) + winrm (~> 2.0) + wisper (2.0.1) + wmi-lite (1.0.7) PLATFORMS arm64-darwin-21 ruby universal-darwin-20 + x86_64-darwin-18 x86_64-darwin-19 + x86_64-darwin-20 x86_64-linux DEPENDENCIES bundler - chef-zero (~> 13.1) chefspec fauxhai (~> 6.0.0) ffi (>= 1.15.2) diff --git a/bootstrap-scripts/bootstrap.sh b/bootstrap-scripts/bootstrap.sh index cd3c652d..722a2588 100755 --- a/bootstrap-scripts/bootstrap.sh +++ b/bootstrap-scripts/bootstrap.sh @@ -9,7 +9,7 @@ # ./bootstrap.sh # # http://github.com/LyraPhase/sprout-wrap -# Copyright (C) © 🄯 2013-2021 James Cuzella +# Copyright (C) © 🄯 2013-2024 James Cuzella # This script may be freely distributed under the MIT license. ## Figure out OSX version (source: https://www.opscode.com/chef/install.sh) @@ -121,9 +121,11 @@ prevent_sudo_timeout() { } # Kill sudo timestamp refresh PID and invalidate sudo timestamp +# Don't warn about unreachable commands in this function (triggered by trap) +# shellcheck disable=SC2317 kill_timeout_loop() { echo "Killing $timeout_loop_PID due to trap" - kill -TERM $timeout_loop_PID + kill -TERM "$timeout_loop_PID" sudo -K } trap kill_timeout_loop EXIT HUP TSTP QUIT SEGV TERM INT ABRT # trap all common terminate signals @@ -170,6 +172,7 @@ function check_sprout_locked_ruby_versions() { function rvm_set_compile_opts() { turn_trace_on_if_was_on + local opt_dir rvm_patch_args # Disable installing RI docs for speed cat > "${HOME}/.gemrc" <<-EOF @@ -177,26 +180,132 @@ function rvm_set_compile_opts() { update: --no-document EOF + if [[ "$RVM_ENABLE_YJIT" == "1" ]]; then + CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-yjit" + rustup default "stable-${machine}-apple-darwin" + fi + if [[ "$RVM_WITH_JEMALLOC" == "1" ]]; then + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-jemalloc" + PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/jemalloc/lib/pkgconfig:${PKG_CONFIG_PATH}" + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-jemalloc-dir=$(pkg-config --variable=prefix jemalloc)" + fi + if [[ "$RVM_COMPILE_OPTS_OPENSSL3" == "1" ]]; then + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-openssl-dir=$(brew --prefix openssl@3)" + fi if [[ "$RVM_COMPILE_OPTS_M1_LIBFFI" == "1" ]]; then - export optflags="-Wno-error=implicit-function-declaration" - export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/libffi/lib" - export DLDFLAGS="-L${HOMEBREW_PREFIX}/opt/libffi/lib" - export CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/libffi/include" - export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/libffi/lib/pkgconfig" + optflags="-Wno-error=implicit-function-declaration" + LDFLAGS="-L${HOMEBREW_PREFIX}/opt/libffi/lib" + DLDFLAGS="-L${HOMEBREW_PREFIX}/opt/libffi/lib" + CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/libffi/include" + PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/libffi/lib/pkgconfig:${PKG_CONFIG_PATH}" # Escape from current Gemfile.lock bundler version restriction for bootstrap # NOTE: This could cause problems in the future, b/c # we depend on system bundler to write ~/.bundle/config here # Let's hope they don't break config file API version - bash -c 'cd /tmp/ && bundle config build.ffi --enable-system-libffi' + bash -c "cd /tmp/ && bundle config build.ffi -- --with-libffi-dir=$(pkg-config --variable=prefix libffi )" fi - if [[ "$RVM_COMPILE_OPTS_M1_NOKOGIRI" == "1" ]]; then + if [[ "$RVM_COMPILE_OPTS_M1_NOKOGIRI" == "1" && "$machine" == "arm64" ]]; then bash -c 'cd /tmp/ && bundle config build.nokogiri --platform=ruby -- --use-system-libraries' + elif [[ "$RVM_COMPILE_OPTS_NOKOGIRI_DEPS" == "1" ]]; then + PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/libxslt/lib/pkgconfig:${HOMEBREW_PREFIX}/opt/libxml2/lib/pkgconfig:${HOMEBREW_PREFIX}/opt/zlib/lib/pkgconfig:${PKG_CONFIG_PATH}" + local nokogiri_dep_configure_flags=( + "--with-xslt-dir=$(pkg-config --variable=prefix libxslt )" + "--with-iconv-dir=$(brew --prefix libiconv )" + "--with-xml2-dir=$(pkg-config --variable=prefix libxml-2.0 )" + "--with-zlib-dir=$(pkg-config --variable=prefix zlib )" + ) + # Run in forked subshell to avoid sprout-wrap's project Gemfile.lock context + ( + cd /tmp/ && bundle config build.nokogiri --platform=ruby -- "${nokogiri_dep_configure_flags[@]}" + ) + fi + + if [[ "$RVM_COMPILE_OPTS_READLINE" ]]; then + PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/readline/lib/pkgconfig:${PKG_CONFIG_PATH}" + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-readline-dir=$(pkg-config --variable=prefix readline)" + opt_dir="$(pkg-config --variable=prefix readline):${opt_dir}" + fi + + if [[ "$RVM_COMPILE_OPTS_NCURSES" ]]; then + PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/ncurses/lib/pkgconfig:${PKG_CONFIG_PATH}" + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-ncurses-dir=$(pkg-config --variable=prefix ncurses)" + fi + + if [[ "$RVM_COMPILE_OPTS_LIBYAML" ]]; then + PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/libyaml/lib/pkgconfig:${PKG_CONFIG_PATH}" + # Note: The pkg-config .pc file is named: yaml-0.1.pc + # This may be a Homebrew packaging error, so if it changes, we could switch to using: brew --prefix libyaml + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-libyaml-dir=$(pkg-config --variable=prefix yaml-0.1)" + opt_dir="$(pkg-config --variable=prefix yaml-0.1):${opt_dir}" + fi + if [[ "$RVM_COMPILE_OPTS_LIBKSBA" ]]; then + PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/libksba/lib/pkgconfig:${PKG_CONFIG_PATH}" + # Note: This pkg-config .pc file is named: ksba.pc + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-libksba-dir=$(pkg-config --variable=prefix ksba)" + fi + # Optional Ruby Std-lib dependency + # See: https://ruby-doc.org/stdlib-1.9.3/libdoc/gdbm/rdoc/GDBM.html + if [[ "$RVM_COMPILE_OPTS_GDBM" ]]; then + opt_dir="$(brew --prefix gdbm):${opt_dir}" + fi + + if [[ "$RVM_COMPILE_OPTS_PATCH_AUTOCONF_FUNC_NAME_STRING" == "1" ]]; then + rvm_patch_args="--patch ${REPO_BASE}/bootstrap-scripts/patches/ruby-3.1.2-configure.ac.patch" + fi + + if [ -n "$opt_dir" ]; then + CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-opt-dir=${opt_dir}" fi + + if [ -n "$CONFIGURE_ARGS" ]; then + CONFIGURE_ARGS="${rvm_patch_args} -C ${CONFIGURE_ARGS}" + fi + + for _var in PKG_CONFIG_PATH CONFIGURE_ARGS LDFLAGS DLDFLAGS CPPFLAGS optflags ; do + [ -n "$(eval echo -n \$$_var)" ] && export ${_var?} + done + turn_trace_off } function brew_install_rvm_libs() { + # Refer to Ruby dependency list from ruby-install to keep this updated + # https://github.com/postmodern/ruby-install/blob/master/share/ruby-install/ruby/dependencies.txt#L5 + if [[ "$RVM_ENABLE_YJIT" == "1" ]]; then + grep -q 'rust' Brewfile || echo "brew 'rust'" >> Brewfile + grep -q 'rustup-init' Brewfile || echo "brew 'rustup-init'" >> Brewfile + fi + if [[ "$RVM_WITH_JEMALLOC" == "1" ]]; then + grep -q 'jemalloc' Brewfile || echo "brew 'jemalloc'" >> Brewfile + fi + # Note: Beware of CVE-2024-3094 + # Cannot lock version due to https://github.com/Homebrew/homebrew-bundle/issues/547#issuecomment-525443604 + # So, we must rely on the Homebrew community to not push the new versions until it's been vetted + if [[ "$BREW_INSTALL_XZ" == "1" ]]; then + grep -q 'xz' Brewfile || echo "brew 'xz'" >> Brewfile + fi + if [[ "$BREW_INSTALL_BISON" == "1" ]]; then + grep -q 'bison' Brewfile || echo "brew 'bison'" >> Brewfile + fi + if [[ "$BREW_INSTALL_GDBM" == "1" ]]; then + grep -q 'gdbm' Brewfile || echo "brew 'gdbm'" >> Brewfile + fi + if [[ "$BREW_INSTALL_OPENSSL3" == "1" ]]; then + grep -q 'openssl@3' Brewfile || echo "brew 'openssl@3'" >> Brewfile + fi + if [[ "$BREW_INSTALL_READLINE" == "1" ]]; then + grep -q 'readline' Brewfile || echo "brew 'readline'" >> Brewfile + fi + if [[ "$BREW_INSTALL_NCURSES" == "1" ]]; then + grep -q 'ncurses' Brewfile || echo "brew 'ncurses'" >> Brewfile + fi + if [[ "$BREW_INSTALL_LIBYAML" == "1" ]]; then + grep -q 'libyaml' Brewfile || echo "brew 'libyaml'" >> Brewfile + fi + if [[ "$BREW_INSTALL_LIBKSBA" == "1" ]]; then + grep -q 'libksba' Brewfile || echo "brew 'libksba'" >> Brewfile + fi if [[ "$CI" != 'true' ]]; then if [[ "$BREW_INSTALL_LIBFFI" == "1" ]]; then grep -q 'libffi' Brewfile || echo "brew 'libffi'" >> Brewfile @@ -205,19 +314,36 @@ function brew_install_rvm_libs() { grep -q 'libxml2' Brewfile || echo "brew 'libxml2'" >> Brewfile grep -q 'libxslt' Brewfile || echo "brew 'libxslt'" >> Brewfile grep -q 'libiconv' Brewfile || echo "brew 'libiconv'" >> Brewfile + grep -q 'zlib' Brewfile || echo "brew 'zlib'" >> Brewfile fi fi } +# Use rvm as a function within each subshell +# This is necessary to do per-subshell because it overrides built-in commands +# like `cd`, and the rvm __zsh_like_cd() function triggers our traps via EXIT +function source_rvm() { + if ! type rvm 2>&1 | grep -q 'rvm is a function' ; then + # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. + export PATH="$PATH:$HOME/.rvm/bin" + + [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* + fi +} + function rvm_install_ruby_and_gemset() { check_sprout_locked_ruby_versions rvm_set_compile_opts - - rvm install "ruby-${sprout_ruby_version}" - rvm use "ruby-${sprout_ruby_version}" - rvm gemset create "$sprout_ruby_gemset" - rvm use "ruby-${sprout_ruby_version}"@"${sprout_ruby_gemset}" + # N.B.: Use a subshell for rvm functions, so that our kill_timeout_loop is not inherited + ( + source_rvm + # shellcheck disable=SC2086 + rvm install "ruby-${sprout_ruby_version}" ${CONFIGURE_ARGS} + rvm use "ruby-${sprout_ruby_version}" + rvm gemset create "$sprout_ruby_gemset" + rvm use "ruby-${sprout_ruby_version}"@"${sprout_ruby_gemset}" + ) } # shellcheck disable=SC1010 @@ -226,11 +352,17 @@ function rvm_install_bundler() { # Install bundler + rubygems in RVM path echo "rvm ${sprout_ruby_version} do gem update --system ${sprout_rubygems_ver}" - rvm "${sprout_ruby_version}" do gem update --system "${sprout_rubygems_ver}" + ( + source_rvm + rvm "${sprout_ruby_version}" do gem update --system "${sprout_rubygems_ver}" + ) # Install same version of bundler as Gemfile.lock echo "rvm ${sprout_ruby_version} do gem install --default bundler:${sprout_bundler_ver}" - rvm "${sprout_ruby_version}" do gem install --default "bundler:${sprout_bundler_ver}" + ( + source_rvm + rvm "${sprout_ruby_version}" do gem install --default "bundler:${sprout_bundler_ver}" + ) } # shellcheck disable=SC1010 @@ -240,11 +372,17 @@ function rvm_debug_gems() { type rvm | head -1 command -v ruby command -v bundler - rvm info + ( + source_rvm + rvm info + ) echo "GEMS IN SHELL ENV:" gem list echo "GEMS IN ${sprout_ruby_version}@${sprout_ruby_gemset}:" - rvm "${sprout_ruby_version}"@"${sprout_ruby_gemset}" do gem list + ( + source_rvm + rvm "${sprout_ruby_version}"@"${sprout_ruby_gemset}" do gem list + ) echo "======= DEBUG ============" fi } @@ -287,7 +425,16 @@ detect_platform_version # https://developer.apple.com/downloads/index.action case $platform_version in 12.*) - XCODE_DMG='Xcode_13.3.xip'; export TRY_XCI_OSASCRIPT_FIRST=1; BREW_INSTALL_LIBFFI=1; RVM_COMPILE_OPTS_M1_LIBFFI=1 ; + XCODE_DMG='Xcode_14.3.1.xip'; export TRY_XCI_OSASCRIPT_FIRST=1; BREW_INSTALL_LIBFFI=1; RVM_COMPILE_OPTS_M1_LIBFFI=1; + BREW_INSTALL_OPENSSL3=1 ; RVM_COMPILE_OPTS_OPENSSL3=1 ; + RVM_ENABLE_YJIT=1 ; RVM_WITH_JEMALLOC=1 ; + BREW_INSTALL_READLINE=1 ; RVM_COMPILE_OPTS_READLINE=1 ; + BREW_INSTALL_NCURSES=1 ; RVM_COMPILE_OPTS_NCURSES=1 ; + BREW_INSTALL_LIBYAML=1 ; RVM_COMPILE_OPTS_LIBYAML=1 ; + BREW_INSTALL_LIBKSBA=1 ; RVM_COMPILE_OPTS_LIBKSBA=1 ; + BREW_INSTALL_XZ=1 ; BREW_INSTALL_GDBM=1 ; RVM_COMPILE_OPTS_GDBM=1 ; + RVM_COMPILE_OPTS_PATCH_AUTOCONF_FUNC_NAME_STRING=1 ; + RVM_COMPILE_OPTS_NOKOGIRI_DEPS=1 ; BYPASS_APPLE_TCC="1"; BREW_INSTALL_NOKOGIRI_LIBS="1" ; RVM_COMPILE_OPTS_M1_NOKOGIRI=1 ;; 11.6*) XCODE_DMG='Xcode_13.1.xip'; export TRY_XCI_OSASCRIPT_FIRST=1; export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ; BYPASS_APPLE_TCC="1" ;; @@ -381,7 +528,10 @@ if [[ "$TRY_XCI_OSASCRIPT_FIRST" == '1' ]]; then # Source: https://web.archive.org/web/20211210020829/https://techviewleo.com/install-xcode-command-line-tools-macos/ if [ ! -d /Library/Developer/CommandLineTools ]; then xcode-select --install - sleep 1 + # Wait for CLT Installer App starts & grab PID + while ! clt_pid=$(pgrep -f 'Install Command Line Developer Tools.app' 2>/dev/null | head -n1) ; do + sleep 1 + done osascript <<-EOD tell application "System Events" tell process "Install Command Line Developer Tools" @@ -390,6 +540,9 @@ if [[ "$TRY_XCI_OSASCRIPT_FIRST" == '1' ]]; then end tell end tell EOD + # Wait for CLT to be fully installed before continuing + # wait for non-child PID (Darwin) + lsof -p "$clt_pid" +r 1 &>/dev/null else echo "INFO: Found /Library/Developer/CommandLineTools already existing. skipping..." fi @@ -473,8 +626,8 @@ if [ "$machine" == "arm64" ]; then export HOMEBREW_PREFIX=/opt/homebrew export PATH="/opt/homebrew/bin:${PATH}" else - export HOMEBREW_PREFIX=/usr/local/homebrew - export PATH="/usr/local/homebrew/bin:${PATH}" + export HOMEBREW_PREFIX=/usr/local + export PATH="/usr/local/bin:${PATH}" fi brew_install_rvm_libs @@ -515,13 +668,6 @@ elif [[ "$CI" != 'true' ]]; then check_trace_state turn_trace_off - if ! type rvm 2>&1 | grep -q 'rvm is a function' ; then - # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. - export PATH="$PATH:$HOME/.rvm/bin" - - [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* - fi - # Install .ruby-version @ .ruby-gemset rvm_install_ruby_and_gemset diff --git a/bootstrap-scripts/patches/ruby-3.1.2-configure.ac.patch b/bootstrap-scripts/patches/ruby-3.1.2-configure.ac.patch new file mode 100644 index 00000000..aac91f2b --- /dev/null +++ b/bootstrap-scripts/patches/ruby-3.1.2-configure.ac.patch @@ -0,0 +1,11 @@ +--- a/configure.ac 2022-04-12 05:11:15.000000000 -0600 ++++ b/configure.ac 2024-07-15 22:24:27.000000000 -0600 +@@ -1685,6 +1685,8 @@ + rb_cv_function_name_string, + [AS_CASE(["$target_os"],[openbsd*],[ + rb_cv_function_name_string=__func__ ++ ],[*darwin*],[ ++ rb_cv_function_name_string=__func__ + ],[ + rb_cv_function_name_string=no + RUBY_WERROR_FLAG([ diff --git a/soloistrc.E0000001104.yml b/soloistrc.E0000001104.yml index 3f787d21..7191f305 100644 --- a/soloistrc.E0000001104.yml +++ b/soloistrc.E0000001104.yml @@ -370,6 +370,7 @@ node_attributes: vim_alias_vi_to_minimal_vim: false versions: rvm: 1.26.11 + bash_it: master rvm: user_installs: - user: jcuzella diff --git a/soloistrc.lyra.yml b/soloistrc.lyra.yml index 5a8db3ad..f8c0dcce 100644 --- a/soloistrc.lyra.yml +++ b/soloistrc.lyra.yml @@ -198,6 +198,7 @@ node_attributes: - jlhonora/lsusb - homebrew/cask-drivers - chef/homebrew-chef + - colindean/fund formulas: - bash-completion # - ctags-exuberant @@ -278,7 +279,7 @@ node_attributes: - audio-hijack - loopback - keyfinder - - blackhole + - blackhole-16ch - elektron-overbridge - elektron-transfer - paulxstretch