ruby: rubygems 2.7.7 -> 3.0.3

I think it makes more sense to keep the patches in-tree than on
zimbatm's RubyGems fork.
This commit is contained in:
Alyssa Ross 2019-04-28 16:36:16 +00:00
parent bb4fef1499
commit 0ffedefb15
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0
5 changed files with 94 additions and 7 deletions

View File

@ -11,7 +11,7 @@ let
opString = lib.optionalString;
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
config = import ./config.nix { inherit fetchFromSavannah; };
rubygems = import ./rubygems.nix { inherit stdenv lib fetchurl fetchpatch; };
rubygems = import ./rubygems { inherit stdenv lib fetchurl fetchpatch; };
# Contains the ruby version heuristics
rubyVersion = import ./ruby-version.nix { inherit lib; };

View File

@ -0,0 +1,34 @@
From a6485cfcdf51ff8be452980f93cebfea97f34dec Mon Sep 17 00:00:00 2001
From: zimbatm <zimbatm@zimbatm.com>
Date: Wed, 21 Sep 2016 09:32:34 +0100
Subject: [PATCH 1/3] add post-extract hook
Allows nix to execute scripts just after the gem extraction
---
lib/rubygems/installer.rb | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index d26b1e88..bf18fb7f 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -848,7 +848,15 @@ TEXT
# Ensures that files can't be installed outside the gem directory.
def extract_files
- @package.extract_files gem_dir
+ ret = @package.extract_files gem_dir
+ if ENV['NIX_POST_EXTRACT_FILES_HOOK']
+ puts
+ puts "running NIX_POST_EXTRACT_FILES_HOOK #{ENV['NIX_POST_EXTRACT_FILES_HOOK']} #{gem_dir}"
+ system(ENV['NIX_POST_EXTRACT_FILES_HOOK'], gem_dir.to_s)
+ puts "running NIX_POST_EXTRACT_FILES_HOOK done"
+ puts
+ end
+ ret
end
##
--
2.21.0

View File

@ -0,0 +1,28 @@
From 2e1328bcdddd35e557eabdff83ac07f3591dc693 Mon Sep 17 00:00:00 2001
From: zimbatm <zimbatm@zimbatm.com>
Date: Wed, 21 Sep 2016 19:37:05 +0100
Subject: [PATCH 2/3] binaries with env shebang
By default, don't point to the absolute ruby derivation path. As a user
installing a gem in the home, it would freeze the selected ruby version
to the currently-installed ruby derivation.
---
lib/rubygems/dependency_installer.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index 34620860..00ab31d9 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -18,7 +18,7 @@ class Gem::DependencyInstaller
extend Gem::Deprecate
DEFAULT_OPTIONS = { # :nodoc:
- :env_shebang => false,
+ :env_shebang => true,
:document => %w[ri],
:domain => :both, # HACK dup
:force => false,
--
2.21.0

View File

@ -0,0 +1,26 @@
From d69249d0ff210316121b44d971ddd2439b1bc393 Mon Sep 17 00:00:00 2001
From: zimbatm <zimbatm@zimbatm.com>
Date: Wed, 21 Sep 2016 09:40:39 +0100
Subject: [PATCH 3/3] gem install default to user
Default to not installing gems to the read-only system derivation.
---
lib/rubygems/path_support.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb
index ed680d65..749b9ea6 100644
--- a/lib/rubygems/path_support.rb
+++ b/lib/rubygems/path_support.rb
@@ -23,7 +23,7 @@ class Gem::PathSupport
# hashtable, or defaults to ENV, the system environment.
#
def initialize(env)
- @home = env["GEM_HOME"] || Gem.default_dir
+ @home = env["GEM_HOME"] || Gem.user_dir
if File::ALT_SEPARATOR
@home = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
--
2.21.0

View File

@ -2,18 +2,17 @@
stdenv.mkDerivation rec {
name = "rubygems";
version = "2.7.7";
version = "3.0.3";
src = fetchurl {
url = "https://rubygems.org/rubygems/rubygems-${version}.tgz";
sha256 = "1jsmmd31j8j066b83lin4bbqz19jhrirarzb41f3sjhfdjiwkcjc";
sha256 = "0b6b9ads8522804xv8b8498gqwsv4qawv13f81kyc7g966y7lfmy";
};
patches = [
(fetchpatch {
url = "https://github.com/zimbatm/rubygems/compare/v2.6.6...v2.6.6-nix.patch";
sha256 = "0297rdb1m6v75q8665ry9id1s74p9305dv32l95ssf198liaihhd";
})
./0001-add-post-extract-hook.patch
./0002-binaries-with-env-shebang.patch
./0003-gem-install-default-to-user.patch
];
installPhase = ''