Upgrade to Ruby 2.1.0 (r44266).

This commit is contained in:
Vít Ondruch 2013-12-17 16:56:33 +01:00
parent ef80e1fa9d
commit 360d2b99cd
10 changed files with 86 additions and 405 deletions

View File

@ -81,5 +81,15 @@ module Gem
dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}
dirs && File.join(dirs.last[:ext_dir], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
end
# This method should be available since RubyGems 2.2 until RubyGems 3.0.
# https://github.com/rubygems/rubygems/issues/749
if method_defined? :install_extension_in_lib
remove_method :install_extension_in_lib
def install_extension_in_lib
false
end
end
end
end

View File

@ -1,28 +0,0 @@
From 541f3b85cac00e5b836e018ef8afea4342e0cd39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Tue, 9 Jul 2013 12:32:49 +0200
Subject: [PATCH] Make stable Gem::Specification.files in default .gemspecs
Although the .gemspec files for default gems are same in function, the
different order of their "s.files" makes them different therefore
possibly conflicting in multilib scenario.
---
tool/rbinstall.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 0b99408..7b54966 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -608,7 +608,7 @@ module RbInstall
end
def collect
- ruby_libraries + built_libraries
+ (ruby_libraries + built_libraries).sort
end
private
--
1.8.3.1

View File

@ -16,7 +16,7 @@ index 7e8ed82..7916993 100644
@@ -110,6 +110,7 @@ XRUBY_RUBYLIBDIR = @XRUBY_RUBYLIBDIR@
XRUBY_RUBYHDRDIR = @XRUBY_RUBYHDRDIR@
DEFAULT_PRELUDES = $(@USE_RUBYGEMS@_GEM_PRELUDE)
DEFAULT_PRELUDES = $(GEM_PRELUDE)
+OPTIONAL_PRELUDES = @OPTIONAL_PRELUDES@
#### End of system configuration section. ####
@ -32,8 +32,8 @@ index 5cfbc3d..3f0a82e 100644
-PRELUDE_SCRIPTS = $(srcdir)/prelude.rb $(srcdir)/enc/prelude.rb $(DEFAULT_PRELUDES)
+PRELUDE_SCRIPTS = $(srcdir)/prelude.rb $(srcdir)/enc/prelude.rb $(DEFAULT_PRELUDES) $(OPTIONAL_PRELUDES)
GEM_PRELUDE = $(srcdir)/gem_prelude.rb
YES_GEM_PRELUDE = $(GEM_PRELUDE)
NO_GEM_PRELUDE =
PRELUDES = prelude.c miniprelude.c
GOLFPRELUDES = golf_prelude.c
diff --git a/configure.in b/configure.in
index 0e371e2..d4f1dcb 100644
--- a/configure.in

View File

@ -1,4 +1,4 @@
From 35b8c14ddc7f9b38c21c15dfecefa3dff7567981 Mon Sep 17 00:00:00 2001
From 763c6571697b0bd551a8a0c27d538d00f161a9f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 8 Feb 2013 22:48:41 +0100
Subject: [PATCH] Prevent duplicated paths when empty version string is
@ -6,23 +6,23 @@ Subject: [PATCH] Prevent duplicated paths when empty version string is
---
configure.in | 15 +++++++++------
loadpath.c | 4 ++++
2 files changed, 13 insertions(+), 6 deletions(-)
loadpath.c | 12 ++++++++++++
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/configure.in b/configure.in
index 881449e..37d9a62 100644
index 88d24ee..4a300b9 100644
--- a/configure.in
+++ b/configure.in
@@ -3535,8 +3535,6 @@ AC_ARG_WITH(rubylibprefix,
fi
rubylibprefix="$withval"])
AC_SUBST(rubylibprefix)
@@ -3608,8 +3608,6 @@ AC_ARG_WITH(rubylibprefix,
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
])
-rubylibdir='${rubylibprefix}/${ruby_version}'
-rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
AC_ARG_WITH(rubyarchprefix,
@@ -3566,6 +3564,7 @@ AC_ARG_WITH(ruby-version,
@@ -3639,6 +3637,7 @@ AC_ARG_WITH(ruby-version,
[ruby_version=full])
unset RUBY_LIB_VERSION
unset RUBY_LIB_VERSION_STYLE
@ -30,7 +30,7 @@ index 881449e..37d9a62 100644
AS_CASE(["$ruby_version"],
[full], [RUBY_LIB_VERSION_STYLE='3 /* full */'],
[minor], [RUBY_LIB_VERSION_STYLE='2 /* minor */'])
@@ -3582,30 +3581,34 @@ if test ${RUBY_LIB_VERSION_STYLE+set}; then
@@ -3655,30 +3654,34 @@ if test ${RUBY_LIB_VERSION_STYLE+set}; then
ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
eval $ruby_version
elif test -z "${ruby_version}"; then
@ -70,29 +70,44 @@ index 881449e..37d9a62 100644
AC_ARG_WITH(vendorarchdir,
AS_HELP_STRING([--with-vendorarchdir=DIR],
diff --git a/loadpath.c b/loadpath.c
index 9160031..623dc9d 100644
index 9160031..0d4d953 100644
--- a/loadpath.c
+++ b/loadpath.c
@@ -65,7 +65,9 @@ const char ruby_initial_load_paths[] =
@@ -65,22 +65,34 @@ const char ruby_initial_load_paths[] =
RUBY_SEARCH_PATH "\0"
#endif
#ifndef NO_RUBY_SITE_LIB
+#ifndef RUBY_LIB_VERSION_BLANK
+#ifdef RUBY_LIB_VERSION_BLANK
+ RUBY_SITE_LIB "\0"
+#else
RUBY_SITE_LIB2 "\0"
+#endif
#ifdef RUBY_THINARCH
RUBY_SITE_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
#endif
@@ -74,7 +76,9 @@ const char ruby_initial_load_paths[] =
RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
+#ifndef RUBY_LIB_VERSION_BLANK
RUBY_SITE_LIB "\0"
#endif
+#endif
#ifndef NO_RUBY_VENDOR_LIB
+#ifndef RUBY_LIB_VERSION_BLANK
+#ifdef RUBY_LIB_VERSION_BLANK
+ RUBY_VENDOR_LIB "\0"
+#else
RUBY_VENDOR_LIB2 "\0"
+#endif
#ifdef RUBY_THINARCH
RUBY_VENDOR_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
#endif
RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
+#ifndef RUBY_LIB_VERSION_BLANK
RUBY_VENDOR_LIB "\0"
#endif
+#endif
RUBY_LIB "\0"
#ifdef RUBY_THINARCH
--
1.8.3.1
1.8.4.2

View File

@ -39,7 +39,7 @@ index 623dc9d..74c5d9e 100644
--- a/loadpath.c
+++ b/loadpath.c
@@ -86,6 +86,10 @@ const char ruby_initial_load_paths[] =
RUBY_VENDOR_LIB "\0"
#endif
#endif
+#ifdef RUBYGEMS_DIR

View File

@ -1,31 +0,0 @@
From cf26cdec7bcd0668b8f8347a5f29072c8b8f6e8d Mon Sep 17 00:00:00 2001
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Tue, 1 Oct 2013 11:36:47 +0000
Subject: [PATCH] test_config.rb: fix library path
* test/mkmf/test_config.rb (test_dir_config): fix expected library
path. [ruby-core:57535] [Bug #8972]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
test/mkmf/test_config.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/mkmf/test_config.rb b/test/mkmf/test_config.rb
index b09dfd6..4a9be57 100644
--- a/test/mkmf/test_config.rb
+++ b/test/mkmf/test_config.rb
@@ -8,8 +8,9 @@ class TestMkmf < Test::Unit::TestCase
class TestConfig < Test::Unit::TestCase
def test_dir_config
bug8074 = '[Bug #8074]'
+ lib = RbConfig.expand(RbConfig::MAKEFILE_CONFIG["libdir"], "exec_prefix"=>"")
assert_separately %w[-rmkmf - -- --with-foo-dir=/test/foo], %{
- assert_equal(%w[/test/foo/include /test/foo/lib], dir_config("foo"), #{bug8074.dump})
+ assert_equal(%w[/test/foo/include /test/foo#{lib}], dir_config("foo"), #{bug8074.dump})
}
end
end
--
1.8.3.1

View File

@ -10,10 +10,10 @@
%global ruby_release %{ruby_version}
# Specify the named version. It has precedense to revision.
%global milestone preview1
#%%global milestone preview2
# Keep the revision enabled for pre-releases from SVN.
#%%global revision 39387
%global revision 44266
%global ruby_archive %{name}-%{ruby_version}
@ -29,22 +29,23 @@
%global release 16
%{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}
%global rubygems_version 2.2.0.preview.1
%global rubygems_version 2.2.0.rc.1
# The RubyGems library has to stay out of Ruby directory three, since the
# RubyGems should be share by all Ruby implementations.
%global rubygems_dir %{_datadir}/rubygems
%global rake_version 0.9.6
# TODO: The IRB has strange versioning. Keep the Ruby's versioning ATM.
# http://redmine.ruby-lang.org/issues/5313
%global irb_version %{ruby_version_patch_level}
%global rdoc_version 4.1.0.preview.1
%global bigdecimal_version 1.2.1
%global bigdecimal_version 1.2.3
%global io_console_version 0.4.2
%global json_version 1.7.7
%global json_version 1.8.1
%global minitest_version 4.7.5
%global psych_version 2.0.1
%global psych_version 2.0.2
%global rake_version 10.1.0
%global rdoc_version 4.1.0.rc.1
# Might not be needed in the future, if we are lucky enough.
# https://bugzilla.redhat.com/show_bug.cgi?id=888262
@ -124,31 +125,15 @@ Patch3: ruby-2.1.0-always-use-i386.patch
# Fixes random WEBRick test failures.
# https://bugs.ruby-lang.org/issues/6573.
Patch5: ruby-1.9.3.p195-fix-webrick-tests.patch
# https://github.com/rubygems/rubygems/pull/667
Patch7: rubygems-2.2.0-DRY-Use-full_require_paths-on-yet-another-place.patch
# Allows to install RubyGems into custom directory, outside of Ruby's tree.
# http://redmine.ruby-lang.org/issues/5617
Patch8: ruby-2.1.0-custom-rubygems-location.patch
# Add support for installing binary extensions according to FHS.
# https://github.com/rubygems/rubygems/issues/210
Patch9: rubygems-2.2.0-binary-extensions.patch
# Make mkmf verbose by default
Patch12: ruby-1.9.3-mkmf-verbose.patch
# Without this patch, Specifications.dirs is modified and gems installed on
# the system cannot be required anymore. This causes later issues when RDoc
# documentation should be generated, since json gem is sudenly not accessible.
# https://github.com/rubygems/rubygems/pull/670
Patch13: rubygems-2.2.0-Do-not-modify-global-Specification.dirs-during-insta.patch
# Adds support for '--with-prelude' configuration option. This allows to built
# in support for ABRT.
# http://bugs.ruby-lang.org/issues/8566
Patch17: ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch
# Fixes multilib conlicts of .gemspec files.
# https://bugs.ruby-lang.org/issues/8623
Patch19: ruby-2.0.0-p247-Make-stable-Gem-Specification.files-in-default-.gems.patch
# TestMkmf::TestConfig#test_dir_config fails on x86_64.
# http://bugs.ruby-lang.org/issues/8972
Patch20: ruby-2.1.0-test_config.rb-fix-library-path.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: ruby(rubygems) >= %{rubygems_version}
@ -160,7 +145,6 @@ Requires: rubygem(bigdecimal) >= %{bigdecimal_version}
BuildRequires: autoconf
BuildRequires: gdbm-devel
BuildRequires: ncurses-devel
BuildRequires: libdb-devel
BuildRequires: libffi-devel
BuildRequires: openssl-devel
@ -409,14 +393,9 @@ Tcl/Tk interface for the object-oriented scripting language Ruby.
%patch1 -p1
%patch3 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch12 -p1
%patch13 -p1
%patch17 -p1
%patch19 -p1
%patch20 -p1
# Provide an example of usage of the tapset:
cp -a %{SOURCE3} .
@ -449,11 +428,6 @@ autoconf
--enable-multiarch \
--with-prelude=./abrt_prelude.rb \
# This avoids regeneration of sizes.c (BASERUBY is needed for that), when
# configure.in has newer timestamp the sizes.c (after patch is applied).
# http://bugs.ruby-lang.org/issues/8968
touch sizes.c
# Q= makes the build output more verbose and allows to check Fedora
# compiler options.
make %{?_smp_mflags} COPY="cp -p" Q=
@ -511,25 +485,25 @@ mv %{buildroot}%{ruby_libdir}/rdoc* %{buildroot}%{gem_dir}/gems/rdoc-%{rdoc_vers
mv %{buildroot}%{gem_dir}/specifications/default/rdoc-%{rdoc_version}.gemspec %{buildroot}%{gem_dir}/specifications
mkdir -p %{buildroot}%{gem_dir}/gems/bigdecimal-%{bigdecimal_version}/lib
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/bigdecimal-%{bigdecimal_version}/lib
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/bigdecimal-%{bigdecimal_version}
mv %{buildroot}%{ruby_libdir}/bigdecimal %{buildroot}%{gem_dir}/gems/bigdecimal-%{bigdecimal_version}/lib
mv %{buildroot}%{ruby_libarchdir}/bigdecimal.so %{buildroot}%{_libdir}/gems/%{name}/bigdecimal-%{bigdecimal_version}/lib
mv %{buildroot}%{ruby_libarchdir}/bigdecimal.so %{buildroot}%{_libdir}/gems/%{name}/bigdecimal-%{bigdecimal_version}
mv %{buildroot}%{gem_dir}/specifications/default/bigdecimal-%{bigdecimal_version}.gemspec %{buildroot}%{gem_dir}/specifications
ln -s %{gem_dir}/gems/bigdecimal-%{bigdecimal_version}/lib/bigdecimal %{buildroot}%{ruby_libdir}/bigdecimal
ln -s %{_libdir}/gems/%{name}/bigdecimal-%{bigdecimal_version}/lib/bigdecimal.so %{buildroot}%{ruby_libarchdir}/bigdecimal.so
ln -s %{_libdir}/gems/%{name}/bigdecimal-%{bigdecimal_version}/bigdecimal.so %{buildroot}%{ruby_libarchdir}/bigdecimal.so
mkdir -p %{buildroot}%{gem_dir}/gems/io-console-%{io_console_version}/lib
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/io-console-%{io_console_version}/lib/io
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/io-console-%{io_console_version}/io
mv %{buildroot}%{ruby_libdir}/io %{buildroot}%{gem_dir}/gems/io-console-%{io_console_version}/lib
mv %{buildroot}%{ruby_libarchdir}/io/console.so %{buildroot}%{_libdir}/gems/%{name}/io-console-%{io_console_version}/lib/io
mv %{buildroot}%{ruby_libarchdir}/io/console.so %{buildroot}%{_libdir}/gems/%{name}/io-console-%{io_console_version}/io
mv %{buildroot}%{gem_dir}/specifications/default/io-console-%{io_console_version}.gemspec %{buildroot}%{gem_dir}/specifications
ln -s %{gem_dir}/gems/io-console-%{io_console_version}/lib/io %{buildroot}%{ruby_libdir}/io
ln -s %{_libdir}/gems/%{name}/io-console-%{io_console_version}/lib/io/console.so %{buildroot}%{ruby_libarchdir}/io/console.so
ln -s %{_libdir}/gems/%{name}/io-console-%{io_console_version}/io/console.so %{buildroot}%{ruby_libarchdir}/io/console.so
mkdir -p %{buildroot}%{gem_dir}/gems/json-%{json_version}/lib
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/json-%{json_version}/lib
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/json-%{json_version}
mv %{buildroot}%{ruby_libdir}/json* %{buildroot}%{gem_dir}/gems/json-%{json_version}/lib
mv %{buildroot}%{ruby_libarchdir}/json/ %{buildroot}%{_libdir}/gems/%{name}/json-%{json_version}/lib/
mv %{buildroot}%{ruby_libarchdir}/json/ %{buildroot}%{_libdir}/gems/%{name}/json-%{json_version}/
mv %{buildroot}%{gem_dir}/specifications/default/json-%{json_version}.gemspec %{buildroot}%{gem_dir}/specifications
mkdir -p %{buildroot}%{gem_dir}/gems/minitest-%{minitest_version}/lib
@ -537,9 +511,9 @@ mv %{buildroot}%{ruby_libdir}/minitest %{buildroot}%{gem_dir}/gems/minitest-%{mi
mv %{buildroot}%{gem_dir}/specifications/default/minitest-%{minitest_version}.gemspec %{buildroot}%{gem_dir}/specifications
mkdir -p %{buildroot}%{gem_dir}/gems/psych-%{psych_version}/lib
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/psych-%{psych_version}/lib
mkdir -p %{buildroot}%{_libdir}/gems/%{name}/psych-%{psych_version}
mv %{buildroot}%{ruby_libdir}/psych* %{buildroot}%{gem_dir}/gems/psych-%{psych_version}/lib
mv %{buildroot}%{ruby_libarchdir}/psych.so %{buildroot}%{_libdir}/gems/%{name}/psych-%{psych_version}/lib/
mv %{buildroot}%{ruby_libarchdir}/psych.so %{buildroot}%{_libdir}/gems/%{name}/psych-%{psych_version}/
mv %{buildroot}%{gem_dir}/specifications/default/psych-%{psych_version}.gemspec %{buildroot}%{gem_dir}/specifications
# The links should replace directory, which RPM cannot handle and it is causing
# issues during upgrade from F18 to F19. As a workaround the links are placed
@ -547,7 +521,7 @@ mv %{buildroot}%{gem_dir}/specifications/default/psych-%{psych_version}.gemspec
# https://bugzilla.redhat.com/show_bug.cgi?id=988490
ln -s %{gem_dir}/gems/psych-%{psych_version}/lib/psych %{buildroot}%{ruby_vendorlibdir}/psych
ln -s %{gem_dir}/gems/psych-%{psych_version}/lib/psych.rb %{buildroot}%{ruby_vendorlibdir}/psych.rb
ln -s %{_libdir}/gems/%{name}/psych-%{psych_version}/lib/psych.so %{buildroot}%{ruby_vendorarchdir}/psych.so
ln -s %{_libdir}/gems/%{name}/psych-%{psych_version}/psych.so %{buildroot}%{ruby_vendorarchdir}/psych.so
# Adjust the gemspec files so that the gems will load properly
sed -i '/^end$/ i\
@ -619,6 +593,23 @@ sed -i '/Process.constants.grep(\/\\ACLOCK_\/).each {|n|/ s/$/\n next if [:
test/ruby/test_process.rb
%endif
# Errno::EINVAL: Invalid argument - recvmsg(2)
# Looks to be a problem of Linux 3.12+ and should be possible to remove as soon
# as Koji builders run fixed kerenel.
# https://bugs.ruby-lang.org/issues/9124
sed -i '/^ def test_timestampns/,/^ end/ s/^/#/' test/socket/test_socket.rb
sed -i '/^ def test_timestamp/,/^ end/ s/^/#/' test/socket/test_socket.rb
sed -i '/^ def test_udp_server/,/^ end/ s/^/#/' test/socket/test_socket.rb
sed -i '/^ def test_recvmsg_nonblock_error/,/^ end/ s/^/#/' test/socket/test_nonblock.rb
sed -i '/^ def test_fd_passing_n/,/^ end/ s/^/#/' test/socket/test_unix.rb
sed -i '/^ def test_fd_passing_n2/,/^ end/ s/^/#/' test/socket/test_unix.rb
sed -i '/^ def test_recvmsg/,/^ end/ s/^/#/' test/socket/test_unix.rb
sed -i '/^ def test_sendcred_ucred/,/^ end/ s/^/#/' test/socket/test_unix.rb
# Segmentation fault.
# https://bugs.ruby-lang.org/issues/9198
sed -i '/^ def test_machine_stackoverflow/,/^ end/ s/^/#/' test/ruby/test_exception.rb
# Allow MD5 in OpenSSL.
# https://bugs.ruby-lang.org/issues/9154
OPENSSL_ENABLE_MD5_VERIFY=1 make check TESTS="-v $DISABLE_TESTS"
@ -711,7 +702,6 @@ OPENSSL_ENABLE_MD5_VERIFY=1 make check TESTS="-v $DISABLE_TESTS"
%dir %{ruby_libarchdir}
%{ruby_libarchdir}/continuation.so
%{ruby_libarchdir}/coverage.so
%{ruby_libarchdir}/curses.so
%{ruby_libarchdir}/date_core.so
%{ruby_libarchdir}/dbm.so
%dir %{ruby_libarchdir}/digest
@ -798,6 +788,7 @@ OPENSSL_ENABLE_MD5_VERIFY=1 make check TESTS="-v $DISABLE_TESTS"
%dir %{ruby_libarchdir}/racc
%{ruby_libarchdir}/racc/cparse.so
%{ruby_libarchdir}/rbconfig.rb
%{ruby_libarchdir}/rbconfig/sizeof.so
%{ruby_libarchdir}/readline.so
%{ruby_libarchdir}/ripper.so
%{ruby_libarchdir}/sdbm.so
@ -915,6 +906,9 @@ OPENSSL_ENABLE_MD5_VERIFY=1 make check TESTS="-v $DISABLE_TESTS"
%{ruby_libdir}/tkextlib
%changelog
* Tue Dec 17 2013 Vít Ondruch <vondruch@redhat.com> - 2.1.0.0-0.16.r44266
- Upgrade to Ruby 2.1.0 (r44266).
* Mon Dec 02 2013 Vít Ondruch <vondruch@redhat.com> - 2.1.0.0-0.16.preview1
- Allow MD5 in OpenSSL for tests.

View File

@ -1,71 +0,0 @@
From 02f94e96ea6a9e0fe37341eccd83ffb63549ead5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 3 Oct 2013 14:15:59 +0200
Subject: [PATCH] DRY: Use full_require_paths on yet another place.
---
lib/rubygems/basic_specification.rb | 16 +++++++++++++---
lib/rubygems/specification.rb | 11 -----------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 24bb4bc..a10eab3 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -38,11 +38,10 @@ class Gem::BasicSpecification
# Return true if this spec can require +file+.
def contains_requirable_file? file
- root = full_gem_path
suffixes = Gem.suffixes
- require_paths.any? do |lib|
- base = "#{root}/#{lib}/#{file}"
+ full_require_paths.any? do |path|
+ base = "#{path}/#{file}"
suffixes.any? { |suf| File.file? "#{base}#{suf}" }
end
end
@@ -84,6 +83,17 @@ class Gem::BasicSpecification
end
##
+ # Full paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
+ # activated.
+ #
+
+ def full_require_paths
+ require_paths.map do |path|
+ File.join full_gem_path, path
+ end
+ end
+
+ ##
# Returns the full path to the gems directory containing this spec's
# gem directory. eg: /usr/local/lib/ruby/1.8/gems
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 6de8c3b..deac343 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -2015,17 +2015,6 @@ class Gem::Specification < Gem::BasicSpecification
end
##
- # Full paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
- # activated.
- #
-
- def full_require_paths
- require_paths.map do |path|
- File.join full_gem_path, path
- end
- end
-
- ##
# The RubyGems version required by this gem
def required_rubygems_version= req
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From ad80fb9ffe5ab73e05784237de8d8b7d03784867 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 4 Oct 2013 22:13:11 +0200
Subject: [PATCH] Do not modify global Specification.dirs during installation.
---
lib/rubygems/dependency_installer.rb | 6 ------
1 file changed, 6 deletions(-)
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index e7c489a..5123fce 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -74,12 +74,6 @@ class Gem::DependencyInstaller
@only_install_dir = !!options[:install_dir]
@install_dir = options[:install_dir] || Gem.dir
- if options[:install_dir] then
- # HACK shouldn't change the global settings, needed for -i behavior
- # maybe move to the install command? See also github #442
- Gem::Specification.dirs = @install_dir
- end
-
options = DEFAULT_OPTIONS.merge options
@bin_dir = options[:bin_dir]
--
1.8.3.1

View File

@ -1,179 +0,0 @@
From 37cd8547d23973a7ec23a004ab9b60738d67ada9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 3 Nov 2011 16:43:05 +0100
Subject: [PATCH] Add dedicate extensions folder into $LOAD_PATH.
---
lib/rubygems/basic_specification.rb | 35 ++++++++++++++++++++++++++++++++---
lib/rubygems/defaults.rb | 11 +++++++++++
lib/rubygems/ext/builder.rb | 6 +++++-
lib/rubygems/installer.rb | 1 +
lib/rubygems/specification.rb | 7 +++++++
lib/rubygems/uninstaller.rb | 1 +
6 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index a10eab3..da3af91 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -51,6 +51,14 @@ class Gem::BasicSpecification
File.dirname(loaded_from) == self.class.default_specifications_dir
end
+ ##
+ # Returns the full path to the exts directory containing this spec's
+ # gem directory. eg: /usr/local/lib/ruby/1.8/exts
+
+ def exts_dir
+ @exts_dir ||= Gem.default_ext_dir_for(base_dir) || gems_dir
+ end
+
def find_full_gem_path # :nodoc:
# TODO: also, shouldn't it default to full_name if it hasn't been written?
path = File.expand_path File.join(gems_dir, full_name)
@@ -60,6 +68,15 @@ class Gem::BasicSpecification
private :find_full_gem_path
+ def find_full_gem_ext_path # :nodoc:
+ # TODO: skip for gems without extensions.
+ path = File.expand_path File.join(exts_dir, full_name)
+ path.untaint
+ path if File.directory? path
+ end
+
+ private :find_full_gem_ext_path
+
##
# The full path to the gem (install path + full name).
@@ -70,6 +87,13 @@ class Gem::BasicSpecification
end
##
+ # The full path to the gem binary extension (install path + full name).
+
+ def full_gem_ext_path
+ @full_gem_ext_path ||= find_full_gem_ext_path
+ end
+
+ ##
# Returns the full name (name-version) of this Gem. Platform information
# is included (name-version-platform) if it is specified and not the
# default Ruby platform.
@@ -88,9 +112,12 @@ class Gem::BasicSpecification
#
def full_require_paths
- require_paths.map do |path|
- File.join full_gem_path, path
- end
+ require_paths.map do |require_path|
+ full_gem_paths = [full_gem_path, full_gem_ext_path]
+ full_gem_paths.compact!
+
+ full_gem_paths.map { |path| File.join path, require_path }
+ end.flatten
end
##
@@ -110,7 +137,9 @@ class Gem::BasicSpecification
@loaded_from = path && path.to_s
@full_gem_path = nil
+ @full_gem_ext_path = nil
@gems_dir = nil
+ @exts_dir = nil
@base_dir = nil
end
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index 591580b..8ed474f 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -111,6 +111,17 @@ module Gem
end
##
+ # Returns binary extensions dir for specified RubyGems base dir or nil
+ # if such directory cannot be determined.
+ #
+ # By default, the binary extensions are located side by side with their
+ # Ruby counterparts, therefore nil is returned
+
+ def self.default_ext_dir_for base_dir
+ nil
+ end
+
+ ##
# A wrapper around RUBY_ENGINE const that may not be defined
def self.ruby_engine
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 8c05723..75d5fc2 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -170,7 +170,7 @@ EOF
say "This could take a while..."
end
- dest_path = File.join @gem_dir, @spec.require_paths.first
+ dest_path = File.join(@only_install_dir ? @gem_dir : @spec.ext_dir, @spec.require_paths.first)
@ran_rake = false # only run rake once
@@ -181,5 +181,9 @@ EOF
end
end
+ def only_install_dir= only_install_dir
+ @only_install_dir = only_install_dir
+ end
+
end
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 261af89..a6aca5d 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -662,6 +662,7 @@ TEXT
def build_extensions
builder = Gem::Ext::Builder.new spec, @build_args
+ builder.only_install_dir = @only_install_dir
builder.build_extensions
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index deac343..b630fa3 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1612,6 +1612,13 @@ class Gem::Specification < Gem::BasicSpecification
@executables = Array(value)
end
+ # Returns the full path to this spec's ext directory.
+ # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
+
+ def ext_dir
+ @ext_dir ||= File.expand_path File.join(exts_dir, full_name)
+ end
+
##
# Sets extensions to +extensions+, ensuring it is an array. Don't
# use this, push onto the array instead.
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 143ab6d..f81a23d 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -247,6 +247,7 @@ class Gem::Uninstaller
File.writable?(spec.base_dir)
FileUtils.rm_rf spec.full_gem_path
+ FileUtils.rm_rf spec.ext_dir
# TODO: should this be moved to spec?... I vote eww (also exists in docmgr)
old_platform_name = [spec.name,
--
1.8.3.1