2022-11-02 23:38:19 +03:00
|
|
|
|
distributable:
|
|
|
|
|
url: https://github.com/rubygems/rubygems/archive/refs/tags/v{{version}}.tar.gz
|
|
|
|
|
strip-components: 1
|
|
|
|
|
|
|
|
|
|
versions:
|
|
|
|
|
github: rubygems/rubygems
|
|
|
|
|
|
|
|
|
|
dependencies:
|
|
|
|
|
ruby-lang.org: '>=2.3'
|
|
|
|
|
|
2023-06-16 16:33:37 +03:00
|
|
|
|
runtime:
|
|
|
|
|
env:
|
2023-12-27 11:06:43 +03:00
|
|
|
|
RUBYLIB: ${{prefix}}/lib:$RUBYLIB
|
2023-06-16 16:33:37 +03:00
|
|
|
|
|
2022-11-02 23:38:19 +03:00
|
|
|
|
build:
|
2023-02-17 15:41:07 +03:00
|
|
|
|
dependencies:
|
2024-04-11 19:25:59 +03:00
|
|
|
|
ruby-lang.org:
|
|
|
|
|
~3.1 # testing a theory
|
|
|
|
|
# NOTE ^^ we don’t know what this comment means either!
|
2023-06-13 22:31:03 +03:00
|
|
|
|
script:
|
2023-06-16 16:33:37 +03:00
|
|
|
|
- ruby setup.rb
|
2024-04-11 19:25:59 +03:00
|
|
|
|
--prefix={{prefix}}
|
|
|
|
|
--env-shebang
|
|
|
|
|
--no-ri
|
|
|
|
|
--no-rdoc
|
2023-03-19 15:01:42 +03:00
|
|
|
|
|
2024-01-19 00:39:22 +03:00
|
|
|
|
# 3.5.5 fixed this
|
|
|
|
|
- run: patch -p1 --no-backup-if-mismatch < $PROP
|
|
|
|
|
if: <3.5.5
|
|
|
|
|
working-directory: ${{prefix}}
|
|
|
|
|
prop: |+
|
|
|
|
|
--- a/lib/rubygems/defaults.rb
|
|
|
|
|
+++ b/lib/rubygems/defaults.rb
|
|
|
|
|
@@ -20,13 +20,7 @@ def self.default_sources
|
|
|
|
|
# specified in the environment
|
|
|
|
|
|
|
|
|
|
def self.default_spec_cache_dir
|
|
|
|
|
- default_spec_cache_dir = File.join Gem.user_home, ".gem", "specs"
|
|
|
|
|
-
|
|
|
|
|
- unless File.exist?(default_spec_cache_dir)
|
|
|
|
|
- default_spec_cache_dir = File.join Gem.data_home, "gem", "specs"
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- default_spec_cache_dir
|
|
|
|
|
+ File.join Gem.cache_home, "gem", "specs"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
- run: patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/fit-n-finish.patch
|
|
|
|
|
working-directory: ${{prefix}}
|
|
|
|
|
|
2024-04-11 19:25:59 +03:00
|
|
|
|
# 3.5.7 removed some redunant parens, breaking patching
|
|
|
|
|
- run: patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/fit-n-finish2-pre357.patch
|
|
|
|
|
if: <3.5.7
|
|
|
|
|
working-directory: ${{prefix}}
|
|
|
|
|
- run: patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/fit-n-finish2-post357.patch
|
|
|
|
|
if: '>=3.5.7'
|
|
|
|
|
working-directory: ${{prefix}}
|
|
|
|
|
|
2024-01-19 00:39:22 +03:00
|
|
|
|
# makes ruby’s default system dir be fixed in /usr/local/lib/ruby
|
|
|
|
|
# rather the relative to ~/.pkgx/ruby-lang.org
|
2023-06-16 16:33:37 +03:00
|
|
|
|
- run: |
|
2024-01-19 00:39:22 +03:00
|
|
|
|
patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/default-sys-dir.patch
|
2023-12-29 10:12:30 +03:00
|
|
|
|
sed -i -e 's/Gem.default_dir/Gem.default_system_dir/' lib/rubygems/path_support.rb
|
2023-06-16 16:33:37 +03:00
|
|
|
|
working-directory: ${{prefix}}
|
2023-12-16 01:04:32 +03:00
|
|
|
|
|
2024-01-19 00:39:22 +03:00
|
|
|
|
# removes redudnant `gem` directory that looks gross in our directory formatting
|
2023-12-29 10:12:30 +03:00
|
|
|
|
- run: sed -i -e 's/Gem.state_home, "gem",/Gem.state_home,/' defaults.rb
|
2023-12-16 01:04:32 +03:00
|
|
|
|
working-directory: ${{prefix}}/lib/rubygems
|
2023-11-13 21:44:01 +03:00
|
|
|
|
if: '>=3.4'
|
2023-12-16 01:04:32 +03:00
|
|
|
|
|
2024-01-19 00:39:22 +03:00
|
|
|
|
# ensure `gem` tries to install to ~/.gem if /usr/local is not writable
|
|
|
|
|
- run: patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/user-install-pre3.5.patch
|
2023-12-16 01:04:32 +03:00
|
|
|
|
working-directory: ${{prefix}}
|
|
|
|
|
if: '<3.5'
|
2024-01-19 00:39:22 +03:00
|
|
|
|
- run: patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/user-install-post3.5.patch
|
2023-12-16 01:04:32 +03:00
|
|
|
|
working-directory: ${{prefix}}
|
|
|
|
|
if: '>=3.5'
|
|
|
|
|
|
2024-01-19 00:39:22 +03:00
|
|
|
|
# fixes bug where gem won’t create the full directory path when installing
|
|
|
|
|
# which typically isn’t a problem since the directory already exists in a standard
|
|
|
|
|
# install but we fuck with the paths way more
|
2023-12-29 10:12:30 +03:00
|
|
|
|
- run: sed -i -e
|
2023-12-26 12:51:02 +03:00
|
|
|
|
's/Dir\.mkdir dir, \*\[options\[:dir_mode\].*/FileUtils.mkdir_p dir, *[options[:dir_mode] \&\& 0o755].compact/'
|
|
|
|
|
installer.rb
|
2023-10-19 01:17:28 +03:00
|
|
|
|
working-directory: ${{prefix}}/lib/rubygems
|
2023-02-17 15:41:07 +03:00
|
|
|
|
|
2023-06-16 16:33:37 +03:00
|
|
|
|
# these are provided by ruby-lang.org
|
2023-12-26 12:51:02 +03:00
|
|
|
|
# they turn up here since that is how gem handles deps
|
|
|
|
|
# but ruby is in PATH and has these and that is the preference
|
2023-06-16 16:33:37 +03:00
|
|
|
|
- run: rm rake rbs rdbg typeprof
|
|
|
|
|
working-directory: ${{prefix}}/bin
|
2023-03-19 15:01:42 +03:00
|
|
|
|
|
2023-12-27 11:06:43 +03:00
|
|
|
|
# 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
|
2023-12-26 12:51:02 +03:00
|
|
|
|
# REF https://github.com/pkgxdev/pantry/issues/4010
|
2023-06-16 16:33:37 +03:00
|
|
|
|
- run: |
|
2023-12-26 12:51:02 +03:00
|
|
|
|
for tool in bundle bundler; do
|
2023-12-27 11:06:43 +03:00
|
|
|
|
echo "$(cat $PROP gems/bundler-*/exe/$tool)" > bin/$tool
|
2023-06-13 22:31:03 +03:00
|
|
|
|
done
|
2023-12-27 11:06:43 +03:00
|
|
|
|
echo "$(cat $PROP bin/gem)" > bin/gem
|
2023-12-26 12:51:02 +03:00
|
|
|
|
prop: |
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
d="$(cd "$(dirname "$0")"/.. && pwd)"
|
|
|
|
|
export RUBYLIB="$d/lib"
|
2023-12-27 11:06:43 +03:00
|
|
|
|
if [ -z "$GEM_PATH" ]; then
|
|
|
|
|
export GEM_PATH="$d"
|
|
|
|
|
else
|
|
|
|
|
export GEM_PATH="$d:$GEM_PATH"
|
|
|
|
|
fi
|
|
|
|
|
exec ruby "$0" "$@"
|
2024-04-11 19:25:59 +03:00
|
|
|
|
working-directory: ${{prefix}}
|
2023-12-26 12:51:02 +03:00
|
|
|
|
|
2023-12-27 11:06:43 +03:00
|
|
|
|
# no longer needed
|
|
|
|
|
- rm -rf {{prefix}}/gems
|
|
|
|
|
|
|
|
|
|
# the bundler code figures out the “gem path” for itself by checking for this directory structure
|
|
|
|
|
# for some reason we are not installed in a gem-compatible way and
|
|
|
|
|
# `GEM_PATH` is not used here (but it is later)
|
|
|
|
|
# FIXME this stuff is messy, ideally we’d do much less stuff since it breaks easily with new releases
|
|
|
|
|
- run: ln -s bin exe
|
|
|
|
|
working-directory: ${{prefix}}
|
2023-12-26 12:51:02 +03:00
|
|
|
|
|
|
|
|
|
# clean up empty, unused directory
|
2023-06-13 22:31:03 +03:00
|
|
|
|
- rmdir {{prefix}}/plugins
|
2022-11-02 23:38:19 +03:00
|
|
|
|
|
|
|
|
|
test:
|
2023-02-17 15:41:07 +03:00
|
|
|
|
env:
|
2023-06-13 22:31:03 +03:00
|
|
|
|
vRUBY: ${{deps.ruby-lang.org.version.marketing}}.0
|
2023-06-16 16:33:37 +03:00
|
|
|
|
script:
|
|
|
|
|
# for debug
|
|
|
|
|
- gem env
|
|
|
|
|
|
|
|
|
|
- |
|
|
|
|
|
gem install awesome_print --verbose
|
|
|
|
|
ruby -e 'require "rubygems"' -e 'require "awesome_print"' -e'ap $LOAD_PATH'
|
|
|
|
|
|
|
|
|
|
- |
|
|
|
|
|
gem install hexapdf --verbose
|
|
|
|
|
|
|
|
|
|
if [ -w /usr/local/lib/ruby/ ]; then
|
|
|
|
|
v="$(/usr/local/bin/hexapdf version | cut -d' ' -f2)"
|
|
|
|
|
test -d /usr/local/lib/ruby/gems/$vRUBY/gems/hexapdf-$v
|
|
|
|
|
else
|
|
|
|
|
v="$(~/.local/bin/hexapdf version | cut -d' ' -f2)"
|
|
|
|
|
test -d ~/.gem/ruby/$vRUBY/gems/hexapdf-$v
|
|
|
|
|
fi
|
2022-11-02 23:38:19 +03:00
|
|
|
|
|
2023-12-27 11:06:43 +03:00
|
|
|
|
# test for https://github.com/pkgxdev/pantry/issues/4010
|
2023-12-26 12:51:02 +03:00
|
|
|
|
- run: |
|
|
|
|
|
mv $FIXTURE Gemfile
|
2023-12-29 10:12:30 +03:00
|
|
|
|
GEM_HOME=$HOME/.bundler bundle install --path vendor/bundle
|
2023-12-26 12:51:02 +03:00
|
|
|
|
fixture: |
|
|
|
|
|
source 'https://rubygems.org'
|
|
|
|
|
gem 'warbler', platforms: :jruby
|
|
|
|
|
|
2023-12-27 11:06:43 +03:00
|
|
|
|
# verifies that our bundler can be used as a gem
|
2024-04-11 19:25:59 +03:00
|
|
|
|
- run: rm -rf {{deps.ruby-lang.org.prefix}}/lib/ruby/gems/*/bundler*
|
2023-12-29 10:12:30 +03:00
|
|
|
|
rm -rf {{deps.ruby-lang.org.prefix}}/lib/ruby/gems/*/rubygems*
|
|
|
|
|
GEM_HOME=$HOME/.bundler ruby $FIXTURE
|
2023-12-27 11:06:43 +03:00
|
|
|
|
fixture:
|
|
|
|
|
content: |
|
|
|
|
|
require 'bundler/inline'
|
|
|
|
|
gemfile do
|
|
|
|
|
source 'https://rubygems.org'
|
|
|
|
|
gem 'ruby-macho', '~> 3'
|
|
|
|
|
end
|
|
|
|
|
extname: rb
|
|
|
|
|
|
2022-11-02 23:38:19 +03:00
|
|
|
|
provides:
|
|
|
|
|
- bin/bundle
|
|
|
|
|
- bin/bundler
|
|
|
|
|
- bin/gem
|