Blame SOURCES/ruby-2.3.0-ruby_version.patch

e076ba
From 4fc1be3af3f58621bb751c9e63c208b15c0e8d16 Mon Sep 17 00:00:00 2001
e076ba
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
e076ba
Date: Tue, 31 Mar 2015 16:21:04 +0200
e076ba
Subject: [PATCH 1/4] Use ruby_version_dir_name for versioned directories.
e076ba
e076ba
This disallows changing the ruby_version constant by --with-ruby-version
e076ba
configuration options. The two places version numbers are disallowed as
e076ba
well, since there are a lot of places which cannot handle this format
e076ba
properly.
e076ba
e076ba
ruby_version_dir_name now specifies custom version string for versioned
e076ba
directories, e.g. instead of default X.Y.Z, you can specify whatever
e076ba
string.
e076ba
---
e076ba
 configure.ac        | 64 ++++++++++++++++++++++++++++-------------------------
e076ba
 template/ruby.pc.in |  1 +
e076ba
 2 files changed, 35 insertions(+), 30 deletions(-)
e076ba
e076ba
diff --git a/configure.ac b/configure.ac
e076ba
index 8ea969412f..a00f2b6776 100644
e076ba
--- a/configure.ac
e076ba
+++ b/configure.ac
0455cc
@@ -4202,9 +4202,6 @@ AS_CASE(["$target_os"],
e076ba
     rubyw_install_name='$(RUBYW_INSTALL_NAME)'
e076ba
     ])
e076ba
 
e076ba
-rubylibdir='${rubylibprefix}/${ruby_version}'
e076ba
-rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
e076ba
-
e076ba
 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
e076ba
 AC_ARG_WITH(rubyarchprefix,
e076ba
 	    AS_HELP_STRING([--with-rubyarchprefix=DIR],
0455cc
@@ -4227,56 +4224,62 @@ AC_ARG_WITH(ridir,
e076ba
 AC_SUBST(ridir)
e076ba
 AC_SUBST(RI_BASE_NAME)
e076ba
 
e076ba
-AC_ARG_WITH(ruby-version,
e076ba
-	    AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|minor|STR)]),
e076ba
-            [ruby_version=$withval],
e076ba
-            [ruby_version=full])
e076ba
 unset RUBY_LIB_VERSION
e076ba
-unset RUBY_LIB_VERSION_STYLE
e076ba
-AS_CASE(["$ruby_version"],
e076ba
-  [full],  [RUBY_LIB_VERSION_STYLE='3	/* full */'],
e076ba
-  [minor], [RUBY_LIB_VERSION_STYLE='2	/* minor */'])
e076ba
-AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [
e076ba
-    {
e076ba
-    echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
e076ba
-    echo '#define STRINGIZE(x) x'
e076ba
-    test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
e076ba
-    echo '#include "version.h"'
e076ba
-    echo 'ruby_version=RUBY_LIB_VERSION'
e076ba
-    } > conftest.c
e076ba
-    ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
e076ba
-    eval $ruby_version
e076ba
-], [test -z "${ruby_version}"], [
e076ba
-    AC_MSG_ERROR([No ruby version, No place for bundled libraries])
e076ba
-], [
e076ba
-    RUBY_LIB_VERSION="${ruby_version}"
e076ba
-])
e076ba
+RUBY_LIB_VERSION_STYLE='3	/* full */'
e076ba
+{
e076ba
+echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
e076ba
+echo '#define STRINGIZE(x) x'
e076ba
+test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
e076ba
+echo '#include "version.h"'
e076ba
+echo 'ruby_version=RUBY_LIB_VERSION'
e076ba
+} > conftest.c
e076ba
+ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
e076ba
+eval $ruby_version
e076ba
+
e076ba
+RUBY_LIB_VERSION="${ruby_version}"
e076ba
+
e076ba
 AC_SUBST(RUBY_LIB_VERSION_STYLE)
e076ba
 AC_SUBST(RUBY_LIB_VERSION)
e076ba
 
e076ba
+AC_ARG_WITH(ruby-version,
e076ba
+	    AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|STR)]),
e076ba
+            [ruby_version_dir_name=$withval],
e076ba
+            [ruby_version_dir_name=full])
e076ba
+AS_CASE(["$ruby_version_dir_name"],
e076ba
+  [full], [ruby_version_dir_name='${ruby_version}'])
e076ba
+
e076ba
+ruby_version_dir=/'${ruby_version_dir_name}'
e076ba
+
e076ba
+if test -z "${ruby_version_dir_name}"; then
e076ba
+    AC_MSG_ERROR([No ruby version, No place for bundled libraries])
e076ba
+fi
e076ba
+
e076ba
+rubylibdir='${rubylibprefix}'${ruby_version_dir}
e076ba
+rubyarchdir=${multiarch+'${rubyarchprefix}'${ruby_version_dir}}${multiarch-'${rubylibdir}/${arch}'}
e076ba
+
e076ba
 AC_ARG_WITH(sitedir,
e076ba
 	    AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
e076ba
             [sitedir=$withval],
e076ba
             [sitedir='${rubylibprefix}/site_ruby'])
