From 3112d6a61a6fcf9953fe07b147adf8cc715ee08d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 20 Oct 2016 21:39:48 +0300 Subject: [PATCH] update patches from fedora subpackages for power_assert and test-unit gems --- archlibdir.patch | 2 +- custom-rubygems-location.patch | 14 +++---- duplicated-paths.patch | 64 +++++++++++++++++++++++++----- operating_system.rb | 36 +++++++++++------ ruby.spec | 72 ++++++++++++++++++++++++++++++---- 5 files changed, 153 insertions(+), 35 deletions(-) diff --git a/archlibdir.patch b/archlibdir.patch index 4a4919c..b54f8e0 100644 --- a/archlibdir.patch +++ b/archlibdir.patch @@ -11,7 +11,7 @@ diff --git a/configure.in b/configure.in index 37d9a62..553d4d0 100644 --- a/configure.in +++ b/configure.in -@@ -3143,6 +3143,11 @@ if test ${multiarch+set}; then +@@ -3385,6 +3385,11 @@ if test ${multiarch+set}; then fi archlibdir='${libdir}/${arch}' diff --git a/custom-rubygems-location.patch b/custom-rubygems-location.patch index e82f172..c21c858 100644 --- a/custom-rubygems-location.patch +++ b/custom-rubygems-location.patch @@ -15,9 +15,9 @@ diff --git a/configure.in b/configure.in index 03a4152..0e371e2 100644 --- a/configure.in +++ b/configure.in -@@ -4264,6 +4264,10 @@ AC_ARG_WITH(vendorarchdir, +@@ -4061,6 +4061,10 @@ AC_ARG_WITH(vendorarchdir, [vendorarchdir=$withval], - [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}]) + [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}]) +AC_ARG_WITH(rubygemsdir, + AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]), @@ -26,14 +26,14 @@ index 03a4152..0e371e2 100644 if test "${LOAD_RELATIVE+set}"; then AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) RUBY_EXEC_PREFIX='' -@@ -4288,6 +4292,7 @@ AC_SUBST(sitearchdir)dnl +@@ -4084,6 +4088,7 @@ AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl AC_SUBST(vendorlibdir)dnl AC_SUBST(vendorarchdir)dnl +AC_SUBST(rubygemsdir)dnl - AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl + diff --git a/loadpath.c b/loadpath.c index 623dc9d..74c5d9e 100644 --- a/loadpath.c @@ -53,7 +53,7 @@ diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl index 79c003e..34f2382 100644 --- a/template/verconf.h.tmpl +++ b/template/verconf.h.tmpl -@@ -36,6 +36,9 @@ +@@ -34,6 +34,9 @@ % if C["RUBY_SEARCH_PATH"] #define RUBY_SEARCH_PATH "${RUBY_SEARCH_PATH}" % end @@ -67,7 +67,7 @@ diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index b47b6e1..0b99408 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb -@@ -328,6 +328,7 @@ def CONFIG.[](name, mandatory = false) +@@ -317,6 +317,7 @@ sitelibdir = CONFIG["sitelibdir"] sitearchlibdir = CONFIG["sitearchdir"] vendorlibdir = CONFIG["vendorlibdir"] vendorarchlibdir = CONFIG["vendorarchdir"] @@ -75,7 +75,7 @@ index b47b6e1..0b99408 100755 mandir = CONFIG["mandir", true] docdir = CONFIG["docdir", true] configure_args = Shellwords.shellwords(CONFIG["configure_args"]) -@@ -506,7 +507,15 @@ def CONFIG.[](name, mandatory = false) +@@ -505,7 +506,15 @@ end install?(:local, :comm, :lib) do prepare "library scripts", rubylibdir noinst = %w[README* *.txt *.rdoc *.gemspec] diff --git a/duplicated-paths.patch b/duplicated-paths.patch index eb34107..b401158 100644 --- a/duplicated-paths.patch +++ b/duplicated-paths.patch @@ -5,25 +5,71 @@ Subject: [PATCH] Prevent duplicated paths when empty version string is configured. --- - configure.in | 3 ++- + configure.in | 15 +++++++++------ loadpath.c | 12 ++++++++++++ tool/mkconfig.rb | 2 +- - 3 files changed, 15 insertions(+), 2 deletions(-) + 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/configure.in b/configure.in -index db37cd6..ce8d149 100644 +index 17ed3ed..5843651 100644 --- a/configure.in +++ b/configure.in -@@ -4228,7 +4228,8 @@ AS_CASE(["$ruby_version_dir_name"], - ruby_version_dir=/'${ruby_version_dir_name}' +@@ -3975,8 +3975,6 @@ AS_CASE(["$target_os"], + rubyw_install_name='$(RUBYW_INSTALL_NAME)' + ]) - if test -z "${ruby_version_dir_name}"; then +-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, +@@ -4006,6 +4004,7 @@ AC_ARG_WITH(ruby-version, + [ruby_version=full]) + unset RUBY_LIB_VERSION + unset RUBY_LIB_VERSION_STYLE ++ruby_version_suffix=/'${ruby_version}' + AS_CASE(["$ruby_version"], + [full], [RUBY_LIB_VERSION_STYLE='3 /* full */'], + [minor], [RUBY_LIB_VERSION_STYLE='2 /* minor */']) +@@ -4022,30 +4021,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 - AC_MSG_ERROR([No ruby version, No place for bundled libraries]) -+ unset ruby_version_dir ++ unset ruby_version_suffix + AC_DEFINE(RUBY_LIB_VERSION_BLANK, 1) + else + RUBY_LIB_VERSION="${ruby_version}" fi + AC_SUBST(RUBY_LIB_VERSION_STYLE) + AC_SUBST(RUBY_LIB_VERSION) + ++rubylibdir='${rubylibprefix}'${ruby_version_suffix} ++rubyarchdir=${multiarch+'${rubyarchprefix}'${ruby_version_suffix}}${multiarch-'${rubylibdir}/${arch}'} ++ + AC_ARG_WITH(sitedir, + AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]), + [sitedir=$withval], + [sitedir='${rubylibprefix}/site_ruby']) +-sitelibdir='${sitedir}/${ruby_version}' ++sitelibdir='${sitedir}'${ruby_version_suffix} + + AC_ARG_WITH(sitearchdir, + AS_HELP_STRING([--with-sitearchdir=DIR], + [architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]), + [sitearchdir=$withval], +- [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}]) ++ [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby'${ruby_version_suffix}}${multiarch-'${sitelibdir}/${sitearch}'}]) + + AC_ARG_WITH(vendordir, + AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]), + [vendordir=$withval], + [vendordir='${rubylibprefix}/vendor_ruby']) +-vendorlibdir='${vendordir}/${ruby_version}' ++vendorlibdir='${vendordir}'${ruby_version_suffix} - rubylibdir='${rubylibprefix}'${ruby_version_dir} + AC_ARG_WITH(vendorarchdir, + AS_HELP_STRING([--with-vendorarchdir=DIR], diff --git a/loadpath.c b/loadpath.c index 9160031..0d4d953 100644 --- a/loadpath.c @@ -67,7 +113,7 @@ diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb index 07076d4..35e6c3c 100755 --- a/tool/mkconfig.rb +++ b/tool/mkconfig.rb -@@ -122,7 +122,7 @@ def config.write(arg) +@@ -123,7 +123,7 @@ File.foreach "config.status" do |line| val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump case name when /^prefix$/ diff --git a/operating_system.rb b/operating_system.rb index 079564f..ed653fd 100644 --- a/operating_system.rb +++ b/operating_system.rb @@ -6,6 +6,8 @@ module Gem # E.g. for '/usr/share/ruby', 'ruby', it returns '/usr' def previous_but_one_dir_to(path, dir) + return unless path + split_path = path.split(File::SEPARATOR) File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2]) end @@ -27,8 +29,8 @@ module Gem def default_locations @default_locations ||= { - :system => previous_but_one_dir_to(ConfigMap[:vendordir], ConfigMap[:RUBY_INSTALL_NAME]), - :local => previous_but_one_dir_to(ConfigMap[:sitedir], ConfigMap[:RUBY_INSTALL_NAME]) + :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']) } end @@ -39,18 +41,30 @@ module Gem def default_dirs @libdir ||= case RUBY_PLATFORM when 'java' - ConfigMap[:datadir] + RbConfig::CONFIG['datadir'] else - ConfigMap[:libdir] + RbConfig::CONFIG['libdir'] end - @default_dirs ||= Hash[default_locations.collect do |destination, path| - [destination, { - :bin_dir => File.join(path, ConfigMap[:bindir].split(File::SEPARATOR).last), - :gem_dir => File.join(path, ConfigMap[:datadir].split(File::SEPARATOR).last, 'gems'), - :ext_dir => File.join(path, @libdir.split(File::SEPARATOR).last, 'gems') - }] - end] + @default_dirs ||= default_locations.inject(Hash.new) do |hash, location| + destination, path = location + + hash[destination] = if path + { + :bin_dir => File.join(path, RbConfig::CONFIG['bindir'].split(File::SEPARATOR).last), + :gem_dir => File.join(path, RbConfig::CONFIG['datadir'].split(File::SEPARATOR).last, 'gems'), + :ext_dir => File.join(path, @libdir.split(File::SEPARATOR).last, 'gems') + } + else + { + :bin_dir => '', + :gem_dir => '', + :ext_dir => '' + } + end + + hash + end end ## diff --git a/ruby.spec b/ruby.spec index 461fdd0..9f0b42e 100644 --- a/ruby.spec +++ b/ruby.spec @@ -34,6 +34,7 @@ %define rdoc_ver 4.2.0 %define rubygems_ver 2.4.5.1 %define test_unit_ver 3.0.8 +%define power_assert_ver 0.2.2 %define oname ruby Summary: Ruby - interpreted scripting language @@ -45,8 +46,11 @@ Name: ruby%{ruby_suffix} Version: %{pkg_version} Release: %{rel} Epoch: 1 -# Public Domain for example for: include/ruby/st.h, strftime.c, ... -License: (Ruby or BSD) and Public Domain +# Public Domain for example for: include/ruby/st.h, strftime.c, missing/*, ... +# MIT and CCO: ccan/* +# zlib: ext/digest/md5/md5.*, ext/nkf/nkf-utf8/nkf.c +# UCD: some of enc/trans/**/*.src +License: (Ruby or BSD) and Public Domain and MIT and CC0 and zlib and UCD Group: Development/Languages # https://www.ruby-lang.org/en/downloads/ Source0: https://ftp.ruby-lang.org/pub/ruby/2.2/%{oname}-%{pkg_version}.tar.xz @@ -99,8 +103,8 @@ BuildRequires: ruby BuildRequires: ruby-modules %endif %if %{with tk} -BuildRequires: tk-devel >= 8.4 BuildRequires: tk-devel < 8.7 +BuildRequires: tk-devel >= 8.4 %endif Requires(post,postun): /sbin/ldconfig Provides: ruby(ver) = %{ruby_version} @@ -309,7 +313,8 @@ Summary(pl.UTF-8): Narzędzie do generowania dokumentacji HTML i linii poleceń Version: %{rdoc_ver} Release: %{pkg_version}.%{rel} Epoch: 0 -License: GPL v2 and Ruby and MIT +# SIL: lib/rdoc/generator/template/darkfish/css/fonts.css +License: GPLv2 and Ruby and MIT and SIL Group: Development/Libraries Requires: %{name}-irb >= %{irb_ver} Requires: %{name}-json >= %{json_ver} @@ -401,7 +406,8 @@ Summary(pl.UTF-8): Biblioteka JSON dla języka Ruby Version: %{json_ver} Release: %{pkg_version}.%{rel} Epoch: 0 -License: MIT +# UCD: ext/json/generator/generator.c +License: (Ruby or GPLv2) and UCD Group: Development/Languages Obsoletes: ruby-json-rubyforge Conflicts: ruby-modules < 1:1.9.3.429-3 @@ -412,6 +418,42 @@ This is a JSON implementation as a Ruby extension in C. %description json -l pl.UTF-8 Biblioteka JSON dla języka Ruby. +%package power_assert +# The Summary/Description fields are rather poor. +# https://github.com/k-tsj/power_assert/issues/3 +Summary: Power Assert for Ruby +Version: %{power_assert_ver} +Release: %{pkg_version}.%{rel} +Epoch: 0 +License: Ruby or BSD +Group: Development/Libraries +%if "%{_rpmversion}" >= "5" +BuildArch: noarch +%endif + +%description power_assert +Power Assert for Ruby. + +%package test-unit +# The Summary/Description fields are rather poor. +# https://github.com/test-unit/test-unit/issues/73 +Summary: Improved version of Test::Unit bundled in Ruby 1.8.x +Version: %{test_unit_ver} +Release: %{pkg_version}.%{rel} +Epoch: 0 +Group: Development/Libraries +# lib/test/unit/diff.rb is a double license of the Ruby license and PSF license. +# lib/test-unit.rb is a dual license of the Ruby license and LGPLv2.1 or later. +License: (Ruby or BSD) and (Ruby or BSD or Python) and (Ruby or BSD or LGPLv2+) +%if "%{_rpmversion}" >= "5" +BuildArch: noarch +%endif + +%description test-unit +Ruby 1.9.x bundles minitest not Test::Unit. Test::Unit bundled in Ruby +1.8.x had not been improved but unbundled Test::Unit (test-unit) is +improved actively. + %prep %setup -q -n %{oname}-%{pkg_version} -a1 -a2 -a3 %{?with_bootstrap:-a100} %patch0 -p1 @@ -419,7 +461,7 @@ Biblioteka JSON dla języka Ruby. %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p1 +#%patch5 -p1 %patch6 -p1 #%patch8 -p1 %patch9 -p1 @@ -428,6 +470,10 @@ Biblioteka JSON dla języka Ruby. # must be regenerated with new bison %{__rm} parse.{c,h} +# Remove bundled libraries to be sure they are not used. +%{__rm} -r ext/psych/yaml +%{__rm} -r ext/fiddle/libffi* + # Install custom operating_system.rb. install -d lib/rubygems/defaults cp -p %{SOURCE6} lib/rubygems/defaults @@ -557,6 +603,8 @@ for cert in \ DigiCertHighAssuranceEVRootCA.pem \ EntrustnetSecureServerCertificationAuthority.pem \ GeoTrustGlobalCA.pem \ + AddTrustExternalCARoot.pem \ + AddTrustExternalCARoot-2048.pem \ ; do %{__rm} $RPM_BUILD_ROOT%{rubygems_dir}/rubygems/ssl_certs/$cert done @@ -663,6 +711,16 @@ sed -i '/^end$/ i\ sed -i '/^end$/ i\ s.require_paths = ["lib"]' $RPM_BUILD_ROOT%{gem_dir}/specifications/minitest-%{minitest_ver}.gemspec +# Push the .gemspecs through the RubyGems to let them write the stub headers. +# This speeds up loading of libraries and avoids warnings in Spring: +# https://github.com/rubygems/rubygems/pull/694 +for s in rake-%{rake_ver}.gemspec rdoc-%{rdoc_ver}.gemspec json-%{json_ver}.gemspec; do + s="$RPM_BUILD_ROOT%{gem_dir}/specifications/$s" + %{__make} runruby TESTRUN_SCRIPT="-rubygems \ + -e \"spec = Gem::Specification.load('$s')\" \ + -e \"File.write '$s', spec.to_ruby\"" +done + ln -sf %{gem_dir}/gems/rake-%{rake_ver}/bin/rake $RPM_BUILD_ROOT%{_bindir}/rake%{ruby_suffix} %{__sed} -i -e '1s,/usr/bin/env ruby,/usr/bin/ruby,' \ @@ -700,7 +758,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(644,root,root,755) -%doc NEWS LEGAL README.md README.EXT ChangeLog +%doc NEWS LEGAL BSDL README.md README.EXT ChangeLog %attr(755,root,root) %{_bindir}/ruby%{ruby_suffix} %attr(755,root,root) %{_libdir}/libruby.so.*.*.* %attr(755,root,root) %ghost %{_libdir}/libruby.so.%{ruby_version} -- 2.43.0