From 1569bb6157ff2735b7397497f8ecb956560d486a Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Sun, 6 Aug 2023 16:56:23 +0900 Subject: [PATCH] Prefer upstream patch for the previous change --- nokogiri-pr2938-minitest-5_19.patch | 62 +++++++++++++++++++++++++++++ rubygem-nokogiri.spec | 30 ++++++-------- 2 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 nokogiri-pr2938-minitest-5_19.patch diff --git a/nokogiri-pr2938-minitest-5_19.patch b/nokogiri-pr2938-minitest-5_19.patch new file mode 100644 index 0000000..5622b55 --- /dev/null +++ b/nokogiri-pr2938-minitest-5_19.patch @@ -0,0 +1,62 @@ +From a29042b0c0dbdc1b488a97dd6d6dd88d4b583c05 Mon Sep 17 00:00:00 2001 +From: Mike Dalessio +Date: Thu, 3 Aug 2023 17:52:36 -0400 +Subject: [PATCH 2/3] style: prefer Minitest to MiniTest + +since Minitest 5.19 doesn't load it by default +--- + .github/ISSUE_TEMPLATE/1-bug-report.md | 2 +- + CONTRIBUTING.md | 2 +- + test/helper.rb | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.md b/.github/ISSUE_TEMPLATE/1-bug-report.md +index 297cd4de42..79d4bf6ff1 100644 +--- a/.github/ISSUE_TEMPLATE/1-bug-report.md ++++ b/.github/ISSUE_TEMPLATE/1-bug-report.md +@@ -32,7 +32,7 @@ Here's an example of how you might structure such a script: + require 'nokogiri' + require 'minitest/autorun' + +-class Test < MiniTest::Spec ++class Test < Minitest::Spec + describe "Node#css" do + it "should find a div using chained classes" do + html = <<~HEREDOC +diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md +index 336c9c5c14..a0f844d16e 100644 +--- a/CONTRIBUTING.md ++++ b/CONTRIBUTING.md +@@ -124,7 +124,7 @@ Note that `rake test` does not compile the native extension, and this is intenti + bundle exec rake compile test + ``` + +-To run a focused test, use MiniTest's `TESTOPTS`: ++To run a focused test, use Minitest's `TESTOPTS`: + + ``` sh + bundle exec rake compile test TESTOPTS="-n/test_last_element_child/" +diff --git a/test/helper.rb b/test/helper.rb +index ed3133c6e8..8d4569e87c 100644 +--- a/test/helper.rb ++++ b/test/helper.rb +@@ -128,7 +128,7 @@ class TestBenchmark < Minitest::BenchSpec + end + + # rubocop:disable Style/ClassVars +- class TestCase < MiniTest::Spec ++ class TestCase < Minitest::Spec + include TestBase + + COMPACT_EVERY = 20 +@@ -272,7 +272,7 @@ def assert_not_send(send_ary, m = nil) + def pending(msg) + begin + yield +- rescue MiniTest::Assertion ++ rescue Minitest::Assertion + skip("pending #{msg} [#{caller(2..2).first}]") + end + flunk("pending test unexpectedly passed: #{msg} [#{caller(1..1).first}]") + + diff --git a/rubygem-nokogiri.spec b/rubygem-nokogiri.spec index b7073f0..c4d445c 100644 --- a/rubygem-nokogiri.spec +++ b/rubygem-nokogiri.spec @@ -1,7 +1,7 @@ %global mainver 1.15.3 #%%global prever .rc4 -%global baserelease 3 +%global baserelease 4 %global prerpmver %(echo "%{?prever}" | sed -e 's|\\.||g') %global gem_name nokogiri @@ -29,6 +29,8 @@ Source1: rubygem-%{gem_name}-%{version}%{?prever}-full.tar.gz Source2: nokogiri-create-full-tarball.sh # Shut down libxml2 version unmatching warning Patch0: %{name}-1.11.0.rc4-shutdown-libxml2-warning.patch +# https://github.com/sparklemotion/nokogiri/pull/2938 +Patch1: %{gem_name}-pr2938-minitest-5_19.patch BuildRequires: ruby(release) BuildRequires: ruby(rubygems) ## @@ -76,10 +78,12 @@ This package provides non-Gem support for %{gem_name}. %prep %setup -q -n %{gem_name}-%{version} -a 1 +cp -a %{gem_name}-%{version}/{.,*} . mv ../%{gem_name}-%{version}.gemspec . # patches %patch -P0 -p1 +%patch -P1 -p1 # remove bundled external libraries sed -i \ @@ -109,11 +113,6 @@ sed -i \ gumbo-parser/src/Makefile \ -e 's|^\(CFLAGS.*=.*\)$|\1 -fPIC|' -# MiniTest 5.19+ -%if 0%{?fedora} >= 39 -grep -rl MiniTest nokogiri-*/test/ | xargs sed -i 's|MiniTest::|Minitest::|' -%endif - %build # Ummm... env LANG=C.UTF-8 gem build %{gem_name}-%{version}.gemspec @@ -170,7 +169,7 @@ do done # Copy document files from full source -cp -p %{gem_name}-%{version}/[A-Z]* %{buildroot}%{gem_instdir}/ +cp -p [A-Z]* %{buildroot}%{gem_instdir}/ # cleanups # Remove bundled gumbo parser @@ -186,10 +185,9 @@ rm -rf \ ports \ %{nil} pushd gumbo-parser -rm \ - Makefile \ - %{nil} -find src -type f | \ +find . -type f | \ + grep -v CHANGES.md | \ + grep -v THANKS | \ grep -v README.md | \ xargs rm -f @@ -205,7 +203,7 @@ export TZ="Asia/Tokyo" LANG=C.UTF-8 # Copy test files from full tarball -cp -a %{gem_name}-%{version}/test/ ./%{gem_instdir} +cp -a test/ ./%{gem_instdir} pushd ./%{gem_instdir} # Remove unneeded simplecov coverage test @@ -220,11 +218,6 @@ sed -i '/Minitest::Reporters/ s/^/#/' test/helper.rb # PPC64LE with ruby3.1 does not seem to support GC.compact %ifarch ppc64le export NOKOGIRI_TEST_GC_LEVEL=major -# F36 ruby has not implemented runtime GC compaction support yet -# c.f https://src.fedoraproject.org/rpms/ruby/pull-request/126 -%if 0%{?fedora} <= 36 -sed -i test/test_compaction.rb -e 's|skip unless GC.respond_to.*|skip|' -%endif %endif %ifarch s390x # With ruby 3.2 GC_LEVEL=compact seems to cause segfault: @@ -276,6 +269,9 @@ popd %doc %{gem_dir}/doc/%{gem_name}-%{mainver}%{?prever}/ %changelog +* Sun Aug 6 2023 Mamoru TASAKA - 1.15.3-4 +- Prefer upstream patch for the previous change + * Fri Aug 4 2023 Mamoru TASAKA - 1.15.3-3 - Support MiniTest 5.19+