e076ba
-sitelibdir='${sitedir}/${ruby_version}'
e076ba
+sitelibdir='${sitedir}'${ruby_version_dir}
e076ba
 
e076ba
 AC_ARG_WITH(sitearchdir,
e076ba
 	    AS_HELP_STRING([--with-sitearchdir=DIR],
e076ba
 			   [architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]),
e076ba
             [sitearchdir=$withval],
e076ba
-            [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}])
e076ba
+            [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby'${ruby_version_dir}}${multiarch-'${sitelibdir}/${sitearch}'}])
e076ba
 
e076ba
 AC_ARG_WITH(vendordir,
e076ba
 	    AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]),
e076ba
             [vendordir=$withval],
e076ba
             [vendordir='${rubylibprefix}/vendor_ruby'])
e076ba
-vendorlibdir='${vendordir}/${ruby_version}'
e076ba
+vendorlibdir='${vendordir}'${ruby_version_dir}
e076ba
 
e076ba
 AC_ARG_WITH(vendorarchdir,
e076ba
 	    AS_HELP_STRING([--with-vendorarchdir=DIR],
e076ba
 			   [architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]),
e076ba
             [vendorarchdir=$withval],
e076ba
-            [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
e076ba
+            [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
e076ba
 
e076ba
 AS_IF([test "${LOAD_RELATIVE+set}"], [
e076ba
     AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
0455cc
@@ -4293,6 +4296,7 @@ AC_SUBST(sitearchincludedir)dnl
e076ba
 AC_SUBST(arch)dnl
e076ba
 AC_SUBST(sitearch)dnl
e076ba
 AC_SUBST(ruby_version)dnl
e076ba
+AC_SUBST(ruby_version_dir_name)dnl
e076ba
 AC_SUBST(rubylibdir)dnl
e076ba
 AC_SUBST(rubyarchdir)dnl
e076ba
 AC_SUBST(sitedir)dnl
e076ba
diff --git a/template/ruby.pc.in b/template/ruby.pc.in
e076ba
index 8a2c066..c81b211 100644
e076ba
--- a/template/ruby.pc.in
e076ba
+++ b/template/ruby.pc.in
e076ba
@@ -9,6 +9,7 @@ MAJOR=@MAJOR@
e076ba
 MINOR=@MINOR@
e076ba
 TEENY=@TEENY@
e076ba
 ruby_version=@ruby_version@
e076ba
+ruby_version_dir_name=@ruby_version_dir_name@
e076ba
 RUBY_API_VERSION=@RUBY_API_VERSION@
e076ba
 RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
e076ba
 RUBY_BASE_NAME=@RUBY_BASE_NAME@
e076ba
-- 
e076ba
2.1.0
e076ba
e076ba
e076ba
From 518850aba6eee76de7715aae8d37330e34b01983 Mon Sep 17 00:00:00 2001
e076ba
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
e076ba
Date: Tue, 31 Mar 2015 16:37:26 +0200
e076ba
Subject: [PATCH 2/4] Add ruby_version_dir_name support for RDoc.
e076ba
e076ba
---
e076ba
 lib/rdoc/ri/paths.rb | 2 +-
e076ba
 tool/rbinstall.rb    | 2 +-
e076ba
 2 files changed, 2 insertions(+), 2 deletions(-)
e076ba
e076ba
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
e076ba
index 970cb91..5bf8230 100644
e076ba
--- a/lib/rdoc/ri/paths.rb
e076ba
+++ b/lib/rdoc/ri/paths.rb
e076ba
@@ -10,7 +10,7 @@ module RDoc::RI::Paths
e076ba
   #:stopdoc:
e076ba
   require 'rbconfig'
e076ba
 
e076ba
-  version = RbConfig::CONFIG['ruby_version']
e076ba
+  version = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
 
e076ba
   BASE    = if RbConfig::CONFIG.key? 'ridir' then
e076ba
               File.join RbConfig::CONFIG['ridir'], version
e076ba
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
e076ba
index d4c110e..d39c9a6 100755
e076ba
--- a/tool/rbinstall.rb
e076ba
+++ b/tool/rbinstall.rb
e076ba
@@ -417,7 +417,7 @@ def CONFIG.[](name, mandatory = false)
e076ba
 
e076ba
 install?(:doc, :rdoc) do
e076ba
   if $rdocdir
e076ba
-    ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version'], "system")
e076ba
+    ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version_dir_name'] || CONFIG['ruby_version'], "system")
e076ba
     prepare "rdoc", ridatadir
e076ba
     install_recursive($rdocdir, ridatadir, :mode => $data_mode)
e076ba
   end
e076ba
-- 
e076ba
2.1.0
e076ba
e076ba
e076ba
From f8d136f9a46d1fe87eba622ab9665935d05e981b Mon Sep 17 00:00:00 2001
e076ba
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
e076ba
Date: Tue, 31 Mar 2015 16:37:44 +0200
e076ba
Subject: [PATCH 3/4] Add ruby_version_dir_name support for RubyGems.
e076ba
e076ba
---
e076ba
 lib/rubygems/defaults.rb  | 11 ++++++-----
e076ba
 test/rubygems/test_gem.rb |  5 +++--
e076ba
 2 files changed, 9 insertions(+), 7 deletions(-)
e076ba
e076ba
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
e076ba
index 55ca080..75eea2b 100644
e076ba
--- a/lib/rubygems/defaults.rb
e076ba
+++ b/lib/rubygems/defaults.rb
e076ba
@@ -32,20 +32,20 @@ def self.default_dir
e076ba
              [
e076ba
                File.dirname(RbConfig::CONFIG['sitedir']),
e076ba
                'Gems',
e076ba
-               RbConfig::CONFIG['ruby_version']
e076ba
+               RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
              ]
e076ba
            elsif RbConfig::CONFIG['rubylibprefix'] then
e076ba
              [
e076ba
               RbConfig::CONFIG['rubylibprefix'],
e076ba
               'gems',
e076ba
-              RbConfig::CONFIG['ruby_version']
e076ba
+              RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
              ]
e076ba
            else
e076ba
              [
e076ba
                RbConfig::CONFIG['libdir'],
e076ba
                ruby_engine,
e076ba
                'gems',
e076ba
-               RbConfig::CONFIG['ruby_version']
e076ba
+               RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
              ]
e076ba
            end
e076ba
 
e076ba
@@ -75,7 +75,8 @@ def self.default_rubygems_dirs
e076ba
 
e076ba
   def self.user_dir
e076ba
     parts = [Gem.user_home, '.gem', ruby_engine]
e076ba
-    parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
e076ba
+    ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
+    parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
e076ba
     File.join parts
e076ba
   end
e076ba
 
e076ba
@@ -172,7 +173,7 @@ def self.vendor_dir # :nodoc:
e076ba
     return nil unless RbConfig::CONFIG.key? 'vendordir'
e076ba
 
e076ba
     File.join RbConfig::CONFIG['vendordir'], 'gems',
e076ba
-              RbConfig::CONFIG['ruby_version']
e076ba
+              RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
   end
e076ba
 
e076ba
   ##
e076ba
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
e076ba
index 0428bea..b6e090e 100644
e076ba
--- a/test/rubygems/test_gem.rb
e076ba
+++ b/test/rubygems/test_gem.rb
e076ba
@@ -1156,7 +1156,8 @@ def test_self_use_paths
e076ba
 
e076ba
   def test_self_user_dir
e076ba
     parts = [@userhome, '.gem', Gem.ruby_engine]
e076ba
-    parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
e076ba
+    ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
+    parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
e076ba
 
e076ba
     assert_equal File.join(parts), Gem.user_dir
e076ba
   end
e076ba
@@ -1283,7 +1284,7 @@ def test_self_user_home_user_drive_and_path
e076ba
   def test_self_vendor_dir
e076ba
     expected =
e076ba
       File.join RbConfig::CONFIG['vendordir'], 'gems',
e076ba
-                RbConfig::CONFIG['ruby_version']
e076ba
+                RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
e076ba
 
e076ba
     assert_equal expected, Gem.vendor_dir
e076ba
   end
e076ba
-- 
e076ba
2.1.0
e076ba
e076ba
e076ba
From 88c38a030c22dbf9422ece847bdfbf87d6659313 Mon Sep 17 00:00:00 2001
e076ba
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
e076ba
Date: Wed, 1 Apr 2015 14:55:37 +0200
e076ba
Subject: [PATCH 4/4] Let headers directories follow the configured version
e076ba
 name.
e076ba
e076ba
---
e076ba
 configure.ac | 2 +-
e076ba
 1 file changed, 1 insertion(+), 1 deletion(-)
e076ba
e076ba
diff --git a/configure.ac b/configure.ac
e076ba
index a00f2b6776..999e2d6d5d 100644
e076ba
--- a/configure.ac
e076ba
+++ b/configure.ac
e076ba
@@ -164,7 +164,7 @@ RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
e076ba
 RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
e076ba
 AC_SUBST(RUBY_BASE_NAME)
e076ba
 AC_SUBST(RUBYW_BASE_NAME)
e076ba
-AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
e076ba
+AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version_dir_name}')
e076ba
 
e076ba
 AC_CANONICAL_TARGET
e076ba
 test x"$target_alias" = x &&
e076ba
-- 
e076ba
2.1.0
e076ba