python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / interpreters / ruby / rbinstall-new-rubygems-compat.patch
blob54ce8a357a86ad6ea852c5796a7f909c462a46cc
1 From 8e85d27f9ccfe152fc1b891c19f125915a907493 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
3 Date: Tue, 1 Oct 2019 12:03:33 +0200
4 Subject: [PATCH] Use `Gem::Package` like object instead of monkey patching.
6 1. This is similar to what RubyGems does and it is less magic [[1]].
7 2. It avoids deprecated code paths in RubyGems [[2]].
9 [1]: https://github.com/rubygems/rubygems/blob/92892bbc3adba86a90756c385433835f6761b8da/lib/rubygems/installer.rb#L151
10 [2]: https://github.com/rubygems/rubygems/blob/92892bbc3adba86a90756c385433835f6761b8da/lib/rubygems/installer.rb#L187
12 (cherry picked from commit e960ef6f18a25c637c54f00c75bb6c24f8ab55d0)
13 ---
14 tool/rbinstall.rb | 47 +++++++++++++++++++++++++++--------------------
15 1 file changed, 27 insertions(+), 20 deletions(-)
17 diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
18 index 060390626f..28ae8c409a 100755
19 --- a/tool/rbinstall.rb
20 +++ b/tool/rbinstall.rb
21 @@ -710,28 +710,34 @@ def remove_prefix(prefix, string)
22 end
23 end
25 - class UnpackedInstaller < Gem::Installer
26 - module DirPackage
27 - def extract_files(destination_dir, pattern = "*")
28 - path = File.dirname(@gem.path)
29 - return if path == destination_dir
30 - File.chmod(0700, destination_dir)
31 - mode = pattern == "bin/*" ? $script_mode : $data_mode
32 - spec.files.each do |f|
33 - src = File.join(path, f)
34 - dest = File.join(without_destdir(destination_dir), f)
35 - makedirs(dest[/.*(?=\/)/m])
36 - install src, dest, :mode => mode
37 - end
38 - File.chmod($dir_mode, destination_dir)
39 + class DirPackage
40 + attr_reader :spec
42 + attr_accessor :dir_mode
43 + attr_accessor :prog_mode
44 + attr_accessor :data_mode
46 + def initialize(spec)
47 + @spec = spec
48 + @src_dir = File.dirname(@spec.loaded_from)
49 + end
51 + def extract_files(destination_dir, pattern = "*")
52 + path = @src_dir
53 + return if path == destination_dir
54 + File.chmod(0700, destination_dir)
55 + mode = pattern == "bin/*" ? $script_mode : $data_mode
56 + spec.files.each do |f|
57 + src = File.join(path, f)
58 + dest = File.join(without_destdir(destination_dir), f)
59 + makedirs(dest[/.*(?=\/)/m])
60 + install src, dest, :mode => mode
61 end
62 + File.chmod($dir_mode, destination_dir)
63 end
64 + end
66 - def initialize(spec, *options)
67 - super(spec.loaded_from, *options)
68 - @package.extend(DirPackage).spec = spec
69 - end
71 + class UnpackedInstaller < Gem::Installer
72 def write_cache_file
73 end
75 @@ -890,7 +896,8 @@ def install_default_gem(dir, srcdir)
76 if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
77 spec.extensions[0] ||= "-"
78 end
79 - ins = RbInstall::UnpackedInstaller.new(spec, options)
80 + package = RbInstall::DirPackage.new spec
81 + ins = RbInstall::UnpackedInstaller.new(package, options)
82 puts "#{INDENT}#{spec.name} #{spec.version}"
83 ins.install
84 File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
85 --
86 2.35.1