From d70837f2c8177c6aedee0890060d3e30ce6db4ac Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 17 Feb 2023 07:41:07 -0500 Subject: [PATCH] relocatability fixes for ruby and gem (#322) Refs https://github.com/teaxyz/cli/issues/374 --- .DS_Store | Bin 0 -> 6148 bytes projects/ruby-lang.org/mkconfig.rb.diff | 28 ++++ projects/ruby-lang.org/package.yml | 29 +++- projects/rubygems.org/fit-n-finish.patch | 203 +++++++++++++++++++++++ projects/rubygems.org/package.yml | 17 +- 5 files changed, 267 insertions(+), 10 deletions(-) create mode 100644 .DS_Store create mode 100644 projects/ruby-lang.org/mkconfig.rb.diff create mode 100644 projects/rubygems.org/fit-n-finish.patch diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3569ebf461e9e4b57b6a6c0b4ed9027681aafe35 GIT binary patch literal 6148 zcmeHKzi-n(6n>YwjYC1o02QMJj1if3xa`v zgPDn$0r(S;nBZT44T*twKdk!drb7pWs(aGicYgQY-RCdoyBq+J?!?~)r~`nBg`sf{ zt7DAyvr@8(^lTv#HbywycJ}EwE=6jGRzNH8KPte!T?4Me5CX`Q@At~&Rk3eOdp$3t z9{SAlzkeLSmrr-pe*eV&cvRRM-dUIm)qGwU!2~>IcGykI5k(I1^uhhNpE-vkx_NC~{7$8@iYlEHr|{ZnGG0}#QGzQbF0+C+<%lAupMP38rz7JO z8Lf^|_*8714EbcJkc+E{;yTK_SsKfg`oW9CAkCW1ucWeOtZ!7!s<~y}a#ukAlIhU%z;lMwuH#gM=pp{s2RsJ`N(E&bo9G`6 '--no-rdoc --no-ri --env-shebang --user-install', ++ 'update' => '--no-rdoc --no-ri --env-shebang --user-install' ++ } + end + + ## + +diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb +index 9fbb282..8fa8bd9 100644 +--- a/lib/rubygems/installer.rb ++++ b/lib/rubygems/installer.rb +@@ -190,7 +190,7 @@ def initialize(package, options={}) + + if options[:user_install] + @gem_home = Gem.user_dir +- @bin_dir = Gem.bindir gem_home unless options[:bin_dir] ++ @bin_dir = File.join(Gem.user_home, ".local/bin") unless options[:bin_dir] + @plugins_dir = Gem.plugindir(gem_home) + check_that_user_bin_dir_is_in_path + end +@@ -953,7 +953,7 @@ def write_cache_file + + def ensure_writable_dir(dir) # :nodoc: + begin +- Dir.mkdir dir, *[options[:dir_mode] && 0755].compact ++ FileUtils.mkdir_p dir, *[options[:dir_mode] && 0755].compact + rescue SystemCallError + raise unless File.directory? dir + end diff --git a/projects/rubygems.org/package.yml b/projects/rubygems.org/package.yml index 7ec02d87..8f021de9 100644 --- a/projects/rubygems.org/package.yml +++ b/projects/rubygems.org/package.yml @@ -9,18 +9,31 @@ dependencies: ruby-lang.org: '>=2.3' build: + dependencies: + gnu.org/patch: '*' script: | - ruby setup.rb --prefix={{prefix}} --env-shebang + ruby setup.rb --prefix={{prefix}} --env-shebang --no-ri --no-rdoc + cd "{{prefix}}" + patch -p1 < "$SRCROOT"/props/fit-n-finish.patch + +runtime: + env: + # HACK that is only required for this ruby package + # since we cannot use `gem` to build `gem` itself + RUBYLIB: ${{prefix}}/lib test: dependencies: tea.xyz/gx/cc: c99 tea.xyz/gx/make: '*' + env: + HOME: $PWD script: | gem install awesome_print ruby -e 'require "rubygems"' -e 'require "awesome_print"' -e'ap $LOAD_PATH' + #TODO test -d ~/.gem/ruby/{{deps.ruby.version.major}}.{{deps.ruby.version.minor}}.0/gems/hexapdf-0.28.0 gem install hexapdf - hexapdf version + ~/.local/bin/hexapdf version provides: - bin/bundle