perlPackages.XMLLibXML: 2.0209 -> 2.0210 and apply fix for tests

This commit is contained in:
Mrmaxmeier 2024-07-24 12:42:57 +02:00
parent 1d59cd3783
commit d954876d6b
3 changed files with 150 additions and 55 deletions

View File

@ -1,47 +0,0 @@
From 8751785951fbde48ffa16a476da3e4adb2bbcde5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 16 Jan 2023 18:50:10 -0800
Subject: [PATCH] libxml-mm: Fix function prototypes in function pointers
This is now detected with latest clang16+
Fixes
error: incompatible function pointer types passing 'void (void *, void *, xmlChar *)' (aka 'void (void *, void *, unsigned char *)') to parameter of type 'xmlHashScanner' (aka 'void (*)(void *, void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
xmlHashScan(r, PmmRegistryDumpHashScanner, NULL);
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
perl-libxml-mm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/perl-libxml-mm.c b/perl-libxml-mm.c
index a3e78a2..ec2b5ea 100644
--- a/perl-libxml-mm.c
+++ b/perl-libxml-mm.c
@@ -121,7 +121,7 @@ PmmFreeHashTable(xmlHashTablePtr table)
extern SV* PROXY_NODE_REGISTRY_MUTEX;
/* Utility method used by PmmDumpRegistry */
-void PmmRegistryDumpHashScanner(void * payload, void * data, xmlChar * name)
+void PmmRegistryDumpHashScanner(void * payload, void * data, const xmlChar * name)
{
LocalProxyNodePtr lp = (LocalProxyNodePtr) payload;
ProxyNodePtr node = (ProxyNodePtr) lp->proxy;
@@ -215,7 +215,7 @@ PmmRegisterProxyNode(ProxyNodePtr proxy)
/* PP: originally this was static inline void, but on AIX the compiler
did not chew it, so I'm removing the inline */
static void
-PmmRegistryHashDeallocator(void *payload, xmlChar *name)
+PmmRegistryHashDeallocator(void *payload, const xmlChar *name)
{
Safefree((LocalProxyNodePtr) payload);
}
@@ -279,7 +279,7 @@ PmmRegistryREFCNT_dec(ProxyNodePtr proxy)
* internal, used by PmmCloneProxyNodes
*/
void *
-PmmRegistryHashCopier(void *payload, xmlChar *name)
+PmmRegistryHashCopier(void *payload, const xmlChar *name)
{
ProxyNodePtr proxy = ((LocalProxyNodePtr) payload)->proxy;
LocalProxyNodePtr lp;

View File

@ -0,0 +1,145 @@
From bee8338fd1cbd7aad4bf60c2965833343b6ead6f Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
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(-)
diff --git a/t/02parse.t b/t/02parse.t
index b111507b..40aa5f13 100644
--- a/t/02parse.t
+++ b/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);
diff --git a/t/08findnodes.t b/t/08findnodes.t
index 016c85a1..e9417bc5 100644
--- a/t/08findnodes.t
+++ b/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;
diff --git a/t/19die_on_invalid_utf8_rt_58848.t b/t/19die_on_invalid_utf8_rt_58848.t
index aa8ad105..4160cb27 100644
--- a/t/19die_on_invalid_utf8_rt_58848.t
+++ b/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.',
);
}
diff --git a/t/25relaxng.t b/t/25relaxng.t
index 93e61883..71383b2a 100644
--- a/t/25relaxng.t
+++ b/t/25relaxng.t
@@ -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 ) };
# 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 works\n";
</grammar>
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.' );
}
diff --git a/t/26schema.t b/t/26schema.t
index 17f641e4..c404cedd 100644
--- a/t/26schema.t
+++ b/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
</xsd:schema>
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.' );
}
diff --git a/t/60error_prev_chain.t b/t/60error_prev_chain.t
index e48215c4..55ac0b2e 100644
--- a/t/60error_prev_chain.t
+++ b/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('<doc>&ldquo;&nbsp;&rdquo;</doc>');
};
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

View File

@ -28572,21 +28572,18 @@ with self; {
XMLLibXML = buildPerlPackage {
pname = "XML-LibXML";
version = "2.0209";
version = "2.0210";
src = fetchurl {
url = "mirror://cpan/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0209.tar.gz";
hash = "sha256-tKWrvNaJqi+7yLe0UznpYcSYTkgQhJTrbCgrR0giJCU=";
url = "mirror://cpan/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0210.tar.gz";
hash = "sha256-opvz8Aq5ye4EIYFU4K/I95m/I2dOuZwantTeH0BZpI0=";
};
SKIP_SAX_INSTALL = 1;
buildInputs = [ AlienBuild AlienLibxml2 ]
++ lib.optionals stdenv.isDarwin (with pkgs; [ libiconv zlib ]);
patches = [
../development/perl-modules/XML-LibXML-clang16.patch
# https://github.com/shlomif/perl-XML-LibXML/pull/87
../development/perl-modules/XML-LibXML-fix-tests-libxml-2.13.0.patch
];
# Remove test that fails after LibXML 2.11 upgrade
postPatch = ''
rm t/35huge_mode.t
'';
propagatedBuildInputs = [ XMLSAX ];
meta = {
description = "Perl Binding for libxml2";