net-misc/FORT-validator: restore compat with older libxml2 versions

5d0270aaf228fe067d2226de9888908bb23e6a09 broke compatibility with
<dev-libs/libxml2-2.12.0 due to API changes.
Backport commits that fix previous patch.

Bug: https://bugs.gentoo.org/928331
Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
This commit is contained in:
Lucio Sauer 2024-06-05 15:06:18 +02:00
parent 625a50e4f4
commit 0e9bffaf0c
No known key found for this signature in database
GPG Key ID: 5568A2DDA60CA297
5 changed files with 34 additions and 31 deletions

View File

@ -19,7 +19,7 @@ KEYWORDS="~amd64 ~x86"
IUSE="caps test"
RESTRICT="!test? ( test )"
PATCHES="${FILESDIR}"/${PN}-1.5.4-GCC14.patch
PATCHES="${FILESDIR}"/${PN}-1.5.4-libxml2-2.12.0.patch
DEPEND="
acct-group/fort

View File

@ -19,7 +19,7 @@ KEYWORDS="~amd64 ~x86"
IUSE="caps test"
RESTRICT="!test? ( test )"
PATCHES="${FILESDIR}"/${PN}-1.5.4-GCC14.patch
PATCHES="${FILESDIR}"/${PN}-1.5.4-libxml2-2.12.0.patch
DEPEND="
acct-group/fort

View File

@ -19,7 +19,7 @@ KEYWORDS="~amd64 ~x86"
IUSE="caps test"
RESTRICT="!test? ( test )"
PATCHES="${FILESDIR}"/${PN}-1.5.4-GCC14.patch
PATCHES="${FILESDIR}"/${PN}-1.5.4-libxml2-2.12.0.patch
DEPEND="
acct-group/fort

View File

@ -1,28 +0,0 @@
https://github.com/NICMx/FORT-validator/pull/137
Since we don't manipulate any struct members, I believe we can safely take a
const xmlError * argument instead, as per libxml2's documentation .
I also believe we can drop the string-termination handling, because C strings
end with \0 and therefore ptr[strlen(ptr)-1] is always \0.
Author: Lucio Sauer <watermanpaint@posteo.net>
--- a/src/xml/relax_ng.c
+++ b/src/xml/relax_ng.c
@@ -36,14 +36,9 @@ relax_ng_log_warn(void *ctx, const char *msg, ...)
}
static void
-relax_ng_log_str_err(void *userData, xmlErrorPtr error)
+relax_ng_log_str_err(void *userData, const xmlError *error)
{
- char *ptr;
-
- ptr = error->message;
- if (ptr[strlen(ptr) - 1] == '\n')
- ptr[strlen(ptr) - 1] = '\0';
- pr_val_err("%s (at line %d)", ptr, error->line);
+ pr_val_err("%s (at line %d)", error->message, error->line);
}
/* Initialize global schema to parse RRDP files */

View File

@ -0,0 +1,31 @@
Backport commits 58a94fc..cdf9248 that enable compatibility with
>=dev-libs/libxml2-2.12.0.
Author: Lucio Sauer <watermanpaint@posteo.net>
--- a/src/xml/relax_ng.c
+++ b/src/xml/relax_ng.c
@@ -35,15 +35,17 @@ relax_ng_log_warn(void *ctx, const char *msg, ...)
VLOG_MSG(warn)
}
+/* Signature changed at libxml2 commit 61034116d0a3c8b295c6137956adc3ae55720. */
+#if LIBXML_VERSION >= 21200
+#define XMLERROR_PARAMTYPE const xmlError *
+#else
+#define XMLERROR_PARAMTYPE xmlErrorPtr
+#endif
+
static void
-relax_ng_log_str_err(void *userData, xmlErrorPtr error)
+relax_ng_log_str_err(void *userData, XMLERROR_PARAMTYPE error)
{
- char *ptr;
-
- ptr = error->message;
- if (ptr[strlen(ptr) - 1] == '\n')
- ptr[strlen(ptr) - 1] = '\0';
- pr_val_err("%s (at line %d)", ptr, error->line);
+ pr_val_err("%s (at line %d)", error->message, error->line);
}
/* Initialize global schema to parse RRDP files */