diff --git a/macros.rubygems b/macros.rubygems index 6d99ac3..45c59c4 100644 --- a/macros.rubygems +++ b/macros.rubygems @@ -10,9 +10,14 @@ %gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec %gem_docdir %{gem_dir}/doc/%{gem_name}-%{version} -# Install gem into appropriate directory. -# -n Overrides gem file name for installation. -# -d Set installation directory. + +# %gem_install - Install gem into appropriate directory. +# +# Usage: %gem_install [options] +# +# -n Overrides gem file name for installation. +# -d Set installation directory. +# %gem_install(d:n:) \ mkdir -p %{-d*}%{!?-d:.%{gem_dir}} \ \ @@ -26,6 +31,7 @@ gem install \\\ %{-n*}%{!?-n:%{gem_name}-%{version}.gem} \ %{nil} + # For rubygems packages we want to filter out any provides caused by private # libs in %%{gem_archdir}. # @@ -34,3 +40,91 @@ gem install \\\ %rubygems_default_filter %{expand: \ %global __provides_exclude_from %{?__provides_exclude_from:%{__provides_exclude_from}|}^%{gem_extdir_mri}/.*\\\\.so$ \ } + + +# The 'read' command in gemspec_add _depand gemspec_remove_dep macros is not +# essential, but it is usefull to make the sript appear in build log. + + +# %gemspec_add_dep - Add dependency into .gemspec. +# +# Usage: %gemspec_add_dep -g [options] [requirements] +# +# Add dependency named to .gemspec file. The macro adds runtime +# dependency by default. The [requirements] argument can be used to specify +# the dependency constraints more precisely. It is expected to be valid Ruby +# code. +# +# -s Overrides the default .gemspec location. +# -d Add development dependecy. +# +%gemspec_add_dep(g:s:d) \ +read -d '' gemspec_add_dep_script << 'EOR' || : \ + gemspec_file = '%{-s*}%{!?-s:./%{gem_name}.gemspec}' \ + \ + name = '%{-g*}' \ + requirements = %{*}%{!?1:nil} \ + \ + type = :%{!?-d:runtime}%{?-d:development} \ + \ + spec = Gem::Specification.load(gemspec_file) \ + abort("#{gemspec_file} is not accessible.") unless spec \ + \ + dep = spec.dependencies.detect { |d| d.type == type && d.name == name } \ + if dep \ + dep.requirement.concat requirements \ + else \ + spec.public_send "add_#{type}_dependency", name, requirements \ + end \ + File.write gemspec_file, spec.to_ruby \ +EOR\ +echo "$gemspec_add_dep_script" | ruby \ +unset -v gemspec_add_dep_script \ +%{nil} + + +# %gemspec_remove_dep - Remove dependency from .gemspec. +# +# Usage: %gemspec_remove_dep -g [options] [requirements] +# +# Remove dependency named from .gemspec file. The macro removes runtime +# dependency by default. The [requirements] argument can be used to specify +# the dependency constraints more precisely. It is expected to be valid Ruby +# code. The macro fails if these specific requirements can't be removed. +# +# -s Overrides the default .gemspec location. +# -d Remove development dependecy. +# +%gemspec_remove_dep(g:s:d) \ +read -d '' gemspec_remove_dep_script << 'EOR' || : \ + gemspec_file = '%{-s*}%{!?-s:./%{gem_name}.gemspec}' \ + \ + name = '%{-g*}' \ + requirements = %{*}%{!?1:nil} \ + \ + type = :%{!?-d:runtime}%{?-d:development} \ + \ + spec = Gem::Specification.load(gemspec_file) \ + abort("#{gemspec_file} is not accessible.") unless spec \ + \ + dep = spec.dependencies.detect { |d| d.type == type && d.name == name } \ + if dep \ + if requirements \ + requirements = Gem::Requirement.create(requirements).requirements \ + requirements.each do |r| \ + unless dep.requirement.requirements.reject! { |dependency_requirements| dependency_requirements == r } \ + abort("Requirement '#{r.first} #{r.last}' was not possible to remove for dependency '#{dep}'!") \ + end \ + end \ + spec.dependencies.delete dep if dep.requirement.requirements.empty? \ + else \ + spec.dependencies.delete dep \ + end \ + else \ + abort("Dependency '#{name}' was not found!") \ + end \ + File.write gemspec_file, spec.to_ruby \ +EOR\ +echo "$gemspec_remove_dep_script" | ruby \ +unset -v gemspec_remove_dep_script \ +%{nil} diff --git a/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch b/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch index 6f16bae..fcd4767 100644 --- a/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch +++ b/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch @@ -39,7 +39,7 @@ diff --git a/configure.in b/configure.in index 0e371e2..d4f1dcb 100644 --- a/configure.in +++ b/configure.in -@@ -4334,6 +4334,13 @@ AC_SUBST(rubyarchhdrdir)dnl +@@ -4407,6 +4407,13 @@ AC_SUBST(rubyarchhdrdir)dnl AC_SUBST(sitearchhdrdir)dnl AC_SUBST(vendorarchhdrdir)dnl diff --git a/ruby-2.1.0-Enable-configuration-of-archlibdir.patch b/ruby-2.1.0-Enable-configuration-of-archlibdir.patch index 33bd565..e9b6536 100644 --- a/ruby-2.1.0-Enable-configuration-of-archlibdir.patch +++ b/ruby-2.1.0-Enable-configuration-of-archlibdir.patch @@ -11,7 +11,7 @@ diff --git a/configure.in b/configure.in index 37d9a62..553d4d0 100644 --- a/configure.in +++ b/configure.in -@@ -3592,6 +3592,11 @@ if test ${multiarch+set}; then +@@ -3665,6 +3665,11 @@ if test ${multiarch+set}; then fi archlibdir='${libdir}/${arch}' diff --git a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch index 6661f9b..06370d1 100644 --- a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch +++ b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch @@ -14,7 +14,7 @@ diff --git a/configure.in b/configure.in index db37cd6..ce8d149 100644 --- a/configure.in +++ b/configure.in -@@ -4188,7 +4188,8 @@ AS_CASE(["$ruby_version_dir_name"], +@@ -4261,7 +4261,8 @@ AS_CASE(["$ruby_version_dir_name"], ruby_version_dir=/'${ruby_version_dir_name}' if test -z "${ruby_version_dir_name}"; then diff --git a/ruby-2.1.0-always-use-i386.patch b/ruby-2.1.0-always-use-i386.patch index 3c3fcd4..b19da44 100644 --- a/ruby-2.1.0-always-use-i386.patch +++ b/ruby-2.1.0-always-use-i386.patch @@ -11,7 +11,7 @@ diff --git a/configure.in b/configure.in index 553d4d0..03a4152 100644 --- a/configure.in +++ b/configure.in -@@ -4252,6 +4252,8 @@ AC_SUBST(vendorarchdir)dnl +@@ -4325,6 +4325,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 diff --git a/ruby-2.1.0-custom-rubygems-location.patch b/ruby-2.1.0-custom-rubygems-location.patch index 36a7711..849bc19 100644 --- a/ruby-2.1.0-custom-rubygems-location.patch +++ b/ruby-2.1.0-custom-rubygems-location.patch @@ -15,7 +15,7 @@ diff --git a/configure.in b/configure.in index 03a4152..0e371e2 100644 --- a/configure.in +++ b/configure.in -@@ -4224,6 +4224,10 @@ AC_ARG_WITH(vendorarchdir, +@@ -4297,6 +4297,10 @@ AC_ARG_WITH(vendorarchdir, [vendorarchdir=$withval], [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}]) @@ -26,7 +26,7 @@ index 03a4152..0e371e2 100644 if test "${LOAD_RELATIVE+set}"; then AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) RUBY_EXEC_PREFIX='' -@@ -4248,6 +4252,7 @@ AC_SUBST(sitearchdir)dnl +@@ -4321,6 +4325,7 @@ AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl AC_SUBST(vendorlibdir)dnl AC_SUBST(vendorarchdir)dnl diff --git a/ruby-2.3.0-ruby_version.patch b/ruby-2.3.0-ruby_version.patch index 6a13e3a..8d79c50 100644 --- a/ruby-2.3.0-ruby_version.patch +++ b/ruby-2.3.0-ruby_version.patch @@ -20,7 +20,7 @@ diff --git a/configure.in b/configure.in index db37cd6..6e73fae 100644 --- a/configure.in +++ b/configure.in -@@ -4137,9 +4137,6 @@ AS_CASE(["$target_os"], +@@ -4210,9 +4210,6 @@ AS_CASE(["$target_os"], rubyw_install_name='$(RUBYW_INSTALL_NAME)' ]) @@ -30,7 +30,7 @@ index db37cd6..6e73fae 100644 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'} AC_ARG_WITH(rubyarchprefix, AS_HELP_STRING([--with-rubyarchprefix=DIR], -@@ -4162,58 +4159,64 @@ AC_ARG_WITH(ridir, +@@ -4235,58 +4232,64 @@ AC_ARG_WITH(ridir, AC_SUBST(ridir) AC_SUBST(RI_BASE_NAME) @@ -124,7 +124,7 @@ index db37cd6..6e73fae 100644 if test "${LOAD_RELATIVE+set}"; then AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) -@@ -4230,6 +4233,7 @@ AC_SUBST(sitearchincludedir)dnl +@@ -4303,6 +4306,7 @@ AC_SUBST(sitearchincludedir)dnl AC_SUBST(arch)dnl AC_SUBST(sitearch)dnl AC_SUBST(ruby_version)dnl @@ -249,7 +249,7 @@ diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 0428bea..b6e090e 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb -@@ -963,7 +963,8 @@ def test_self_use_paths +@@ -962,7 +962,8 @@ def test_self_use_paths def test_self_user_dir parts = [@userhome, '.gem', Gem.ruby_engine] @@ -259,7 +259,7 @@ index 0428bea..b6e090e 100644 assert_equal File.join(parts), Gem.user_dir end -@@ -1090,7 +1091,7 @@ def test_self_user_home_user_drive_and_path +@@ -1089,7 +1090,7 @@ def test_self_user_home_user_drive_and_path def test_self_vendor_dir expected = File.join RbConfig::CONFIG['vendordir'], 'gems', @@ -286,7 +286,7 @@ diff --git a/configure.in b/configure.in index 6e73fae..c842725 100644 --- a/configure.in +++ b/configure.in -@@ -274,7 +274,7 @@ RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"` +@@ -275,7 +275,7 @@ RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"` RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"` AC_SUBST(RUBY_BASE_NAME) AC_SUBST(RUBYW_BASE_NAME) diff --git a/ruby-2.3.0-undef-BUILTIN_CHOOSE_EXPR_CONSTANT_P.patch b/ruby-2.3.0-undef-BUILTIN_CHOOSE_EXPR_CONSTANT_P.patch deleted file mode 100644 index da7e980..0000000 --- a/ruby-2.3.0-undef-BUILTIN_CHOOSE_EXPR_CONSTANT_P.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 98e565ec78cb4a07ffde8589ac4581fca31e9c17 Mon Sep 17 00:00:00 2001 -From: mrkn -Date: Thu, 7 Jan 2016 13:35:32 +0000 -Subject: [PATCH] * ruby.h: undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P - and HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P on C++. [ruby-core:72736] - [Bug #11962] - -git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e ---- - ChangeLog | 6 ++++++ - include/ruby/ruby.h | 7 +++++++ - 2 files changed, 13 insertions(+) - -diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h -index 7aabf5b..82dca14 100644 ---- a/include/ruby/ruby.h -+++ b/include/ruby/ruby.h -@@ -26,6 +26,13 @@ extern "C" { - #include RUBY_EXTCONF_H - #endif - -+#if defined(__cplusplus) -+/* __builtin_choose_expr and __builtin_types_compatible aren't available -+ * on C++. See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ -+# undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P -+# undef HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P -+#endif -+ - #include "defines.h" - - #define NORETURN_STYLE_NEW 1 diff --git a/ruby-2.3.3-Revert-use-frozen-strings-in-serialized-specs.patch b/ruby-2.3.3-Revert-use-frozen-strings-in-serialized-specs.patch new file mode 100644 index 0000000..5647460 --- /dev/null +++ b/ruby-2.3.3-Revert-use-frozen-strings-in-serialized-specs.patch @@ -0,0 +1,245 @@ +From b073f9af733254ea14111f6a9a6785acdbba8fd7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= +Date: Thu, 1 Dec 2016 12:10:00 +0100 +Subject: [PATCH] Revert "use frozen strings in serialized specs" + +This reverts commit 8eda3272d28010c768a05620de776e5a8195c1ae. +--- + lib/rubygems/specification.rb | 8 +-- + test/rubygems/test_gem_specification.rb | 120 ++++++++++++++++---------------- + 2 files changed, 64 insertions(+), 64 deletions(-) + +diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb +index 7128532..654996a 100644 +--- a/lib/rubygems/specification.rb ++++ b/lib/rubygems/specification.rb +@@ -2335,7 +2335,7 @@ class Gem::Specification < Gem::BasicSpecification + + def ruby_code(obj) + case obj +- when String then obj.dump + ".freeze" ++ when String then obj.dump + when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']' + when Hash then + seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" } +@@ -2525,14 +2525,14 @@ class Gem::Specification < Gem::BasicSpecification + dependencies.each do |dep| + req = dep.requirements_list.inspect + dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK +- result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})" ++ result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{req})" + end + + result << " else" + + dependencies.each do |dep| + version_reqs_param = dep.requirements_list.inspect +- result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})" ++ result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})" + end + + result << ' end' +@@ -2540,7 +2540,7 @@ class Gem::Specification < Gem::BasicSpecification + result << " else" + dependencies.each do |dep| + version_reqs_param = dep.requirements_list.inspect +- result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})" ++ result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})" + end + result << " end" + end +diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb +index dc7b134..204e100 100644 +--- a/test/rubygems/test_gem_specification.rb ++++ b/test/rubygems/test_gem_specification.rb +@@ -2284,30 +2284,30 @@ dependencies: [] + # stub: a 2 ruby lib\0other + + Gem::Specification.new do |s| +- s.name = "a".freeze ++ s.name = "a" + s.version = "2" + +- s.required_rubygems_version = Gem::Requirement.new(\"> 0\".freeze) if s.respond_to? :required_rubygems_version= +- s.require_paths = ["lib".freeze, "other".freeze] +- s.authors = ["A User".freeze] ++ s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version= ++ s.require_paths = ["lib", "other"] ++ s.authors = ["A User"] + s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}" +- s.description = "This is a test description".freeze +- s.email = "example@example.com".freeze +- s.files = ["lib/code.rb".freeze] +- s.homepage = "http://example.com".freeze +- s.rubygems_version = "#{Gem::VERSION}".freeze +- s.summary = "this is a summary".freeze ++ s.description = "This is a test description" ++ s.email = "example@example.com" ++ s.files = ["lib/code.rb"] ++ s.homepage = "http://example.com" ++ s.rubygems_version = "#{Gem::VERSION}" ++ s.summary = "this is a summary" + + if s.respond_to? :specification_version then + s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION} + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then +- s.add_runtime_dependency(%q.freeze, [\"= 1\"]) ++ s.add_runtime_dependency(%q, [\"= 1\"]) + else +- s.add_dependency(%q.freeze, [\"= 1\"]) ++ s.add_dependency(%q, [\"= 1\"]) + end + else +- s.add_dependency(%q.freeze, [\"= 1\"]) ++ s.add_dependency(%q, [\"= 1\"]) + end + end + SPEC +@@ -2333,18 +2333,18 @@ end + # stub: a 2 ruby lib + + Gem::Specification.new do |s| +- s.name = "a".freeze ++ s.name = "a" + s.version = "2" + +- s.required_rubygems_version = Gem::Requirement.new(\"> 0\".freeze) if s.respond_to? :required_rubygems_version= +- s.require_paths = ["lib".freeze] +- s.authors = ["A User".freeze] ++ s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version= ++ s.require_paths = ["lib"] ++ s.authors = ["A User"] + s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}" +- s.description = "This is a test description".freeze +- s.email = "example@example.com".freeze +- s.homepage = "http://example.com".freeze +- s.rubygems_version = "#{Gem::VERSION}".freeze +- s.summary = "this is a summary".freeze ++ s.description = "This is a test description" ++ s.email = "example@example.com" ++ s.homepage = "http://example.com" ++ s.rubygems_version = "#{Gem::VERSION}" ++ s.summary = "this is a summary" + + s.installed_by_version = "#{Gem::VERSION}" if s.respond_to? :installed_by_version + +@@ -2352,12 +2352,12 @@ Gem::Specification.new do |s| + s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION} + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then +- s.add_runtime_dependency(%q.freeze, [\"= 1\"]) ++ s.add_runtime_dependency(%q, [\"= 1\"]) + else +- s.add_dependency(%q.freeze, [\"= 1\"]) ++ s.add_dependency(%q, [\"= 1\"]) + end + else +- s.add_dependency(%q.freeze, [\"= 1\"]) ++ s.add_dependency(%q, [\"= 1\"]) + end + end + SPEC +@@ -2389,43 +2389,43 @@ end + # stub: #{extensions} + + Gem::Specification.new do |s| +- s.name = "a".freeze ++ s.name = "a" + s.version = "1" + s.platform = Gem::Platform.new(#{expected_platform}) + +- s.required_rubygems_version = Gem::Requirement.new(\">= 0\".freeze) if s.respond_to? :required_rubygems_version= +- s.require_paths = ["lib".freeze] +- s.authors = ["A User".freeze] ++ s.required_rubygems_version = Gem::Requirement.new(\">= 0\") if s.respond_to? :required_rubygems_version= ++ s.require_paths = ["lib"] ++ s.authors = ["A User"] + s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}" +- s.description = "This is a test description".freeze +- s.email = "example@example.com".freeze +- s.executables = ["exec".freeze] +- s.extensions = ["ext/a/extconf.rb".freeze] +- s.files = ["bin/exec".freeze, "ext/a/extconf.rb".freeze, "lib/code.rb".freeze, "test/suite.rb".freeze] +- s.homepage = "http://example.com".freeze +- s.licenses = ["MIT".freeze] +- s.requirements = ["A working computer".freeze] +- s.rubyforge_project = "example".freeze +- s.rubygems_version = "#{Gem::VERSION}".freeze +- s.summary = "this is a summary".freeze +- s.test_files = ["test/suite.rb".freeze] ++ s.description = "This is a test description" ++ s.email = "example@example.com" ++ s.executables = ["exec"] ++ s.extensions = ["ext/a/extconf.rb"] ++ s.files = ["bin/exec", "ext/a/extconf.rb", "lib/code.rb", "test/suite.rb"] ++ s.homepage = "http://example.com" ++ s.licenses = ["MIT"] ++ s.requirements = ["A working computer"] ++ s.rubyforge_project = "example" ++ s.rubygems_version = "#{Gem::VERSION}" ++ s.summary = "this is a summary" ++ s.test_files = ["test/suite.rb"] + + if s.respond_to? :specification_version then + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then +- s.add_runtime_dependency(%q.freeze, [\"> 0.4\"]) +- s.add_runtime_dependency(%q.freeze, [\"> 0.0.0\"]) +- s.add_runtime_dependency(%q.freeze, [\"<= 0.6\", \"> 0.4\"]) ++ s.add_runtime_dependency(%q, [\"> 0.4\"]) ++ s.add_runtime_dependency(%q, [\"> 0.0.0\"]) ++ s.add_runtime_dependency(%q, [\"<= 0.6\", \"> 0.4\"]) + else +- s.add_dependency(%q.freeze, [\"> 0.4\"]) +- s.add_dependency(%q.freeze, [\"> 0.0.0\"]) +- s.add_dependency(%q.freeze, [\"<= 0.6\", \"> 0.4\"]) ++ s.add_dependency(%q, [\"> 0.4\"]) ++ s.add_dependency(%q, [\"> 0.0.0\"]) ++ s.add_dependency(%q, [\"<= 0.6\", \"> 0.4\"]) + end + else +- s.add_dependency(%q.freeze, [\"> 0.4\"]) +- s.add_dependency(%q.freeze, [\"> 0.0.0\"]) +- s.add_dependency(%q.freeze, [\"<= 0.6\", \"> 0.4\"]) ++ s.add_dependency(%q, [\"> 0.4\"]) ++ s.add_dependency(%q, [\"> 0.0.0\"]) ++ s.add_dependency(%q, [\"<= 0.6\", \"> 0.4\"]) + end + end + SPEC +@@ -3294,20 +3294,20 @@ Did you mean 'Ruby'? + # stub: m 1 ruby lib + + Gem::Specification.new do |s| +- s.name = "m".freeze ++ s.name = "m" + s.version = "1" + +- s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= ++ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.metadata = { "one" => "two", "two" => "three" } if s.respond_to? :metadata= +- s.require_paths = ["lib".freeze] +- s.authors = ["A User".freeze] ++ s.require_paths = ["lib"] ++ s.authors = ["A User"] + s.date = "#{Gem::Specification::TODAY.strftime("%Y-%m-%d")}" +- s.description = "This is a test description".freeze +- s.email = "example@example.com".freeze +- s.files = ["lib/code.rb".freeze] +- s.homepage = "http://example.com".freeze +- s.rubygems_version = "#{Gem::VERSION}".freeze +- s.summary = "this is a summary".freeze ++ s.description = "This is a test description" ++ s.email = "example@example.com" ++ s.files = ["lib/code.rb"] ++ s.homepage = "http://example.com" ++ s.rubygems_version = "#{Gem::VERSION}" ++ s.summary = "this is a summary" + end + EOF + +-- +2.10.2 + diff --git a/ruby-2.3.4-remove-the-encryption-key-initialization.patch b/ruby-2.3.4-remove-the-encryption-key-initialization.patch new file mode 100644 index 0000000..99931e8 --- /dev/null +++ b/ruby-2.3.4-remove-the-encryption-key-initialization.patch @@ -0,0 +1,170 @@ +From 739782e37a6662fea379e7ef3ec89e851b04b46c Mon Sep 17 00:00:00 2001 +From: usa +Date: Wed, 5 Jul 2017 07:06:45 +0000 +Subject: [PATCH] * ext/openssl/ossl_cipher.c: remove the encryption key + initialization from Cipher#initialize. This is effectively a revert of + r32723 ("Avoid possible SEGV from AES encryption/decryption", 2011-07-28). + the patch is derived from + https://github.com/ruby/openssl/commit/8108e0a6db133f3375608303fdd2083eb5115062, + written by Kazuki Yamaguchi. [Backport #8221] + +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e +--- + ChangeLog | 9 +++++++++ + ext/openssl/ossl_cipher.c | 23 ++++++++++++++--------- + test/openssl/test_cipher.rb | 29 +++++++++++++++++++++++------ + version.h | 6 +++--- + 3 files changed, 46 insertions(+), 15 deletions(-) + +diff --git a/ChangeLog b/ChangeLog +index 33b9dbe79fef..ad89c9c4bd52 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,12 @@ ++Wed Jul 5 15:55:35 2017 NAKAMURA Usaku ++ ++ * ext/openssl/ossl_cipher.c: remove the encryption key initialization ++ from Cipher#initialize. This is effectively a revert of r32723 ++ ("Avoid possible SEGV from AES encryption/decryption", 2011-07-28). ++ the patch is derived from https://github.com/ruby/openssl/commit/8108e0a6db133f3375608303fdd2083eb5115062, ++ written by Kazuki Yamaguchi. ++ [Backport #8221] ++ + Wed Mar 29 23:47:31 2017 CHIKANAGA Tomoyuki + + * hash.c (any_hash): fix CI failure on L32LLP64 architecture. +diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c +index 09b021d9873a..24caba6e3721 100644 +--- a/ext/openssl/ossl_cipher.c ++++ b/ext/openssl/ossl_cipher.c +@@ -34,6 +34,7 @@ + */ + VALUE cCipher; + VALUE eCipherError; ++static ID id_key_set; + + static VALUE ossl_cipher_alloc(VALUE klass); + static void ossl_cipher_free(void *ptr); +@@ -114,7 +115,6 @@ ossl_cipher_initialize(VALUE self, VALUE str) + EVP_CIPHER_CTX *ctx; + const EVP_CIPHER *cipher; + char *name; +- unsigned char key[EVP_MAX_KEY_LENGTH]; + + name = StringValuePtr(str); + GetCipherInit(self, ctx); +@@ -126,14 +126,7 @@ ossl_cipher_initialize(VALUE self, VALUE str) + if (!(cipher = EVP_get_cipherbyname(name))) { + ossl_raise(rb_eRuntimeError, "unsupported cipher algorithm (%s)", name); + } +- /* +- * The EVP which has EVP_CIPH_RAND_KEY flag (such as DES3) allows +- * uninitialized key, but other EVPs (such as AES) does not allow it. +- * Calling EVP_CipherUpdate() without initializing key causes SEGV so we +- * set the data filled with "\0" as the key by default. +- */ +- memset(key, 0, EVP_MAX_KEY_LENGTH); +- if (EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, -1) != 1) ++ if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, -1) != 1) + ossl_raise(eCipherError, NULL); + + return self; +@@ -252,6 +245,9 @@ ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode) + ossl_raise(eCipherError, NULL); + } + ++ if (p_key) ++ rb_ivar_set(self, id_key_set, Qtrue); ++ + return self; + } + +@@ -338,6 +334,8 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self) + OPENSSL_cleanse(key, sizeof key); + OPENSSL_cleanse(iv, sizeof iv); + ++ rb_ivar_set(self, id_key_set, Qtrue); ++ + return Qnil; + } + +@@ -391,6 +389,9 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self) + + rb_scan_args(argc, argv, "11", &data, &str); + ++ if (!RTEST(rb_attr_get(self, id_key_set))) ++ ossl_raise(eCipherError, "key not set"); ++ + StringValue(data); + in = (unsigned char *)RSTRING_PTR(data); + if ((in_len = RSTRING_LEN(data)) == 0) +@@ -490,6 +491,8 @@ ossl_cipher_set_key(VALUE self, VALUE key) + if (EVP_CipherInit_ex(ctx, NULL, NULL, (unsigned char *)RSTRING_PTR(key), NULL, -1) != 1) + ossl_raise(eCipherError, NULL); + ++ rb_ivar_set(self, id_key_set, Qtrue); ++ + return key; + } + +@@ -1008,4 +1011,6 @@ Init_ossl_cipher(void) + rb_define_method(cCipher, "iv_len", ossl_cipher_iv_length, 0); + rb_define_method(cCipher, "block_size", ossl_cipher_block_size, 0); + rb_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1); ++ ++ id_key_set = rb_intern_const("key_set"); + } +diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb +index 89c176f4de41..95058b5f196b 100644 +--- a/test/openssl/test_cipher.rb ++++ b/test/openssl/test_cipher.rb +@@ -81,6 +81,7 @@ def test_reset + + def test_empty_data + @c1.encrypt ++ @c1.random_key + assert_raise(ArgumentError){ @c1.update("") } + end + +@@ -129,12 +130,10 @@ def test_AES + } + end + +- def test_AES_crush +- 500.times do +- assert_nothing_raised("[Bug #2768]") do +- # it caused OpenSSL SEGV by uninitialized key +- OpenSSL::Cipher::AES128.new("ECB").update "." * 17 +- end ++ def test_update_raise_if_key_not_set ++ assert_raise(OpenSSL::Cipher::CipherError) do ++ # it caused OpenSSL SEGV by uninitialized key [Bug #2768] ++ OpenSSL::Cipher::AES128.new("ECB").update "." * 17 + end + end + end +@@ -236,6 +235,24 @@ def test_aes_gcm_wrong_ciphertext + end + end + ++ def test_aes_gcm_key_iv_order_issue ++ pt = "[ruby/openssl#49]" ++ cipher = OpenSSL::Cipher.new("aes-128-gcm").encrypt ++ cipher.key = "x" * 16 ++ cipher.iv = "a" * 12 ++ ct1 = cipher.update(pt) << cipher.final ++ tag1 = cipher.auth_tag ++ ++ cipher = OpenSSL::Cipher.new("aes-128-gcm").encrypt ++ cipher.iv = "a" * 12 ++ cipher.key = "x" * 16 ++ ct2 = cipher.update(pt) << cipher.final ++ tag2 = cipher.auth_tag ++ ++ assert_equal ct1, ct2 ++ assert_equal tag1, tag2 ++ end if has_cipher?("aes-128-gcm") ++ + end + + private diff --git a/ruby-2.4.0-SMTP-injection-fix.patch b/ruby-2.4.0-SMTP-injection-fix.patch new file mode 100644 index 0000000..569c69b --- /dev/null +++ b/ruby-2.4.0-SMTP-injection-fix.patch @@ -0,0 +1,122 @@ +From ea7b67981156f3eaee8420bb34c49605573387a5 Mon Sep 17 00:00:00 2001 +From: shugo +Date: Wed, 8 Jun 2016 07:06:57 +0000 +Subject: [PATCH] Security: backport SMTP injection fix + +* lib/net/smtp.rb (getok, get_response): raise an ArgumentError when +CR or LF is included in a line, because they are not allowed in +RFC5321. + +https://hackerone.com/reports/137631 +--- + ChangeLog | 6 ++++++ + lib/net/smtp.rb | 9 +++++++++ + test/net/smtp/test_smtp.rb | 47 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 62 insertions(+) + +diff --git a/ChangeLog b/ChangeLog +index ab9a6bf18281..5176d362881b 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,9 @@ ++Sun Jun 11 21:25:09 2017 Shugo Maeda ++ ++ * lib/net/smtp.rb (getok, get_response): raise an ArgumentError when ++ CR or LF is included in a line, because they are not allowed in ++ RFC5321. https://hackerone.com/reports/137631 [Backport 0827a7e] ++ + Wed Jul 5 15:55:35 2017 NAKAMURA Usaku + + * ext/openssl/ossl_cipher.c: remove the encryption key initialization +diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb +index d634274c3ee8..78f2181d2a8b 100644 +--- a/lib/net/smtp.rb ++++ b/lib/net/smtp.rb +@@ -926,7 +926,15 @@ def quit + + private + ++ def validate_line(line) ++ # A bare CR or LF is not allowed in RFC5321. ++ if /[\r\n]/ =~ line ++ raise ArgumentError, "A line must not contain CR or LF" ++ end ++ end ++ + def getok(reqline) ++ validate_line reqline + res = critical { + @socket.writeline reqline + recv_response() +@@ -936,6 +944,7 @@ def getok(reqline) + end + + def get_response(reqline) ++ validate_line reqline + @socket.writeline reqline + recv_response() + end +diff --git a/test/net/smtp/test_smtp.rb b/test/net/smtp/test_smtp.rb +index 0edb3419d56e..3bcceb6fc5bb 100644 +--- a/test/net/smtp/test_smtp.rb ++++ b/test/net/smtp/test_smtp.rb +@@ -6,6 +6,8 @@ + module Net + class TestSMTP < Test::Unit::TestCase + class FakeSocket ++ attr_reader :write_io ++ + def initialize out = "250 OK\n" + @write_io = StringIO.new + @read_io = StringIO.new out +@@ -51,5 +53,50 @@ def test_rset + + assert smtp.rset + end ++ ++ def test_mailfrom ++ sock = FakeSocket.new ++ smtp = Net::SMTP.new 'localhost', 25 ++ smtp.instance_variable_set :@socket, sock ++ assert smtp.mailfrom("foo@example.com").success? ++ assert_equal "MAIL FROM:\r\n", sock.write_io.string ++ end ++ ++ def test_rcptto ++ sock = FakeSocket.new ++ smtp = Net::SMTP.new 'localhost', 25 ++ smtp.instance_variable_set :@socket, sock ++ assert smtp.rcptto("foo@example.com").success? ++ assert_equal "RCPT TO:\r\n", sock.write_io.string ++ end ++ ++ def test_auth_plain ++ sock = FakeSocket.new ++ smtp = Net::SMTP.new 'localhost', 25 ++ smtp.instance_variable_set :@socket, sock ++ assert smtp.auth_plain("foo", "bar").success? ++ assert_equal "AUTH PLAIN AGZvbwBiYXI=\r\n", sock.write_io.string ++ end ++ ++ def test_crlf_injection ++ smtp = Net::SMTP.new 'localhost', 25 ++ smtp.instance_variable_set :@socket, FakeSocket.new ++ ++ assert_raise(ArgumentError) do ++ smtp.mailfrom("foo\r\nbar") ++ end ++ ++ assert_raise(ArgumentError) do ++ smtp.mailfrom("foo\rbar") ++ end ++ ++ assert_raise(ArgumentError) do ++ smtp.mailfrom("foo\nbar") ++ end ++ ++ assert_raise(ArgumentError) do ++ smtp.rcptto("foo\r\nbar") ++ end ++ end + end + end diff --git a/ruby.spec b/ruby.spec index 0607822..060a713 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,6 +1,6 @@ %global major_version 2 %global minor_version 3 -%global teeny_version 0 +%global teeny_version 4 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -21,7 +21,7 @@ %endif -%global release 54 +%global release 63 %{!?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 @@ -29,8 +29,8 @@ %global rubygems_dir %{_datadir}/rubygems # Bundled libraries versions -%global rubygems_version 2.5.1 -%global molinillo_version 0.4.0 +%global rubygems_version 2.5.2 +%global molinillo_version 0.4.1 # TODO: The IRB has strange versioning. Keep the Ruby's versioning ATM. # http://redmine.ruby-lang.org/issues/5313 @@ -40,9 +40,9 @@ %global did_you_mean_version 1.0.0 %global io_console_version 0.4.5 %global json_version 1.8.3 -%global minitest_version 5.8.3 +%global minitest_version 5.8.5 %global power_assert_version 0.2.6 -%global psych_version 2.0.17 +%global psych_version 2.1.0 %global rake_version 10.4.2 %global rdoc_version 4.2.1 %global net_telnet_version 0.1.1 @@ -122,10 +122,20 @@ Patch6: ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch # Use miniruby to regenerate prelude.c. # https://bugs.ruby-lang.org/issues/10554 Patch7: ruby-2.2.3-Generate-preludes-using-miniruby.patch -# 98e565ec78cb4a07ffde8589ac4581fca31e9c17 -# https://bugs.ruby-lang.org/issues/11962 -# https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/53455 -Patch8: ruby-2.3.0-undef-BUILTIN_CHOOSE_EXPR_CONSTANT_P.patch +# Fix IV Reuse in GCM Mode (CVE-2016-7798). +# https://bugzilla.redhat.com/show_bug.cgi?id=1381527 +# https://github.com/ruby/ruby/commit/739782e37a6662fea379e7ef3ec89e851b04b46c +Patch10: ruby-2.3.4-remove-the-encryption-key-initialization.patch +# Fix SMTP command injection via CRLF sequences in RCPT TO or MAIL FROM +# commands in Net::SMTP (CVE-2015-9096). +# https://bugzilla.redhat.com/show_bug.cgi?id=1461848 +# https://github.com/ruby/ruby/pull/1647 +Patch11: ruby-2.4.0-SMTP-injection-fix.patch +# Do not freeze strings in generated .gemspec. This causes regressions +# and FTBFS in Fedora packages. This is revert of: +# https://github.com/rubygems/rubygems/commit/8eda3272d28010c768a05620de776e5a8195c1ae +# https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org/message/NLZRTNIMG7NB5V3D4PAQKQLYEKC2TQSY/ +Patch100: ruby-2.3.3-Revert-use-frozen-strings-in-serialized-specs.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -262,7 +272,9 @@ License: GPLv2 and Ruby and MIT and SIL Requires: ruby(release) Requires: ruby(rubygems) >= %{rubygems_version} Requires: ruby(irb) = %{irb_version} -Recommends: rubygem(json) >= %{json_version} +# Hardcode the dependency to keep it compatible with dependencies of the +# official rubygem-rdoc gem. +Requires: rubygem(json) >= %{json_version} Provides: rdoc = %{version}-%{release} Provides: ri = %{version}-%{release} Provides: rubygem(rdoc) = %{version}-%{release} @@ -471,7 +483,9 @@ rm -rf ext/fiddle/libffi* %patch5 -p1 %patch6 -p1 %patch7 -p1 -%patch8 -p1 +%patch10 -p1 +%patch11 -p1 +%patch100 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -531,10 +545,13 @@ for cert in \ EntrustnetSecureServerCertificationAuthority.pem \ GeoTrustGlobalCA.pem \ AddTrustExternalCARoot.pem \ - AddTrustExternalCARoot-2048.pem + AddTrustExternalCARoot-2048.pem \ + GlobalSignRootCA.pem do rm %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert done +# Ensure there is not forgotten any certificate. +test ! "$(ls -A %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/ 2>/dev/null)" # Move macros file into proper place and replace the %%{name} macro, since it # would be wrongly evaluated during build of other packages. @@ -590,6 +607,9 @@ 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}/ mv %{buildroot}%{gem_dir}/specifications/default/json-%{json_version}.gemspec %{buildroot}%{gem_dir}/specifications +ln -s %{gem_dir}/gems/json-%{json_version}/lib/json.rb %{buildroot}%{ruby_libdir}/json.rb +ln -s %{gem_dir}/gems/json-%{json_version}/lib/json %{buildroot}%{ruby_libdir}/json +ln -s %{_libdir}/gems/%{name}/json-%{json_version}/json/ %{buildroot}%{ruby_libarchdir}/json mkdir -p %{buildroot}%{gem_dir}/gems/psych-%{psych_version}/lib mkdir -p %{buildroot}%{_libdir}/gems/%{name}/psych-%{psych_version} @@ -704,6 +724,7 @@ make check TESTS="-v $DISABLE_TESTS" %{ruby_libdir}/*.rb %exclude %{ruby_libdir}/*-tk.rb %exclude %{ruby_libdir}/irb.rb +%exclude %{ruby_libdir}/json.rb %exclude %{ruby_libdir}/tcltk.rb %exclude %{ruby_libdir}/tk*.rb %exclude %{ruby_libdir}/psych.rb @@ -911,6 +932,8 @@ make check TESTS="-v $DISABLE_TESTS" %{gem_dir}/specifications/io-console-%{io_console_version}.gemspec %files -n rubygem-json +%{ruby_libdir}/json* +%{ruby_libarchdir}/json* %{_libdir}/gems/%{name}/json-%{json_version} %{gem_dir}/gems/json-%{json_version} %{gem_dir}/specifications/json-%{json_version}.gemspec @@ -952,6 +975,34 @@ make check TESTS="-v $DISABLE_TESTS" %{ruby_libdir}/tkextlib %changelog +* Tue Aug 08 2017 Vít Ondruch - 2.3.4-63 +- Update to Ruby 2.3.4. +- Fix SMTP command injection via CRLF sequences in RCPT TO or MAIL FROM + commands in Net::SMTP (rhbz#1461848). + +* Thu Jul 27 2017 Vít Ondruch - 2.3.3-62 +- Fix IV Reuse in GCM Mode (rhbz#1381527). + +* Thu Dec 01 2016 Vít Ondruch - 2.3.3-61.1 +- Do not freeze strings in generated .gemspec. + +* Tue Nov 22 2016 Vít Ondruch - 2.3.3-61 +- Update to Ruby 2.3.3. +- Exclude json.rb from ruby-libs (rhbz#1397370). + +* Fri Nov 18 2016 Vít Ondruch - 2.3.2-60 +- Update to Ruby 2.3.2. +- Add gemspec_add_dep and gemspec_remove_dep macros. + +* Tue Jul 12 2016 Vít Ondruch - 2.3.1-57 +- Make symlinks for json gem. + +* Mon May 23 2016 Vít Ondruch - 2.3.1-56 +- Requires rubygem(json) for rubygem-rdoc (rhbz#1325022). + +* Fri Apr 29 2016 Vít Ondruch - 2.3.1-55 +- Update to Ruby 2.3.1. + * Wed Feb 3 2016 Peter Robinson 2.3.0-54 - Add rubypick and rubygems requires to ruby-devel to deal with BuildRequires diff --git a/sources b/sources index f935fb7..976cfeb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -92ef54e033fb95ec9bdf7023666e5f1f ruby-2.3.0.tar.xz +SHA512 (ruby-2.3.4.tar.xz) = 9e3adc2de6703e50e75db37db2981006d4c69759929d61db6a0d63627cfe5977d0ad66d2c69d7161cfc0c0d1c2cb38e5181a06ccd2790df2f72ec25c2ad01e02