From 25d5c8ca5a8bdd880072cf697cb78f6f304ca065f8f25e001eea47fe1364f81e Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Tue, 21 Jan 2025 11:55:15 +0000 Subject: [PATCH] Accepting request 1239241 from home:pmonrealgonzalez:branches:devel:languages:perl - Fix the testsuite with libxml2 version 2.13.0 and up: * github.com/shlomif/perl-XML-LibXML/pull/87 * Add perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch OBS-URL: https://build.opensuse.org/request/show/1239241 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-XML-LibXML?expand=0&rev=107 --- cpanspec.yml | 4 +- ...bXML-fix-testsuite-with-libxml2-2.13.patch | 145 ++++++++++++++++++ perl-XML-LibXML.changes | 7 + perl-XML-LibXML.spec | 5 +- 4 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch diff --git a/cpanspec.yml b/cpanspec.yml index f3683ef..9bd663c 100644 --- a/cpanspec.yml +++ b/cpanspec.yml @@ -4,8 +4,8 @@ description_paragraphs: 1 #sources: # - source1 # - source2 -#patches: -# foo.patch: -p1 +patches: + perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch: -p1 # bar.patch: preamble: |- BuildRequires: pkgconfig(libxml-2.0) >= 2.9.0 diff --git a/perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch b/perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch new file mode 100644 index 0000000..c9442ae --- /dev/null +++ b/perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch @@ -0,0 +1,145 @@ +From bee8338fd1cbd7aad4bf60c2965833343b6ead6f Mon Sep 17 00:00:00 2001 +From: Nick Wellnhofer +Date: Tue, 21 May 2024 15:17:30 +0200 +Subject: [PATCH] Fix test suite with libxml2 2.13.0 + +--- + t/02parse.t | 7 ++++++- + t/08findnodes.t | 8 +++++++- + t/19die_on_invalid_utf8_rt_58848.t | 2 +- + t/25relaxng.t | 4 ++-- + t/26schema.t | 4 ++-- + t/60error_prev_chain.t | 8 ++++---- + 6 files changed, 22 insertions(+), 11 deletions(-) + +Index: XML-LibXML-2.0210/t/02parse.t +=================================================================== +--- XML-LibXML-2.0210.orig/t/02parse.t ++++ XML-LibXML-2.0210/t/02parse.t +@@ -884,7 +884,12 @@ EOXML + eval { + $doc2 = $parser->parse_string( $xmldoc ); + }; +- isnt($@, '', "error parsing $xmldoc"); ++ # https://gitlab.gnome.org/GNOME/libxml2/-/commit/b717abdd ++ if (XML::LibXML::LIBXML_RUNTIME_VERSION() < 21300) { ++ isnt($@, '', "error parsing $xmldoc"); ++ } else { ++ is( $doc2->documentElement()->firstChild()->nodeName(), "foo" ); ++ } + + $parser->validation(1); + +Index: XML-LibXML-2.0210/t/08findnodes.t +=================================================================== +--- XML-LibXML-2.0210.orig/t/08findnodes.t ++++ XML-LibXML-2.0210/t/08findnodes.t +@@ -123,7 +123,13 @@ my $docstring = q{ + my @ns = $root->findnodes('namespace::*'); + # TEST + +-is(scalar(@ns), 2, ' TODO : Add test name' ); ++# https://gitlab.gnome.org/GNOME/libxml2/-/commit/aca16fb3 ++# fixed xmlCopyNamespace with XML namespace. ++if (XML::LibXML::LIBXML_RUNTIME_VERSION() < 21300) { ++ is(scalar(@ns), 2, ' TODO : Add test name' ); ++} else { ++ is(scalar(@ns), 3, ' TODO : Add test name' ); ++} + + # bad xpaths + # TEST:$badxpath=4; +Index: XML-LibXML-2.0210/t/19die_on_invalid_utf8_rt_58848.t +=================================================================== +--- XML-LibXML-2.0210.orig/t/19die_on_invalid_utf8_rt_58848.t ++++ XML-LibXML-2.0210/t/19die_on_invalid_utf8_rt_58848.t +@@ -16,7 +16,7 @@ use XML::LibXML; + my $err = $@; + + # TEST +- like ("$err", qr{parser error : Input is not proper UTF-8}, ++ like ("$err", qr{not proper UTF-8|Invalid bytes in character encoding}, + 'Parser error.', + ); + } +Index: XML-LibXML-2.0210/t/25relaxng.t +=================================================================== +--- XML-LibXML-2.0210.orig/t/25relaxng.t ++++ XML-LibXML-2.0210/t/25relaxng.t +@@ -132,7 +132,7 @@ print "# 6 check that no_network => 1 wo + { + my $rng = eval { XML::LibXML::RelaxNG->new( location => $netfile, no_network => 1 ) }; + # TEST +- like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' ); ++ like( $@, qr{Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' ); + # TEST + 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 + + EOF + # TEST +- like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' ); ++ like( $@, qr{Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' ); + # TEST + ok( !defined $rng, 'RNG from buffer with external import and no_network => 1 is not loaded.' ); + } +Index: XML-LibXML-2.0210/t/26schema.t +=================================================================== +--- XML-LibXML-2.0210.orig/t/26schema.t ++++ XML-LibXML-2.0210/t/26schema.t +@@ -117,7 +117,7 @@ EOF + { + my $schema = eval { XML::LibXML::Schema->new( location => $netfile, no_network => 1 ) }; + # TEST +- like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' ); ++ like( $@, qr{Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' ); + # TEST + ok( !defined $schema, 'Schema from file location with external import and no_network => 1 is not loaded.' ); + } +@@ -129,7 +129,7 @@ EOF + + EOF + # TEST +- like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' ); ++ like( $@, qr{Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' ); + # TEST + 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 +=================================================================== +--- XML-LibXML-2.0210.orig/t/60error_prev_chain.t ++++ XML-LibXML-2.0210/t/60error_prev_chain.t +@@ -16,13 +16,11 @@ use XML::LibXML; + + { + my $parser = XML::LibXML->new(); +- $parser->validation(0); +- $parser->load_ext_dtd(0); + + eval + { + local $^W = 0; +- $parser->parse_file('example/JBR-ALLENtrees.htm'); ++ $parser->parse_string('“ ”'); + }; + + my $err = $@; +@@ -31,7 +29,7 @@ use XML::LibXML; + if( $err && !ref($err) ) { + plan skip_all => 'The local libxml library does not support errors as objects to $@'; + } +- plan tests => 1; ++ plan tests => 2; + + while (defined($err) && $count < 200) + { +@@ -44,6 +42,8 @@ use XML::LibXML; + + # TEST + ok ((!$err), "Reached the end of the chain."); ++ # TEST ++ is ($count, 3, "Correct number of errors reported") + } + + =head1 COPYRIGHT & LICENSE diff --git a/perl-XML-LibXML.changes b/perl-XML-LibXML.changes index f8439e4..492d943 100644 --- a/perl-XML-LibXML.changes +++ b/perl-XML-LibXML.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jan 21 10:52:50 UTC 2025 - Pedro Monreal + +- Fix the testsuite with libxml2 version 2.13.0 and up: + * github.com/shlomif/perl-XML-LibXML/pull/87 + * Add perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch + ------------------------------------------------------------------- Wed Mar 6 11:33:51 UTC 2024 - Pedro Monreal diff --git a/perl-XML-LibXML.spec b/perl-XML-LibXML.spec index 399f23f..8a5c62b 100644 --- a/perl-XML-LibXML.spec +++ b/perl-XML-LibXML.spec @@ -1,7 +1,7 @@ # # spec file for package perl-XML-LibXML # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,7 @@ Summary: Interface to Gnome libxml2 xml parsing and DOM library URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml +Patch1: perl-XML-LibXML-fix-testsuite-with-libxml2-2.13.patch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Alien::Base::Wrapper) @@ -93,7 +94,7 @@ split into several packages which are not described in this section; unless stated otherwise, you only need to 'use XML::LibXML;' in your programs. %prep -%autosetup -n %{cpan_name}-%{version} +%autosetup -n %{cpan_name}-%{version} -p1 find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644