Use proper path for plugin wrappers.

This commit is contained in:
Vít Ondruch 2021-01-27 14:00:39 +01:00
parent b7229da165
commit 35f28c9a68
2 changed files with 52 additions and 0 deletions

View File

@ -153,6 +153,9 @@ Patch10: ruby-3.0.0-Fixed-dangling-imemo_tmpbuf.patch
# https://bugs.ruby-lang.org/issues/17536 # https://bugs.ruby-lang.org/issues/17536
# https://github.com/ruby/ruby/pull/4077 # https://github.com/ruby/ruby/pull/4077
Patch11: ruby-3.0.0-Dont-try-to-clear-cache-on-garbage-objects.patch Patch11: ruby-3.0.0-Dont-try-to-clear-cache-on-garbage-objects.patch
# Use proper path for plugin wrappers.
# https://github.com/rubygems/rubygems/pull/4317
Patch12: rubygems-3.2.7-Generate-plugin-wrappers-with-relative-requires.patch
# Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. # Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add.
# https://bugs.ruby-lang.org/issues/16492 # https://bugs.ruby-lang.org/issues/16492
Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch
@ -603,6 +606,7 @@ rm -rf ext/fiddle/libffi*
%patch9 -p1 %patch9 -p1
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1
%patch19 -p1 %patch19 -p1
# Provide an example of usage of the tapset: # Provide an example of usage of the tapset:
@ -1373,6 +1377,7 @@ MSPECOPTS="$MSPECOPTS -P 'raises TypeError if one of the passed exceptions is no
%changelog %changelog
* Mon Jan 25 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.0-145 * Mon Jan 25 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.0-145
- Bundle OpenSSL into StdLib. - Bundle OpenSSL into StdLib.
- Use proper path for plugin wrappers.
* Sat Jan 16 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.0-144 * Sat Jan 16 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.0-144
- Fix SEGFAULT in rubygem-shoulda-matchers test suite. - Fix SEGFAULT in rubygem-shoulda-matchers test suite.

View File

@ -0,0 +1,47 @@
From db4157e9aa7b7f720ee06fb866b53ad11879c016 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@riseup.net>
Date: Mon, 25 Jan 2021 15:40:26 +0100
Subject: [PATCH] Generate plugin wrappers with relative requires
It shouldn't change behaviour and it fixes broken wrappers generated
with `--build-root` flag is used.
---
lib/rubygems/installer_uninstaller_utils.rb | 7 ++++++-
test/rubygems/test_gem_installer.rb | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/rubygems/installer_uninstaller_utils.rb b/lib/rubygems/installer_uninstaller_utils.rb
index e81ed4cba38..2c8b7c635e1 100644
--- a/lib/rubygems/installer_uninstaller_utils.rb
+++ b/lib/rubygems/installer_uninstaller_utils.rb
@@ -6,11 +6,16 @@
module Gem::InstallerUninstallerUtils
def regenerate_plugins_for(spec, plugins_dir)
+ plugins = spec.plugins
+ return if plugins.empty?
+
+ require 'pathname'
+
spec.plugins.each do |plugin|
plugin_script_path = File.join plugins_dir, "#{spec.name}_plugin#{File.extname(plugin)}"
File.open plugin_script_path, 'wb' do |file|
- file.puts "require '#{plugin}'"
+ file.puts "require_relative '#{Pathname.new(plugin).relative_path_from(Pathname.new(plugins_dir))}'"
end
verbose plugin_script_path
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 4ce7e92442a..5652d863316 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -821,6 +821,8 @@ def test_generate_plugins_with_build_root
assert !File.exist?(system_path), 'plugin written incorrect written to system plugins_dir'
assert File.exist?(build_root_path), 'plugin not written to build_root'
+
+ refute_includes File.read(build_root_path), build_root
end
def test_keeps_plugins_up_to_date