8
0

fix build with libxml2 2.14

This commit is contained in:
Petr Gajdos
2025-09-25 16:30:30 +02:00
parent 95da36a368
commit d121b27574
3 changed files with 137 additions and 29 deletions

View File

@@ -1,7 +1,7 @@
From bee8338fd1cbd7aad4bf60c2965833343b6ead6f Mon Sep 17 00:00:00 2001 From bee8338fd1cbd7aad4bf60c2965833343b6ead6f Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de> From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 21 May 2024 15:17:30 +0200 Date: Tue, 21 May 2024 15:17:30 +0200
Subject: [PATCH] Fix test suite with libxml2 2.13.0 Subject: [PATCH 1/3] Fix test suite with libxml2 2.13.0
--- ---
t/02parse.t | 7 ++++++- t/02parse.t | 7 ++++++-
@@ -12,10 +12,10 @@ Subject: [PATCH] Fix test suite with libxml2 2.13.0
t/60error_prev_chain.t | 8 ++++---- t/60error_prev_chain.t | 8 ++++----
6 files changed, 22 insertions(+), 11 deletions(-) 6 files changed, 22 insertions(+), 11 deletions(-)
Index: XML-LibXML-2.0210/t/02parse.t diff --git a/t/02parse.t b/t/02parse.t
=================================================================== index b111507b..40aa5f13 100644
--- XML-LibXML-2.0210.orig/t/02parse.t --- a/t/02parse.t
+++ XML-LibXML-2.0210/t/02parse.t +++ b/t/02parse.t
@@ -884,7 +884,12 @@ EOXML @@ -884,7 +884,12 @@ EOXML
eval { eval {
$doc2 = $parser->parse_string( $xmldoc ); $doc2 = $parser->parse_string( $xmldoc );
@@ -30,10 +30,10 @@ Index: XML-LibXML-2.0210/t/02parse.t
$parser->validation(1); $parser->validation(1);
Index: XML-LibXML-2.0210/t/08findnodes.t diff --git a/t/08findnodes.t b/t/08findnodes.t
=================================================================== index 016c85a1..e9417bc5 100644
--- XML-LibXML-2.0210.orig/t/08findnodes.t --- a/t/08findnodes.t
+++ XML-LibXML-2.0210/t/08findnodes.t +++ b/t/08findnodes.t
@@ -123,7 +123,13 @@ my $docstring = q{ @@ -123,7 +123,13 @@ my $docstring = q{
my @ns = $root->findnodes('namespace::*'); my @ns = $root->findnodes('namespace::*');
# TEST # TEST
@@ -49,10 +49,10 @@ Index: XML-LibXML-2.0210/t/08findnodes.t
# bad xpaths # bad xpaths
# TEST:$badxpath=4; # TEST:$badxpath=4;
Index: XML-LibXML-2.0210/t/19die_on_invalid_utf8_rt_58848.t diff --git a/t/19die_on_invalid_utf8_rt_58848.t b/t/19die_on_invalid_utf8_rt_58848.t
=================================================================== index aa8ad105..4160cb27 100644
--- XML-LibXML-2.0210.orig/t/19die_on_invalid_utf8_rt_58848.t --- a/t/19die_on_invalid_utf8_rt_58848.t
+++ XML-LibXML-2.0210/t/19die_on_invalid_utf8_rt_58848.t +++ b/t/19die_on_invalid_utf8_rt_58848.t
@@ -16,7 +16,7 @@ use XML::LibXML; @@ -16,7 +16,7 @@ use XML::LibXML;
my $err = $@; my $err = $@;
@@ -62,11 +62,11 @@ Index: XML-LibXML-2.0210/t/19die_on_invalid_utf8_rt_58848.t
'Parser error.', 'Parser error.',
); );
} }
Index: XML-LibXML-2.0210/t/25relaxng.t diff --git a/t/25relaxng.t b/t/25relaxng.t
=================================================================== index 93e61883..71383b2a 100644
--- XML-LibXML-2.0210.orig/t/25relaxng.t --- a/t/25relaxng.t
+++ XML-LibXML-2.0210/t/25relaxng.t +++ b/t/25relaxng.t
@@ -132,7 +132,7 @@ print "# 6 check that no_network => 1 wo @@ -132,7 +132,7 @@ print "# 6 check that no_network => 1 works\n";
{ {
my $rng = eval { XML::LibXML::RelaxNG->new( location => $netfile, no_network => 1 ) }; my $rng = eval { XML::LibXML::RelaxNG->new( location => $netfile, no_network => 1 ) };
# TEST # TEST
@@ -75,7 +75,7 @@ Index: XML-LibXML-2.0210/t/25relaxng.t
# TEST # TEST
ok( !defined $rng, 'RNG from file location with external import and no_network => 1 is not loaded.' ); ok( !defined $rng, 'RNG from file location with external import and no_network => 1 is not loaded.' );
} }
@@ -152,7 +152,7 @@ print "# 6 check that no_network => 1 wo @@ -152,7 +152,7 @@ print "# 6 check that no_network => 1 works\n";
</grammar> </grammar>
EOF EOF
# TEST # TEST
@@ -84,10 +84,10 @@ Index: XML-LibXML-2.0210/t/25relaxng.t
# TEST # TEST
ok( !defined $rng, 'RNG from buffer with external import and no_network => 1 is not loaded.' ); ok( !defined $rng, 'RNG from buffer with external import and no_network => 1 is not loaded.' );
} }
Index: XML-LibXML-2.0210/t/26schema.t diff --git a/t/26schema.t b/t/26schema.t
=================================================================== index 17f641e4..c404cedd 100644
--- XML-LibXML-2.0210.orig/t/26schema.t --- a/t/26schema.t
+++ XML-LibXML-2.0210/t/26schema.t +++ b/t/26schema.t
@@ -117,7 +117,7 @@ EOF @@ -117,7 +117,7 @@ EOF
{ {
my $schema = eval { XML::LibXML::Schema->new( location => $netfile, no_network => 1 ) }; my $schema = eval { XML::LibXML::Schema->new( location => $netfile, no_network => 1 ) };
@@ -106,10 +106,10 @@ Index: XML-LibXML-2.0210/t/26schema.t
# TEST # TEST
ok( !defined $schema, 'Schema from buffer with external import and no_network => 1 is not loaded.' ); ok( !defined $schema, 'Schema from buffer with external import and no_network => 1 is not loaded.' );
} }
Index: XML-LibXML-2.0210/t/60error_prev_chain.t diff --git a/t/60error_prev_chain.t b/t/60error_prev_chain.t
=================================================================== index e48215c4..55ac0b2e 100644
--- XML-LibXML-2.0210.orig/t/60error_prev_chain.t --- a/t/60error_prev_chain.t
+++ XML-LibXML-2.0210/t/60error_prev_chain.t +++ b/t/60error_prev_chain.t
@@ -16,13 +16,11 @@ use XML::LibXML; @@ -16,13 +16,11 @@ use XML::LibXML;
{ {
@@ -143,3 +143,101 @@ Index: XML-LibXML-2.0210/t/60error_prev_chain.t
} }
=head1 COPYRIGHT & LICENSE =head1 COPYRIGHT & LICENSE
From c9f9c2fe51173b0a00969f01b577399f1098aa47 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Thu, 13 Feb 2025 19:50:35 +0100
Subject: [PATCH 2/3] Fix test suite with libxml2 2.14.0
---
t/16docnodes.t | 7 ++++++-
t/49_load_html.t | 8 +++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/t/16docnodes.t b/t/16docnodes.t
index db7bc1fc..0b0ae005 100644
--- a/t/16docnodes.t
+++ b/t/16docnodes.t
@@ -60,7 +60,12 @@ for my $time (0 .. 2) {
$doc->setDocumentElement($node);
# TEST
- is( $node->serialize(), '<test contents="&#xE4;"/>', 'Node serialise works.' );
+ # libxml2 2.14 avoids unnecessary escaping of attribute values.
+ if (XML::LibXML::LIBXML_VERSION() >= 21400) {
+ is( $node->serialize(), "<test contents=\"\xE4\"/>", 'Node serialise works.' );
+ } else {
+ is( $node->serialize(), '<test contents="&#xE4;"/>', 'Node serialise works.' );
+ }
$doc->setEncoding('utf-8');
# Second output
diff --git a/t/49_load_html.t b/t/49_load_html.t
index 70d26607..3861edf8 100644
--- a/t/49_load_html.t
+++ b/t/49_load_html.t
@@ -52,7 +52,13 @@ use XML::LibXML;
</div>
EOS
- {
+ SKIP: {
+ # libxml2 2.14 tokenizes HTML according to HTML5 where
+ # this isn't an error, see "13.2.5.73 Named character
+ # reference state".
+ skip("libxml2 version >= 21400", 1)
+ if XML::LibXML::LIBXML_VERSION >= 21400;
+
my $buf = '';
open my $fh, '>', \$buf;
# redirect STDERR there
From ecbebc2f33fecb66b3d5487c6e48bea353e374f9 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Fri, 16 May 2025 19:11:12 +0200
Subject: [PATCH 3/3] Remove tests that disable line numbers
Line numbers are always enabled since libxml2 2.15.0.
---
t/02parse.t | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/t/02parse.t b/t/02parse.t
index 40aa5f13..17419f8f 100644
--- a/t/02parse.t
+++ b/t/02parse.t
@@ -14,7 +14,7 @@ use locale;
POSIX::setlocale(LC_ALL, "C");
-use Test::More tests => 533;
+use Test::More tests => 531;
use IO::File;
use XML::LibXML::Common qw(:libxml);
@@ -25,7 +25,7 @@ use constant XML_DECL => "<?xml version=\"1.0\"?>\n";
use Errno qw(ENOENT);
-# TEST*533
+# TEST*531
##
# test values
@@ -773,15 +773,6 @@ EOXML
my $newkid = $root->appendChild( $doc->createElement( "bar" ) );
is( $newkid->line_number(), 0, "line number is 0");
-
- $parser->line_numbers(0);
- eval { $doc = $parser->parse_string( $goodxml ); };
-
- $root = $doc->documentElement();
- is( $root->line_number(), 0, "line number is 0");
-
- @kids = $root->childNodes();
- is( $kids[1]->line_number(), 0, "line number is 0");
}
SKIP: {

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Sep 24 11:55:34 UTC 2025 - pgajdos@suse.com
- fix build with libxml2 2.14
- deleted patches
* perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch (adopted to 2.14)
- added patches
* perl-XML-LibXML-fix-testsuite-with-libxml2-2.14.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jun 24 14:33:45 UTC 2025 - Bernhard Wiedemann <bwiedemann@suse.com> Tue Jun 24 14:33:45 UTC 2025 - Bernhard Wiedemann <bwiedemann@suse.com>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package perl-XML-LibXML # spec file for package perl-XML-LibXML
# #
# Copyright (c) 2025 SUSE LLC # Copyright (c) 2025 SUSE LLC and contributors
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -26,7 +26,8 @@ URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/%{cpan_name}-%{version}.tar.gz Source0: https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml Source1: cpanspec.yml
Source100: README.md Source100: README.md
Patch1: perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch # https://github.com/shlomif/perl-XML-LibXML/pull/87
Patch1: perl-XML-LibXML-fix-testsuite-with-libxml2-2.14.patch
BuildRequires: perl BuildRequires: perl
BuildRequires: perl-macros BuildRequires: perl-macros
BuildRequires: perl(Alien::Base::Wrapper) BuildRequires: perl(Alien::Base::Wrapper)