From 490a64762651ee449e38e20b8903d86958f18aee Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Jan 19 2022 14:16:07 +0000 Subject: Use upstream patch for rspec-core rspec test suite issue (Gem.win_platform? related) --- diff --git a/rubygem-aruba-2.0.0-ensure-Gem-win_platform-is-available.patch b/rubygem-aruba-2.0.0-ensure-Gem-win_platform-is-available.patch new file mode 100644 index 0000000..5827aff --- /dev/null +++ b/rubygem-aruba-2.0.0-ensure-Gem-win_platform-is-available.patch @@ -0,0 +1,74 @@ +From 01f468c61eecc83d931cb56434394770557c60c7 Mon Sep 17 00:00:00 2001 +From: Matijs van Zuijlen +Date: Sun, 16 Jan 2022 11:29:55 +0100 +Subject: [PATCH] Ensure Gem.win_platform? is available + +Even though rubygems is nearly always loaded by ruby automatically, it +is possible to avoid doing so. Therefore, to make platform detection +work, we have to require "rubygems" explicitly. +--- + lib/aruba/platforms/unix_platform.rb | 1 + + spec/aruba/platforms/unix_platform_spec.rb | 18 ++++++++++++++++++ + spec/aruba/platforms/windows_platform_spec.rb | 18 ++++++++++++++++++ + 3 files changed, 37 insertions(+) + create mode 100644 spec/aruba/platforms/unix_platform_spec.rb + create mode 100644 spec/aruba/platforms/windows_platform_spec.rb + +diff --git a/lib/aruba/platforms/unix_platform.rb b/lib/aruba/platforms/unix_platform.rb +index 2831bbb26..51f653ff9 100644 +--- a/lib/aruba/platforms/unix_platform.rb ++++ b/lib/aruba/platforms/unix_platform.rb +@@ -1,4 +1,5 @@ + require "rbconfig" ++require "rubygems" + require "pathname" + + require "aruba/aruba_path" +diff --git a/spec/aruba/platforms/unix_platform_spec.rb b/spec/aruba/platforms/unix_platform_spec.rb +new file mode 100644 +index 000000000..75718f726 +--- /dev/null ++++ b/spec/aruba/platforms/unix_platform_spec.rb +@@ -0,0 +1,18 @@ ++require "spec_helper" ++require "aruba/platforms/unix_platform" ++ ++RSpec.describe Aruba::Platforms::UnixPlatform do ++ include_context "uses aruba API" ++ ++ describe ".match?" do ++ it "works even when ruby is launched with --disable-gems and --disable-rubyopt" do ++ aruba_lib = File.expand_path("../../../lib", __dir__) ++ run_command_and_stop( ++ "ruby --disable-rubyopt --disable-gems -I#{aruba_lib}" \ ++ " -e 'require \"aruba/platforms/unix_platform\";" \ ++ " Aruba::Platforms::UnixPlatform.match?;'" ++ ) ++ expect(last_command_started).to be_successfully_executed ++ end ++ end ++end +diff --git a/spec/aruba/platforms/windows_platform_spec.rb b/spec/aruba/platforms/windows_platform_spec.rb +new file mode 100644 +index 000000000..5ae02e8ab +--- /dev/null ++++ b/spec/aruba/platforms/windows_platform_spec.rb +@@ -0,0 +1,18 @@ ++require "spec_helper" ++require "aruba/platforms/windows_platform" ++ ++RSpec.describe Aruba::Platforms::WindowsPlatform do ++ include_context "uses aruba API" ++ ++ describe ".match?" do ++ it "works even when ruby is launched with --disable-gems and --disable-rubyopt" do ++ aruba_lib = File.expand_path("../../../lib", __dir__) ++ run_command_and_stop( ++ "ruby --disable-rubyopt --disable-gems -I#{aruba_lib}" \ ++ " -e 'require \"aruba/platforms/windows_platform\";" \ ++ " Aruba::Platforms::WindowsPlatform.match?;'" ++ ) ++ expect(last_command_started).to be_successfully_executed ++ end ++ end ++end diff --git a/rubygem-aruba-2.0.0-make-rubygems-dependency-explicit.patch b/rubygem-aruba-2.0.0-make-rubygems-dependency-explicit.patch deleted file mode 100644 index f79625f..0000000 --- a/rubygem-aruba-2.0.0-make-rubygems-dependency-explicit.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- aruba-2.0.0/lib/aruba/platforms/unix_platform.rb.explicit 2021-07-27 04:28:08.000000000 +0900 -+++ aruba-2.0.0/lib/aruba/platforms/unix_platform.rb 2022-01-14 15:01:38.513634793 +0900 -@@ -1,5 +1,6 @@ - require "rbconfig" - require "pathname" -+require "rubygems" - - require "aruba/aruba_path" - diff --git a/rubygem-aruba.spec b/rubygem-aruba.spec index 7d979ad..4a95fe0 100644 --- a/rubygem-aruba.spec +++ b/rubygem-aruba.spec @@ -4,7 +4,7 @@ Summary: CLI Steps for Cucumber, hand-crafted for you in Aruba Name: rubygem-%{gem_name} Version: 2.0.0 -Release: 2%{?dist} +Release: 3%{?dist} # aruba itself is MIT # icons in templates/images are CC-BY @@ -18,8 +18,10 @@ Source1: %{name}-%{version}-testsuite.tar.gz Source2: %{gem_name}-create-test-suite-tarball.sh # Make bundler runtime dependency optional Patch1: rubygem-aruba-2.0.0-make-bundler-optional.patch -# Workaround to make rspec-core rspec test suite pass -Patch2: rubygem-aruba-2.0.0-make-rubygems-dependency-explicit.patch +# Make rspec-core rspec test suite pass +# https://github.com/cucumber/aruba/issues/852 +# https://github.com/cucumber/aruba/pull/858 +Patch2: rubygem-aruba-2.0.0-ensure-Gem-win_platform-is-available.patch BuildRequires: ruby(release) BuildRequires: rubygems-devel @@ -52,7 +54,20 @@ BuildArch: noarch Documentation for %{name} %prep -%autosetup -n %{gem_name}-%{version} -p1 -a 1 +%setup -q -n %{gem_name}-%{version} -a 1 +pushd %{gem_name}-%{version} +for f in * +do + basef=$(basename $f) + target=../${basef} + ln -sf $(pwd)/$f $target +done +# For tests +ln -sf ../lib +popd +%patch1 -p1 +%patch2 -p1 + mv ../%{gem_name}-%{version}.gemspec . # Relax childprocess dependency @@ -89,6 +104,8 @@ sed -i spec/spec_helper.rb \ -e '\@[sS]imple[Cc]ov@d' \ %{nil} +# Forcely set + env RUBYOPT=-rtime \ rspec spec @@ -159,6 +176,10 @@ popd # from .%%{gem_instdir} %doc %{gem_instdir}/CHANGELOG.md %changelog +* Wed Jan 19 2022 Mamoru TASAKA - 2.0.0-3 +- Use upstream patch for rspec-core rspec test suite issue + (Gem.win_platform? related) + * Fri Jan 14 2022 Mamoru TASAKA - 2.0.0-2 - Make bundler optional again - Workaround patch to make rspec-core test suite pass