From 33a5c8bb78515dc95c1b17c426408180f5bd4792 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Sep 14 2023 15:19:20 +0000 Subject: Use xmlSetGenericErrorFunc() rather than initGenericErrorDefaultFunc() Signed-off-by: David Cantrell --- diff --git a/rpminspect-1.11-xmlSetGenericErrorFunc.patch b/rpminspect-1.11-xmlSetGenericErrorFunc.patch new file mode 100644 index 0000000..1ac5cb1 --- /dev/null +++ b/rpminspect-1.11-xmlSetGenericErrorFunc.patch @@ -0,0 +1,68 @@ +commit 0088fa73d033b89b41265da5bdf4c1556eb1a61a +Author: David Cantrell +Date: Tue May 23 16:37:02 2023 -0400 + + Handle initGenericErrorDefaultFunc -> xmlSetGenericErrorFunc + + Newer releases of libxml have deprecated initGenericErrorDefaultFunc + in favor of xmlSetGenericErrorFunc, so make sure we handle building on + those systems. + + Signed-off-by: David Cantrell + +diff --git a/lib/inspect_xml.c b/lib/inspect_xml.c +index d646838..d046e1f 100644 +--- a/lib/inspect_xml.c ++++ b/lib/inspect_xml.c +@@ -17,6 +17,7 @@ + #include "inspect.h" + #include "rpminspect.h" + ++#ifndef _HAVE_XMLSETGENERICERRORFUNC + /* + * By default, libxml will send error messages to stderr. Turn that off for + * our purposes. +@@ -25,6 +26,7 @@ static void xml_silence_errors(void *ctx __attribute__((unused)), const char *ms + { + return; + } ++#endif + + /* + * Return true if the given file is a well-formed XML document, false otherwise. +@@ -34,13 +36,19 @@ static void xml_silence_errors(void *ctx __attribute__((unused)), const char *ms + static bool is_xml_well_formed(const char *path, char **errors) + { + static bool initialized = false; ++#ifndef _HAVE_XMLSETGENERICERRORFUNC + static xmlGenericErrorFunc silence = xml_silence_errors; ++#endif + xmlParserCtxtPtr ctxt; + xmlDocPtr doc; + bool result = true; + + if (!initialized) { ++#ifdef _HAVE_XMLSETGENERICERRORFUNC ++ xmlSetGenericErrorFunc(NULL, NULL); ++#else + initGenericErrorDefaultFunc(&silence); ++#endif + LIBXML_TEST_VERSION + initialized = true; + } +diff --git a/meson.build b/meson.build +index b5731db..e8e7d18 100644 +--- a/meson.build ++++ b/meson.build +@@ -87,6 +87,11 @@ clamav = dependency('libclamav', required : true) + icu_uc = dependency('icu-uc', required : true) + icu_io = dependency('icu-io', required : true) + ++# Check for xmlSetGenericErrorFunc in newer releases of libxml ++if cc.has_function('xmlSetGenericErrorFunc', dependencies : [ libxml ]) ++ add_project_arguments('-D_HAVE_XMLSETGENERICERRORFUNC', language : 'c') ++endif ++ + # Check for newer CURLcode in libcurl + curlinfo_src = ''' + #include diff --git a/rpminspect.spec b/rpminspect.spec index 73ff13f..3cf6a33 100644 --- a/rpminspect.spec +++ b/rpminspect.spec @@ -1,6 +1,6 @@ Name: rpminspect Version: 1.11 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Build deviation compliance tool Group: Development/Tools # librpminspect is licensed under the LGPLv3+, but 5 source files in @@ -31,6 +31,7 @@ Source0: https://github.com/rpminspect/rpminspect/releases/download/v%{ve Source1: https://github.com/rpminspect/rpminspect/releases/download/v%{version}/%{name}-%{version}.tar.xz.asc Source2: gpgkey-62977BB9C841B965.gpg Patch0: rpminspect-1.11-use-RPMTAG_NOT_FOUND-macro.patch +Patch1: rpminspect-1.11-xmlSetGenericErrorFunc.patch Requires: librpminspect%{?_isa} = %{version}-%{release} BuildRequires: meson @@ -198,6 +199,9 @@ control files. %changelog +* Thu Sep 14 2023 David Cantrell - 1.11-3 +- Use xmlSetGenericErrorFunc() rather than initGenericErrorDefaultFunc() + * Mon May 22 2023 Michal Domonkos - 1.11-2 - Use RPMTAG_NOT_FOUND macro instead of -1 (for RPM 4.19)