fix(rubygems)

repair broken patches

closes #5679
closes #5863
This commit is contained in:
Jacob Heider 2024-04-11 12:25:59 -04:00 committed by Jacob Heider
parent 871710ccc1
commit 5c1ae5bbb7
4 changed files with 97 additions and 46 deletions

View file

@ -39,42 +39,6 @@ index b186375..de168c4 100644
parts = [gem_dir, ruby_engine] parts = [gem_dir, ruby_engine]
parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty? parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
File.join parts File.join parts
@@ -111,18 +104,17 @@ def self.user_dir
# The path to standard location of the user's configuration directory.
def self.config_home
- @config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".config"))
+ @config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".gem"))
end
##
# Finds the user's config file
def self.find_config_file
- gemrc = File.join Gem.user_home, ".gemrc"
- if File.exist? gemrc
- gemrc
+ @gemrc = if ENV["XDG_CONFIG_HOME"]
+ File.join ENV["XDG_CONFIG_HOME"], "gemrc"
else
- File.join Gem.config_home, "gem", "gemrc"
+ File.join Gem.user_home, ".gemrc"
end
end
@@ -151,7 +143,11 @@ def self.cache_home
# The path to standard location of the user's data directory.
def self.data_home
- @data_home ||= (ENV["XDG_DATA_HOME"] || File.join(Gem.user_home, ".local", "share"))
+ @data_home ||= if ENV["XDG_DATA_HOME"]
+ File.join(ENV["XDG_DATA_HOME"], "gem")
+ else
+ File.join(Gem.user_home, ".gem")
+ end
end
##
@@ -176,6 +172,7 @@ def self.default_path @@ -176,6 +172,7 @@ def self.default_path
path << user_dir if user_home && File.exist?(user_home) path << user_dir if user_home && File.exist?(user_home)
path << default_dir path << default_dir

View file

@ -0,0 +1,40 @@
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index b186375..de168c4 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -111,18 +111,17 @@
# The path to standard location of the user's configuration directory.
def self.config_home
- @config_home ||= ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".config")
+ @config_home ||= ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".gem")
end
##
# Finds the user's config file
def self.find_config_file
- gemrc = File.join Gem.user_home, ".gemrc"
- if File.exist? gemrc
- gemrc
+ @gemrc = if ENV["XDG_CONFIG_HOME"]
+ File.join ENV["XDG_CONFIG_HOME"], "gemrc"
else
- File.join Gem.config_home, "gem", "gemrc"
+ File.join Gem.user_home, ".gemrc"
end
end
@@ -151,7 +143,11 @@ def self.cache_home
# The path to standard location of the user's data directory.
def self.data_home
- @data_home ||= ENV["XDG_DATA_HOME"] || File.join(Gem.user_home, ".local", "share")
+ @data_home ||= if ENV["XDG_DATA_HOME"]
+ File.join(ENV["XDG_DATA_HOME"], "gem")
+ else
+ File.join(Gem.user_home, ".gem")
+ end
end
##

View file

@ -0,0 +1,40 @@
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index b186375..de168c4 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -111,18 +104,17 @@ def self.user_dir
# The path to standard location of the user's configuration directory.
def self.config_home
- @config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".config"))
+ @config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".gem"))
end
##
# Finds the user's config file
def self.find_config_file
- gemrc = File.join Gem.user_home, ".gemrc"
- if File.exist? gemrc
- gemrc
+ @gemrc = if ENV["XDG_CONFIG_HOME"]
+ File.join ENV["XDG_CONFIG_HOME"], "gemrc"
else
- File.join Gem.config_home, "gem", "gemrc"
+ File.join Gem.user_home, ".gemrc"
end
end
@@ -151,7 +143,11 @@ def self.cache_home
# The path to standard location of the user's data directory.
def self.data_home
- @data_home ||= (ENV["XDG_DATA_HOME"] || File.join(Gem.user_home, ".local", "share"))
+ @data_home ||= if ENV["XDG_DATA_HOME"]
+ File.join(ENV["XDG_DATA_HOME"], "gem")
+ else
+ File.join(Gem.user_home, ".gem")
+ end
end
##

View file

@ -14,14 +14,15 @@ runtime:
build: build:
dependencies: dependencies:
ruby-lang.org: ~3.1 # testing a theory ruby-lang.org:
# NOTE ^^ we dont know what this comment means either! ~3.1 # testing a theory
# NOTE ^^ we dont know what this comment means either!
script: script:
- ruby setup.rb - ruby setup.rb
--prefix={{prefix}} --prefix={{prefix}}
--env-shebang --env-shebang
--no-ri --no-ri
--no-rdoc --no-rdoc
# 3.5.5 fixed this # 3.5.5 fixed this
- run: patch -p1 --no-backup-if-mismatch < $PROP - run: patch -p1 --no-backup-if-mismatch < $PROP
@ -49,6 +50,14 @@ build:
- run: patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/fit-n-finish.patch - run: patch -p1 --no-backup-if-mismatch < "$SRCROOT"/props/fit-n-finish.patch
working-directory: ${{prefix}} working-directory: ${{prefix}}
# 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}}
# makes rubys default system dir be fixed in /usr/local/lib/ruby # makes rubys default system dir be fixed in /usr/local/lib/ruby
# rather the relative to ~/.pkgx/ruby-lang.org # rather the relative to ~/.pkgx/ruby-lang.org
- run: | - run: |
@ -102,8 +111,7 @@ build:
export GEM_PATH="$d:$GEM_PATH" export GEM_PATH="$d:$GEM_PATH"
fi fi
exec ruby "$0" "$@" exec ruby "$0" "$@"
working-directory: working-directory: ${{prefix}}
${{prefix}}
# no longer needed # no longer needed
- rm -rf {{prefix}}/gems - rm -rf {{prefix}}/gems
@ -149,8 +157,7 @@ test:
gem 'warbler', platforms: :jruby gem 'warbler', platforms: :jruby
# verifies that our bundler can be used as a gem # verifies that our bundler can be used as a gem
- run: - run: rm -rf {{deps.ruby-lang.org.prefix}}/lib/ruby/gems/*/bundler*
rm -rf {{deps.ruby-lang.org.prefix}}/lib/ruby/gems/*/bundler*
rm -rf {{deps.ruby-lang.org.prefix}}/lib/ruby/gems/*/rubygems* rm -rf {{deps.ruby-lang.org.prefix}}/lib/ruby/gems/*/rubygems*
GEM_HOME=$HOME/.bundler ruby $FIXTURE GEM_HOME=$HOME/.bundler ruby $FIXTURE
fixture: fixture: