Upgrade to Ruby 2.5.0.

This commit is contained in:
Jun Aruga 2018-01-02 18:46:57 +01:00
parent 9474e3d4fe
commit cc7a37ba18
11 changed files with 172 additions and 75 deletions

View File

@ -51,18 +51,10 @@ module Gem
private :x_scls
##
# Default gems locations allowed on FHS system (/usr, /usr/share).
# The locations are derived from directories specified during build
# configuration.
# Additional default locations for enabled software collections
# Dependent scls needs to add themselves on $GEM_PATH
def default_locations
@default_locations ||= {
:system => previous_but_one_dir_to(RbConfig::CONFIG['vendordir'], RbConfig::CONFIG['RUBY_INSTALL_NAME']),
:local => previous_but_one_dir_to(RbConfig::CONFIG['sitedir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
}
# Add additional default locations for enabled software collections
# Dependent scls needs to add themselves on $GEM_PATH
def default_locations_added_for_scls
if ENV['GEM_PATH']
gem_paths = ENV['GEM_PATH'].split(':')
@ -81,6 +73,31 @@ module Gem
@default_locations
end
private :default_locations_added_for_scls
##
# SCL prefix genereatd from first detected SCL except own SCL.
def scl_prefix
prefix = x_scls.detect {|c| c != '@SCL@'}
prefix = prefix ? prefix + '_': nil
prefix
end
private :scl_prefix
##
# Default gems locations allowed on FHS system (/usr, /usr/share).
# The locations are derived from directories specified during build
# configuration.
def default_locations
@default_locations ||= {
:system => previous_but_one_dir_to(RbConfig::CONFIG['vendordir'], RbConfig::CONFIG['RUBY_INSTALL_NAME']),
:local => previous_but_one_dir_to(RbConfig::CONFIG['sitedir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
}
default_locations_added_for_scls
end
##
# For each location provides set of directories for binaries (:bin_dir)
@ -119,24 +136,37 @@ module Gem
# Remove methods we are going to override. This avoids "method redefined;"
# warnings otherwise issued by Ruby.
remove_method :operating_system_defaults if method_defined? :operating_system_defaults
remove_method :default_dir if method_defined? :default_dir
remove_method :default_path if method_defined? :default_path
remove_method :default_bindir if method_defined? :default_bindir
remove_method :default_ext_dir_for if method_defined? :default_ext_dir_for
##
# Regular user installs into user directory, root manages /usr/local.
def operating_system_defaults
unless opt_build_root?
options = if Process.uid == 0
"--install-dir=#{Gem.default_dirs[:local][:gem_dir]} --bindir #{Gem.default_dirs[:local][:bin_dir]}"
else
"--user-install --bindir #{File.join [Dir.home, 'bin']}"
end
{"gem" => options}
else
{}
end
end
##
# RubyGems default overrides.
def default_dir
if opt_build_root?
scl_prefix = x_scls.detect {|c| c != '@SCL@'}
scl_prefix = scl_prefix ? scl_prefix + '_': nil
Gem.default_dirs[:"#{scl_prefix}system"][:gem_dir]
elsif Process.uid == 0
Gem.default_dirs[:local][:gem_dir]
prefix = scl_prefix
if Gem.default_dirs.key?(:"#{prefix}system")
Gem.default_dirs[:"#{prefix}system"][:gem_dir]
else
Gem.user_dir
Gem.default_dirs[:"system"][:gem_dir]
end
end
@ -145,27 +175,12 @@ module Gem
path.unshift Gem.user_dir if File.exist? Gem.user_home
end
def default_bindir
if opt_build_root?
scl_prefix = x_scls.detect {|c| c != '@SCL@'}
scl_prefix = scl_prefix ? scl_prefix + '_': nil
Gem.default_dirs[:"#{scl_prefix}system"][:bin_dir]
elsif Process.uid == 0
Gem.default_dirs[:local][:bin_dir]
else
File.join [Dir.home, 'bin']
end
end
def default_ext_dir_for base_dir
dir = if rpmbuild?
scl_prefix = x_scls.detect {|c| c != '@SCL@' && base_dir =~ /\/#{c}\//}
scl_prefix = scl_prefix ? scl_prefix + '_': nil
build_dir = base_dir.chomp Gem.default_dirs[:"#{scl_prefix}system"][:gem_dir]
prefix = scl_prefix
build_dir = base_dir.chomp Gem.default_dirs[:"#{prefix}system"][:gem_dir]
if build_dir != base_dir
File.join build_dir, Gem.default_dirs[:"#{scl_prefix}system"][:ext_dir]
File.join build_dir, Gem.default_dirs[:"#{prefix}system"][:ext_dir]
end
else
dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}

View File

@ -39,7 +39,7 @@ diff --git a/configure.ac b/configure.ac
index 028ef7ca3e..cdeff87871 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4387,6 +4387,13 @@ AC_SUBST(rubyarchhdrdir)dnl
@@ -4395,6 +4395,13 @@ AC_SUBST(rubyarchhdrdir)dnl
AC_SUBST(sitearchhdrdir)dnl
AC_SUBST(vendorarchhdrdir)dnl

View File

@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac
index 11fc237552..b77e88fc37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3632,6 +3632,11 @@ AS_IF([test ${multiarch+set}], [
@@ -3640,6 +3640,11 @@ AS_IF([test ${multiarch+set}], [
])
archlibdir='${libdir}/${arch}'

View File

@ -14,7 +14,7 @@ diff --git a/configure.ac b/configure.ac
index 999e2d6d5d..11fc237552 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4242,7 +4242,8 @@ AS_CASE(["$ruby_version_dir_name"],
@@ -4250,7 +4250,8 @@ AS_CASE(["$ruby_version_dir_name"],
ruby_version_dir=/'${ruby_version_dir_name}'
if test -z "${ruby_version_dir_name}"; then

View File

@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac
index b77e88fc37..6bba453e3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4306,6 +4306,8 @@ AC_SUBST(vendorarchdir)dnl
@@ -4314,6 +4314,8 @@ AC_SUBST(vendorarchdir)dnl
AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl

View File

@ -15,7 +15,7 @@ diff --git a/configure.ac b/configure.ac
index 6bba453e3c..028ef7ca3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4278,6 +4278,10 @@ AC_ARG_WITH(vendorarchdir,
@@ -4286,6 +4286,10 @@ AC_ARG_WITH(vendorarchdir,
[vendorarchdir=$withval],
[vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
@ -26,7 +26,7 @@ index 6bba453e3c..028ef7ca3e 100644
AS_IF([test "${LOAD_RELATIVE+set}"], [
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
RUBY_EXEC_PREFIX=''
@@ -4302,6 +4306,7 @@ AC_SUBST(sitearchdir)dnl
@@ -4310,6 +4314,7 @@ AC_SUBST(sitearchdir)dnl
AC_SUBST(vendordir)dnl
AC_SUBST(vendorlibdir)dnl
AC_SUBST(vendorarchdir)dnl

View File

@ -11,7 +11,7 @@ diff --git a/common.mk b/common.mk
index 168dc52..20c218a 100644
--- a/common.mk
+++ b/common.mk
@@ -956,9 +956,9 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE)
@@ -962,9 +962,9 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE)
$(srcdir)/template/prelude.c.tmpl
$(PRELUDE_C): $(COMPILE_PRELUDE) \

View File

@ -20,7 +20,7 @@ diff --git a/configure.ac b/configure.ac
index 8ea969412f..a00f2b6776 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4193,9 +4193,6 @@ AS_CASE(["$target_os"],
@@ -4201,9 +4201,6 @@ AS_CASE(["$target_os"],
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
])
@ -30,7 +30,7 @@ index 8ea969412f..a00f2b6776 100644
rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
AC_ARG_WITH(rubyarchprefix,
AS_HELP_STRING([--with-rubyarchprefix=DIR],
@@ -4218,56 +4215,62 @@ AC_ARG_WITH(ridir,
@@ -4226,56 +4223,62 @@ AC_ARG_WITH(ridir,
AC_SUBST(ridir)
AC_SUBST(RI_BASE_NAME)
@ -120,7 +120,7 @@ index 8ea969412f..a00f2b6776 100644
AS_IF([test "${LOAD_RELATIVE+set}"], [
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
@@ -4284,6 +4287,7 @@ AC_SUBST(sitearchincludedir)dnl
@@ -4292,6 +4295,7 @@ AC_SUBST(sitearchincludedir)dnl
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
AC_SUBST(ruby_version)dnl

View File

@ -0,0 +1,80 @@
From 60eb961c25f801ee43ca1be9393ab2f0a0546677 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Tue, 19 Dec 2017 14:00:20 +0100
Subject: [PATCH] Add Gem.operating_system_defaults to allow packagers to
override defaults.
This change allows Ruby packagers to override defaults and lazily query
them.
This is very much the same change as #1644 to treat the
operating_system defaults the same way as platform defaults.
---
lib/rubygems/config_file.rb | 2 +-
lib/rubygems/defaults.rb | 21 ++++++++++++++++++++-
test/rubygems/test_gem.rb | 7 +++++++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index a4efed0f5a..deee38e6d9 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -48,7 +48,7 @@ class Gem::ConfigFile
# For Ruby packagers to set configuration defaults. Set in
# rubygems/defaults/operating_system.rb
- OPERATING_SYSTEM_DEFAULTS = {}
+ OPERATING_SYSTEM_DEFAULTS = Gem.operating_system_defaults
##
# For Ruby implementers to set configuration defaults. Set in
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index 43d57fc808..b8222877ae 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -177,7 +177,26 @@ def self.vendor_dir # :nodoc:
end
##
- # Default options for gem commands.
+ # Default options for gem commands for Ruby packagers.
+ #
+ # The options here should be structured as an array of string "gem"
+ # command names as keys and a string of the default options as values.
+ #
+ # Example:
+ #
+ # def self.operating_system_defaults
+ # {
+ # 'install' => '--no-rdoc --no-ri --env-shebang',
+ # 'update' => '--no-rdoc --no-ri --env-shebang'
+ # }
+ # end
+
+ def self.operating_system_defaults
+ {}
+ end
+
+ ##
+ # Default options for gem commands for Ruby implementers.
#
# The options here should be structured as an array of string "gem"
# command names as keys and a string of the default options as values.
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 3225a05c6b..62b80c4945 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1802,6 +1802,13 @@ def test_use_gemdeps_specific
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
+ def test_operating_system_defaults
+ operating_system_defaults = Gem.operating_system_defaults
+
+ assert operating_system_defaults != nil
+ assert operating_system_defaults.is_a? Hash
+ end
+
def test_platform_defaults
platform_defaults = Gem.platform_defaults

View File

@ -13,7 +13,7 @@
#%%global milestone rc1
# Keep the revision enabled for pre-releases from SVN.
%global revision 61214
#%%global revision 61414
%global ruby_archive %{pkg_name}-%{ruby_version}
@ -24,7 +24,7 @@
%endif
%global release 1
%global release 2
%{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}
# The RubyGems library has to stay out of Ruby directory three, since the
@ -39,18 +39,17 @@
# http://redmine.ruby-lang.org/issues/5313
%global irb_version %{ruby_version}
%global bigdecimal_version 1.3.3
%global bundler_version 1.16.1.pre1
%global did_you_mean_version 1.1.2
%global bigdecimal_version 1.3.4
%global did_you_mean_version 1.2.0
%global io_console_version 0.4.6
%global json_version 2.1.0
%global minitest_version 5.10.3
%global net_telnet_version 0.1.1
%global openssl_version 2.1.0.beta2
%global openssl_version 2.1.0
%global power_assert_version 1.1.1
%global psych_version 3.0.0
%global psych_version 3.0.2
%global rake_version 12.3.0
%global rdoc_version 6.0.0
%global rdoc_version 6.0.1
%global test_unit_version 3.2.7
%global xmlrpc_version 0.3.0
@ -143,6 +142,9 @@ Patch7: ruby-2.2.3-Generate-preludes-using-miniruby.patch
# hardening features of glibc (rhbz#1361037).
# https://bugs.ruby-lang.org/issues/12666
Patch9: ruby-2.3.1-Rely-on-ldd-to-detect-glibc.patch
# Add Gem.operating_system_defaults to allow packagers to override defaults.
# https://github.com/rubygems/rubygems/pull/2116
Patch10: ruby-2.5.0-Add-Gem.operating_system_defaults.patch
Requires: %{?scl_prefix}%{pkg_name}-libs%{?_isa} = %{version}-%{release}
Requires: %{?scl_prefix}ruby(rubygems) >= %{rubygems_version}
@ -244,7 +246,6 @@ Requires: %{?scl_prefix}rubygem(psych) >= %{psych_version}
Provides: %{?scl_prefix}gem = %{version}-%{release}
Provides: %{?scl_prefix}ruby(rubygems) = %{version}-%{release}
# https://github.com/rubygems/rubygems/pull/1189#issuecomment-121600910
Provides: bundled(rubygem(molinillo)) = %{molinillo_version}
Provides: bundled(rubygem-molinillo) = %{molinillo_version}
BuildArch: noarch
@ -362,6 +363,7 @@ License: MIT
Requires: %{?scl_prefix}ruby(release)
Requires: %{?scl_prefix}ruby(rubygems) >= %{rubygems_version}
Provides: %{?scl_prefix}rubygem(did_you_mean) = %{version}-%{release}
BuildArch: noarch
%description -n %{?scl_prefix}rubygem-did_you_mean
"did you mean?" experience in Ruby: the error message will tell you the right
@ -476,6 +478,7 @@ Group: Development/Libraries
Requires: %{?scl_prefix}ruby(release)
Requires: %{?scl_prefix}ruby(rubygems) >= %{rubygems_version}
Provides: %{?scl_prefix}rubygem(net-telnet) = %{version}-%{release}
BuildArch: noarch
%description -n %{?scl_prefix}rubygem-net-telnet
Provides telnet client functionality.
@ -539,6 +542,7 @@ rm -rf ext/fiddle/libffi*
%patch6 -p1
%patch7 -p1
%patch9 -p1
%patch10 -p1
# Provide an example of usage of the tapset:
cp -a %{SOURCE3} .
@ -684,12 +688,6 @@ ln -s %{gem_dir}/gems/psych-%{psych_version}/lib/psych %{buildroot}%{ruby_libdir
ln -s %{gem_dir}/gems/psych-%{psych_version}/lib/psych.rb %{buildroot}%{ruby_libdir}/psych.rb
ln -s %{_libdir}/gems/%{pkg_name}/psych-%{psych_version}/psych.so %{buildroot}%{ruby_libarchdir}/psych.so
# Remove Bundler until it is really necessary.
rm -rf %{buildroot}%{ruby_libdir}/bundler
rm -rf %{buildroot}%{gem_dir}/gems/bundler-%{bundler_version}
rm -rf %{buildroot}%{gem_dir}/specifications/default/bundler-%{bundler_version}.gemspec
rm %{buildroot}%{_bindir}/bundle*
# Move the binary extensions into proper place (if no gem has binary extension,
# the extensions directory might be empty).
find %{buildroot}%{gem_dir}/extensions/*-%{_target_os}/%{ruby_version}/* -maxdepth 0 \
@ -739,12 +737,19 @@ checksec -f libruby.so.%{ruby_version} | \
grep "Full RELRO.*Canary found.*NX enabled.*DSO.*No RPATH.*No RUNPATH.*Yes.*\d*.*\d*.*libruby.so.%{ruby_version}"
%endif
# Check RubyGems version correctness.
# Check RubyGems version.
[ "`make runruby TESTRUN_SCRIPT='bin/gem -v' | tail -1`" == '%{rubygems_version}' ]
# Check Molinillo version correctness.
[ "`make runruby TESTRUN_SCRIPT=\"-e \\\"module Gem; module Resolver; end; end; require 'rubygems/resolver/molinillo/lib/molinillo/gem_metadata'; puts Gem::Resolver::Molinillo::VERSION\\\"\" | tail -1`" \
# Check Rubygems bundled dependencies versions.
# Molinillo.
[ "`make runruby TESTRUN_SCRIPT=\"-e \\\" \
module Gem; module Resolver; end; end; \
require 'rubygems/resolver/molinillo/lib/molinillo/gem_metadata'; \
puts Gem::Resolver::Molinillo::VERSION\\\"\" | tail -1`" \
== '%{molinillo_version}' ]
# test_debug(TestRubyOptions) fails due to LoadError reported in debug mode,
# when abrt.rb cannot be required (seems to be easier way then customizing
# the test suite).
@ -973,18 +978,17 @@ make check TESTS="-v $DISABLE_TESTS"
%{gem_dir}/specifications/default/csv-1.0.0.gemspec
%{gem_dir}/specifications/default/date-1.0.0.gemspec
%{gem_dir}/specifications/default/dbm-1.0.0.gemspec
%{gem_dir}/specifications/default/digest-0.1.0.gemspec
%{gem_dir}/specifications/default/etc-1.0.0.gemspec
%{gem_dir}/specifications/default/fcntl-1.0.0.gemspec
%{gem_dir}/specifications/default/fiddle-1.0.0.gemspec
%{gem_dir}/specifications/default/fileutils-1.0.1.gemspec
%{gem_dir}/specifications/default/fileutils-1.0.2.gemspec
%{gem_dir}/specifications/default/gdbm-2.0.0.gemspec
%{gem_dir}/specifications/default/ipaddr-1.2.0.gemspec
%{gem_dir}/specifications/default/scanf-1.0.0.gemspec
%{gem_dir}/specifications/default/sdbm-1.0.0.gemspec
%{gem_dir}/specifications/default/stringio-0.0.1.gemspec
%{gem_dir}/specifications/default/strscan-0.0.1.gemspec
%{gem_dir}/specifications/default/webrick-1.4.0.beta1.gemspec
%{gem_dir}/specifications/default/strscan-1.0.0.gemspec
%{gem_dir}/specifications/default/webrick-1.4.2.gemspec
%{gem_dir}/specifications/default/zlib-1.0.0.gemspec
%files -n %{?scl_prefix}rubygems-devel
@ -1090,10 +1094,8 @@ make check TESTS="-v $DISABLE_TESTS"
%{gem_dir}/specifications/xmlrpc-%{xmlrpc_version}.gemspec
%changelog
* Thu Dec 14 2017 Jun Aruga <jaruga@redhat.com> - 2.5.0-1.r61214
- Upgrade to Ruby 2.5.0 (r61214).
- Remove Patch10 for CVE-2017-0903.
- Remove SCL runtime generated automatically by scl-utils on RHEL7.
* Tue Jan 02 2018 Jun Aruga <jaruga@redhat.com> - 2.5.0-2
- Upgrade to Ruby 2.5.0.
* Mon Oct 30 2017 Vít Ondruch <vondruch@redhat.com> - 2.4.2-86
- Upgrade to Ruby 2.4.2.

View File

@ -1 +1 @@
6aed578e66e0e4eeeecfb8f07eb7ed2a ruby-2.5.0-r61214.tar.xz
e3a98c7b7de49ed5134398367ab3a3bc ruby-2.5.0.tar.xz