fix build error
(cherry picked from commit 2f10c033ae34ad01d5f6e6f450cfe79f8c4858a4)
This commit is contained in:
parent
c842b6ba57
commit
b3ac0a0b58
11
Instance-vars-no-longer-emit-warnings-in-Ruby-3.patch
Normal file
11
Instance-vars-no-longer-emit-warnings-in-Ruby-3.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- rspec-support-3.8.2/spec/rspec/support/spec/stderr_splitter_spec.rb 2022-02-16 21:22:44.095853100 +0800
|
||||||
|
+++ rspec-support-3.8.2_bak/spec/rspec/support/spec/stderr_splitter_spec.rb 2022-02-16 21:21:29.934595730 +0800
|
||||||
|
@@ -88,7 +88,7 @@
|
||||||
|
|
||||||
|
unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
||||||
|
it 'will fail an example which generates a warning' do
|
||||||
|
- true unless @undefined
|
||||||
|
+ true unless $undefined
|
||||||
|
expect { splitter.verify_no_warnings! }.to raise_error(/Warnings were generated:/)
|
||||||
|
end
|
||||||
|
end
|
||||||
57
Make-usage-of-keyword-arguments-for-string.patch
Normal file
57
Make-usage-of-keyword-arguments-for-string.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From b2f4a683f163cfbb663595464caed99a09f16bd1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jon Rowe <hello@jonrowe.co.uk>
|
||||||
|
Date: Thu, 26 Dec 2019 19:58:59 +0000
|
||||||
|
Subject: [PATCH] Make usage of keyword arguments for String#encode explicit to
|
||||||
|
avoid warning on 2.7.0
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/rspec/support/encoded_string.rb | 33 +++++++++++++++++++++++++++--
|
||||||
|
1 file changed, 31 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/rspec/support/encoded_string.rb b/lib/rspec/support/encoded_string.rb
|
||||||
|
index a6ca0cb6..66f75ca1 100644
|
||||||
|
--- a/lib/rspec/support/encoded_string.rb
|
||||||
|
+++ b/lib/rspec/support/encoded_string.rb
|
||||||
|
@@ -112,11 +112,40 @@ def matching_encoding(string)
|
||||||
|
string = remove_invalid_bytes(string)
|
||||||
|
string.encode(@encoding)
|
||||||
|
rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
|
||||||
|
- string.encode(@encoding, ENCODE_UNCONVERTABLE_BYTES)
|
||||||
|
+ encode_unconvertable_bytes(string)
|
||||||
|
rescue Encoding::ConverterNotFoundError
|
||||||
|
- string.dup.force_encoding(@encoding).encode(ENCODE_NO_CONVERTER)
|
||||||
|
+ encode_no_converter(string.dup.force_encoding(@encoding))
|
||||||
|
end
|
||||||
|
|
||||||
|
+ private
|
||||||
|
+
|
||||||
|
+ # On Ruby 2.7.0 keyword arguments mixed with conventional cause a warning to
|
||||||
|
+ # be issued requiring us to be explicit by using a ** to pass the hash as
|
||||||
|
+ # keyword arguments. Any keyword argument supporting Ruby supports this.
|
||||||
|
+ if RubyFeatures.kw_args_supported?
|
||||||
|
+ # Note on non keyword supporting Ruby ** causes a syntax error hence
|
||||||
|
+ # we must use eval. To be removed in RSpec 4.
|
||||||
|
+ binding.eval(<<-CODE, __FILE__, __LINE__)
|
||||||
|
+ def encode_unconvertable_bytes(string)
|
||||||
|
+ string.encode(@encoding, **ENCODE_UNCONVERTABLE_BYTES)
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ def encode_no_converter(string)
|
||||||
|
+ string.encode(**ENCODE_NO_CONVERTER)
|
||||||
|
+ end
|
||||||
|
+ CODE
|
||||||
|
+ else
|
||||||
|
+ def encode_unconvertable_bytes(string)
|
||||||
|
+ string.encode(@encoding, ENCODE_UNCONVERTABLE_BYTES)
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ def encode_no_converter(string)
|
||||||
|
+ string.encode(ENCODE_NO_CONVERTER)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ public
|
||||||
|
+
|
||||||
|
# Prevents raising ArgumentError
|
||||||
|
if String.method_defined?(:scrub)
|
||||||
|
# https://github.com/ruby/ruby/blob/eeb05e8c11/doc/NEWS-2.1.0#L120-L123
|
||||||
@ -7,7 +7,7 @@
|
|||||||
%undefine __brp_mangle_shebangs
|
%undefine __brp_mangle_shebangs
|
||||||
Name: rubygem-%{gem_name}
|
Name: rubygem-%{gem_name}
|
||||||
Version: %{mainver}
|
Version: %{mainver}
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Common functionality to Rspec series
|
Summary: Common functionality to Rspec series
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/rspec/rspec-support
|
URL: https://github.com/rspec/rspec-support
|
||||||
@ -15,7 +15,11 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{mainver}%{?prever}.gem
|
|||||||
Source1: https://github.com/rspec/%{gem_name}/archive/v%{mainver}.tar.gz
|
Source1: https://github.com/rspec/%{gem_name}/archive/v%{mainver}.tar.gz
|
||||||
# tweak regex for search path
|
# tweak regex for search path
|
||||||
Patch100: rubygem-rspec-support-3.2.1-callerfilter-searchpath-regex.patch
|
Patch100: rubygem-rspec-support-3.2.1-callerfilter-searchpath-regex.patch
|
||||||
BuildRequires: rubygems-devel
|
#https://github.com/rspec/rspec-support/commit/b2f4a683f163cfbb663595464caed99a09f16bd1
|
||||||
|
Patch101: Make-usage-of-keyword-arguments-for-string.patch
|
||||||
|
#https://github.com/rspec/rspec-support/commit/ed32a443ffab54d3aa3b4b599e1530dfabba8be7
|
||||||
|
Patch102: Instance-vars-no-longer-emit-warnings-in-Ruby-3.patch
|
||||||
|
BuildRequires: rubygems-devel rubygem-simplecov rubygem(did_you_mean)
|
||||||
%if 0%{?need_bootstrap_set} < 1
|
%if 0%{?need_bootstrap_set} < 1
|
||||||
BuildRequires: rubygem(rspec) rubygem(thread_order) rubygem(bigdecimal) git
|
BuildRequires: rubygem(rspec) rubygem(thread_order) rubygem(bigdecimal) git
|
||||||
%endif
|
%endif
|
||||||
@ -31,13 +35,13 @@ Requires: %{name} = %{version}-%{release}
|
|||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%description doc
|
%description doc
|
||||||
Documentation for %{name}
|
Documentation for %{name}
|
||||||
%global version_orig %{version}
|
|
||||||
%global version %{version_orig}%{?prever}
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -T -n %{gem_name}-%{version} -b 1
|
%setup -q -T -n %{gem_name}-%{version} -b 1
|
||||||
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
||||||
%patch100 -p1
|
%patch100 -p1
|
||||||
|
%patch101 -p1
|
||||||
|
%patch102 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
gem build %{gem_name}.gemspec
|
gem build %{gem_name}.gemspec
|
||||||
@ -79,5 +83,8 @@ ruby -rrubygems -Ilib/ -S rspec spec/ || \
|
|||||||
%doc %{gem_docdir}
|
%doc %{gem_docdir}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 1 2022 liyanan <liyanan32@huawei.com> - 3.8.2-2
|
||||||
|
- Fix build error
|
||||||
|
|
||||||
* Tue Aug 25 2020 fanjiachen <fanjiachen3@huawei.com> - 3.8.2-1
|
* Tue Aug 25 2020 fanjiachen <fanjiachen3@huawei.com> - 3.8.2-1
|
||||||
- package init
|
- package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user