Fix ability to use bundle (#4593)

This commit is contained in:
Max Howell 2023-12-26 09:51:02 +00:00 committed by GitHub
parent b5fb5aff59
commit 3fa63bdd37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 24 deletions

View file

@ -18,21 +18,18 @@ build:
ruby-lang.org: ~3.1 # testing a theory ruby-lang.org: ~3.1 # testing a theory
script: script:
- ruby setup.rb - ruby setup.rb
--prefix={{prefix}} --prefix={{prefix}}
--env-shebang --env-shebang
--no-ri --no-ri
--no-rdoc --no-rdoc
- run: cp $SRCROOT/props/proxy .
working-directory: ${{prefix}}/shim
- run: | - run: |
patch -p1 < "$SRCROOT"/props/fit-n-finish.patch patch -p1 < "$SRCROOT"/props/fit-n-finish.patch
patch -p1 < "$SRCROOT"/props/fit-n-finish.2.patch patch -p1 < "$SRCROOT"/props/fit-n-finish.2.patch
sed -i'' -e 's/Gem.default_dir/Gem.default_system_dir/' lib/rubygems/path_support.rb sed -i -e 's/Gem.default_dir/Gem.default_system_dir/' lib/rubygems/path_support.rb
working-directory: ${{prefix}} working-directory: ${{prefix}}
- run: sed -i'' -e 's/Gem.state_home, "gem",/Gem.state_home,/' defaults.rb - run: sed -i -e 's/Gem.state_home, "gem",/Gem.state_home,/' defaults.rb
working-directory: ${{prefix}}/lib/rubygems working-directory: ${{prefix}}/lib/rubygems
if: '>=3.4' if: '>=3.4'
@ -44,30 +41,51 @@ build:
working-directory: ${{prefix}} working-directory: ${{prefix}}
if: '>=3.5' if: '>=3.5'
- run: | - run: sed -i -e
sed -i.bak -e 's/Dir\.mkdir dir, \*\[options\[:dir_mode\].*/FileUtils.mkdir_p dir, *[options[:dir_mode] \&\& 0o755].compact/' installer.rb 's/Dir\.mkdir dir, \*\[options\[:dir_mode\].*/FileUtils.mkdir_p dir, *[options[:dir_mode] \&\& 0o755].compact/'
rm installer.rb.bak installer.rb
working-directory: ${{prefix}}/lib/rubygems working-directory: ${{prefix}}/lib/rubygems
# these are provided by ruby-lang.org # these are provided by ruby-lang.org
# we dont know why they turn up here too… # they turn up here since that is how gem handles deps
# but ruby is in PATH and has these and that is the preference
- run: rm rake rbs rdbg typeprof - run: rm rake rbs rdbg typeprof
working-directory: ${{prefix}}/bin working-directory: ${{prefix}}/bin
# Were not a “GEMHOME” since we *are* gem, so yeah instead # bundle and bundler are “gem” shims that try to invoke rubygems magic
# we have a RUBYLIB hack via our proxy script # to figure out which bundler etc. to run. However this is not what we
# need since we are a specifically packages rubygems version and only
# want to use ourselves.
# REF https://github.com/pkgxdev/pantry/issues/4010
- run: | - run: |
for x in *; do for tool in bundle bundler; do
mv $x ../shim rm $tool
ln -s ../shim/proxy $x cp $PROP $tool
done done
working-directory: ${{prefix}}/bin prop: |
#!/bin/sh
d="$(cd "$(dirname "$0")"/.. && pwd)"
export RUBYLIB="$d/lib"
exec "$d"/gems/bundler-*/exe/bundle "$@"
working-directory:
${{prefix}}/bin
# ruby has a neat feature where it will look for a ruby shebang and
# ignore everything from before that, so we can make scripts that execute
# as POSIX shell and then re-exec themselves as ruby scripts
- run:
echo "$(cat $PROP gem)" > gem
prop: |
#!/bin/sh
RUBYLIB="$(cd "$(dirname "$0")"/../lib && pwd)" exec ruby "$0" "$@"
working-directory:
${{prefix}}/bin
# clean up empty, unused directory
- rmdir {{prefix}}/plugins - rmdir {{prefix}}/plugins
test: test:
env: env:
HOME: $PWD
vRUBY: ${{deps.ruby-lang.org.version.marketing}}.0 vRUBY: ${{deps.ruby-lang.org.version.marketing}}.0
script: script:
# for debug # for debug
@ -88,6 +106,13 @@ test:
test -d ~/.gem/ruby/$vRUBY/gems/hexapdf-$v test -d ~/.gem/ruby/$vRUBY/gems/hexapdf-$v
fi fi
- run: |
mv $FIXTURE Gemfile
bundle install --path vendor/bundle
fixture: |
source 'https://rubygems.org'
gem 'warbler', platforms: :jruby
provides: provides:
- bin/bundle - bin/bundle
- bin/bundler - bin/bundler

View file

@ -1,4 +0,0 @@
#!/bin/sh
d="$(cd "$(dirname "$0")"/.. && pwd)"
export RUBYLIB="$d/lib"
$d/shim/$(basename "$0") "$@"