Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Mamoru TASAKA
c9d0dcda70 Backport upstream patches for test suite to support libxml2 2.9.12
behavior change
2021-06-23 22:50:47 +09:00
3 changed files with 82 additions and 19 deletions

View file

@ -0,0 +1,24 @@
From f9d72bb67bf81d0d3712134cd4ccea8a3d5a033d Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Thu, 13 May 2021 22:41:44 -0400
Subject: [PATCH] test: adjust xpath gc test to libxml2's max recursion depth
See upstream libxml2 commit 6f1470a where the recursion limit is
hardcoded to 5000 stack frames.
---
test/xml/test_xpath.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/xml/test_xpath.rb b/test/xml/test_xpath.rb
index 271412a70..fe22646ba 100644
--- a/test/xml/test_xpath.rb
+++ b/test/xml/test_xpath.rb
@@ -340,7 +340,7 @@ def name_equals(nodeset, name, *args)
# long list of long arguments, to apply GC pressure during
# ruby_funcall argument marshalling
xpath = ["//tool[name_equals(.,'hammer'"]
- 1000.times { xpath << "'unused argument #{'x' * 1000}'" }
+ 500.times { xpath << "'unused argument #{'x' * 1000}'" }
xpath << "'unused argument')]"
xpath = xpath.join(',')

View file

@ -0,0 +1,31 @@
From 9751d852c005606447dac7bb17f1a56593014583 Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Thu, 13 May 2021 22:50:39 -0400
Subject: [PATCH] test: remove low-value HTML::SAX::PushParser encoding test
---
test/html/sax/test_push_parser.rb | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/test/html/sax/test_push_parser.rb b/test/html/sax/test_push_parser.rb
index dd6425390..f83440d27 100644
--- a/test/html/sax/test_push_parser.rb
+++ b/test/html/sax/test_push_parser.rb
@@ -70,17 +70,6 @@
def test_default_options
assert_equal 0, @parser.options
end
-
- def test_broken_encoding
- skip("ultra hard to fix for pure Java version") if Nokogiri.jruby?
- @parser.options |= XML::ParseOptions::RECOVER
- # This is ISO_8859-1:
- @parser.<< "<?xml version='1.0' encoding='UTF-8'?><r>Gau\337</r>"
- @parser.finish
- assert(@parser.document.errors.size >= 1)
- assert_equal "Gau\337", @parser.document.data.join
- assert_equal [["r"], ["body"], ["html"]], @parser.document.end_elements
- end
end
end
end

View file

@ -1,7 +1,7 @@
%global mainver 1.10.10
#%%global prever .rc3
%global mainrel 1
%global mainrel 2
%global prerpmver %(echo "%{?prever}" | sed -e 's|\\.||g')
%global gem_name nokogiri
@ -24,6 +24,15 @@ Source2: nokogiri-create-full-tarball.sh
#Patch0: rubygem-nokogiri-1.5.0-allow-non-crosscompile.patch
# Shut down libxml2 version unmatching warning
Patch0: %{name}-1.6.6.4-shutdown-libxml2-warning.patch
# Backport patches for libxml2 2.9.12 behavior change...
# https://github.com/sparklemotion/nokogiri/commit/9751d852c005606447dac7bb17f1a56593014583
# A bit modified
Patch11: rubygem-nokogiri-1.11.x-remove_low-value_HTML_SAX_PushParser_encoding_test.patch
# https://github.com/sparklemotion/nokogiri/commit/f9d72bb67bf81d0d3712134cd4ccea8a3d5a033d
# A bit modified
Patch12: rubygem-nokogiri-1.11.x-adjust_xpath_gc_test_to_libxml2_s_max_recursion_depth.patch
# https://github.com/sparklemotion/nokogiri/commit/0e743c8a6d34bd4416fd986c9777b22744ad2283
#Patch13: rubygem-nokogiri-1.11.x-update_behavior_of_namespaces_in_HTML.patch
BuildRequires: ruby(release)
BuildRequires: ruby(rubygems)
##
@ -78,35 +87,30 @@ This package provides non-Gem support for %{gem_name}.
%global version %{mainver}%{?prever}
%prep
%setup -q -T -c -a 1
# Gem repack
TOPDIR=$(pwd)
mkdir tmpunpackdir
pushd tmpunpackdir
gem unpack %{SOURCE0}
cd %{gem_name}-%{version}
%setup -q -n %{gem_name}-%{version} -a 1
mv ../%{gem_name}-%{version}.gemspec .
# patches
%patch0 -p1
gem specification -l --ruby %{SOURCE0} > %{gem_name}.gemspec
cd %{gem_name}-%{version}
%patch11 -p1
%patch12 -p1
# https://github.com/sparklemotion/nokogiri/commit/0e743c8a6d34bd4416fd986c9777b22744ad2283
# skip this - we know this
sed -i test/xml/test_node.rb \
-e 's|\(test_namespace_without_an_href_on_html_node\)|\1 ; skip|'
cd ..
# remove bundled external libraries
sed -i \
-e 's|, "ports/archives/[^"][^"]*"||g' \
-e 's|, "ports/patches/[^"][^"]*"||g' \
%{gem_name}.gemspec
%{gem_name}-%{version}.gemspec
# Actually not needed when using system libraries
sed -i -e '\@mini_portile@d' %{gem_name}.gemspec
sed -i -e '\@mini_portile@d' %{gem_name}-%{version}.gemspec
# Ummm...
LANG=C.UTF-8 gem build %{gem_name}.gemspec
mv %{gem_name}-%{version}.gem $TOPDIR
popd
rm -rf tmpunpackdir
LANG=C.UTF-8 gem build %{gem_name}-%{version}.gemspec
%build
mkdir -p ./%{gem_dir}
@ -230,6 +234,10 @@ popd
%{gem_dir}/doc/%{gem_name}-%{mainver}%{?prever}/
%changelog
* Wed Jun 23 2021 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.10.10-2
- Backport upstream patches for test suite to support libxml2 2.9.12
behavior change
* Sat Aug 8 2020 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.10.10-1
- 1.10.10