Skip to content

Commit

Permalink
Update rubygems patch for ruby 3.2.4
Browse files Browse the repository at this point in the history
Previously, our rubygems patch wasn't being applied when cross compiling using
ruby 3.2.4 as the "base" ruby because builder.rb changed:

    - cmd = Gem.ruby.shellsplit
    + cmd = Shellwords.split(Gem.ruby)

Update our patch to match. Also raise if pl-ruby/homebrew version is newer than
3.2.4, so we know to update patch.
  • Loading branch information
joshcooper committed May 8, 2024
1 parent 2033fe6 commit 0cb9b7a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions configs/components/pl-ruby-patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@
end

# make rubygems use our target rbconfig when installing gems
case File.basename(base_ruby)
when '2.0.0', '2.1.0'
base_version = Gem::Version.new(File.basename(base_ruby))
if base_version <= Gem::Version.new('2.1.0')
sed_command = %(s|Gem.ruby|&, '-r/opt/puppetlabs/puppet/share/doc/rbconfig-#{settings[:ruby_version]}-orig.rb'|)
else
elsif base_version <= Gem::Version.new('3.2.2')
sed_command = %(s|Shellwords.split(Gem.ruby)|& << '-r/opt/puppetlabs/puppet/share/doc/rbconfig-#{settings[:ruby_version]}-orig.rb'|)
elsif base_version <= Gem::Version.new('3.2.4')
sed_command = %(s|Gem.ruby.shellsplit|& << '-r/opt/puppetlabs/puppet/share/doc/rbconfig-#{settings[:ruby_version]}-orig.rb'|)
else
raise "pl-ruby-patch does not support ruby #{base_version} yet"
end

# rubygems switched which file has the command we need to patch starting in rubygems 3.4.10, which we install in our formula
Expand Down

0 comments on commit 0cb9b7a

Please sign in to comment.