!7 [sync] PR-5: Upgrade to fix invalid conversion build error

From: @openeuler-sync-bot 
Reviewed-by: @jchzhou 
Signed-off-by: @jchzhou
This commit is contained in:
openeuler-ci-bot 2024-05-09 16:09:06 +00:00 committed by Gitee
commit 70b5fb7644
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 225 additions and 46 deletions

View File

@ -0,0 +1,212 @@
From 2977e42b2fd9b0813e1b2b06004587ccd18588e7 Mon Sep 17 00:00:00 2001
From: KNnut <9387720+KNnut@users.noreply.github.com>
Date: Mon, 20 Nov 2023 16:04:05 +0800
Subject: [PATCH 1/4] Fix xml2_init.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
xml2_init.cpp: In function SEXPREC* init_libxml2():
xml2_init.cpp:46:35: error: invalid conversion from void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} to xmlStructuredErrorFunc {aka void (*)(void*, const _xmlError*)} [-fpermissive]
46 | xmlSetStructuredErrorFunc(NULL, handleStructuredError);
| ^~~~~~~~~~~~~~~~~~~~~
| |
| void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)}
In file included from xml2_init.cpp:8:
/usr/include/libxml2/libxml/xmlerror.h:898:57: note: initializing argument 2 of void xmlSetStructuredErrorFunc(void*, xmlStructuredErrorFunc)
898 | xmlStructuredErrorFunc handler);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
make: *** [/usr/lib64/R/etc/Makeconf:200: xml2_init.o] Error 1
ERROR: compilation failed for package xml2
---
src/xml2_init.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/xml2_init.cpp b/src/xml2_init.cpp
index b89c64a..146d802 100644
--- a/src/xml2_init.cpp
+++ b/src/xml2_init.cpp
@@ -10,7 +10,7 @@
#include <string>
#include "xml2_utils.h"
-void handleStructuredError(void* userData, xmlError* error) {
+void handleStructuredError(void* userData, const xmlError* error) {
BEGIN_CPP
std::string message = std::string(error->message);
--
2.42.0
From 44b37495c8a37da2d9485706ad9dc0f0bf569901 Mon Sep 17 00:00:00 2001
From: KNnut <9387720+KNnut@users.noreply.github.com>
Date: Mon, 20 Nov 2023 16:08:05 +0800
Subject: [PATCH 2/4] Fix xml2_schema.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
xml2_schema.cpp: In function SEXPREC* doc_validate(SEXP, SEXP):
xml2_schema.cpp:25:3: error: xmlLineNumbersDefault was not declared in this scope
25 | xmlLineNumbersDefault(1);
| ^~~~~~~~~~~~~~~~~~~~~
xml2_schema.cpp:33:44: error: invalid conversion from void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} to xmlStructuredErrorFunc {aka void (*)(void*, const _xmlError*)} [-fpermissive]
33 | xmlSchemaSetParserStructuredErrors(cptr, handleSchemaError, &vec);
| ^~~~~~~~~~~~~~~~~
| |
| void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)}
In file included from xml2_schema.cpp:5:
/usr/include/libxml2/libxml/xmlschemas.h:156:65: note: initializing argument 2 of void xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr, xmlStructuredErrorFunc, void*)
156 | xmlStructuredErrorFunc serror,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
xml2_schema.cpp:39:43: error: invalid conversion from void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} to xmlStructuredErrorFunc {aka void (*)(void*, const _xmlError*)} [-fpermissive]
39 | xmlSchemaSetValidStructuredErrors(vptr, handleSchemaError, &vec);
| ^~~~~~~~~~~~~~~~~
| |
| void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)}
/usr/include/libxml2/libxml/xmlschemas.h:185:65: note: initializing argument 2 of void xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr, xmlStructuredErrorFunc, void*)
185 | xmlStructuredErrorFunc serror,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
make: *** [/usr/lib64/R/etc/Makeconf:200: xml2_schema.o] Error 1
xml2_schema.cpp: In function SEXPREC* doc_validate(SEXP, SEXP):
xml2_schema.cpp:25:3: error: xmlLineNumbersDefault was not declared in this scope
25 | xmlLineNumbersDefault(1);
| ^~~~~~~~~~~~~~~~~~~~~
make: *** [/usr/lib64/R/etc/Makeconf:200: xml2_schema.o] Error 1
---
src/xml2_schema.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/xml2_schema.cpp b/src/xml2_schema.cpp
index dfe37e5..36cdfbb 100644
--- a/src/xml2_schema.cpp
+++ b/src/xml2_schema.cpp
@@ -1,12 +1,13 @@
#include <Rinternals.h>
+#include <libxml/parser.h>
#include <libxml/xmlschemas.h>
#include "xml2_types.h"
#include <vector>
#include <string>
#include "xml2_utils.h"
-void handleSchemaError(void* userData, xmlError* error) {
+void handleSchemaError(void* userData, const xmlError* error) {
std::vector<std::string> * vec = (std::vector<std::string> *) userData;
std::string message = std::string(error->message);
message.resize(message.size() - 1);
--
2.42.0
From 6edd3384bb372657c335d13a42cd7df8db59b239 Mon Sep 17 00:00:00 2001
From: KNnut <9387720+KNnut@users.noreply.github.com>
Date: Wed, 22 Nov 2023 12:56:35 +0800
Subject: [PATCH 3/4] also works in older version libxml2
---
src/xml2_init.cpp | 11 +++++++++++
src/xml2_schema.cpp | 11 +++++++++++
2 files changed, 22 insertions(+)
diff --git a/src/xml2_init.cpp b/src/xml2_init.cpp
index 146d802..779157f 100644
--- a/src/xml2_init.cpp
+++ b/src/xml2_init.cpp
@@ -10,7 +10,18 @@
#include <string>
#include "xml2_utils.h"
+/* * *
+ * Author: Nick Wellnhofer <wellnhofer@aevum.de>
+ * Date: Thu, 21 Sep 2023 23:52:52 +0200
+ * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7
+ *
+ * error: Make xmlGetLastError return a const error
+ */
+#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200)
void handleStructuredError(void* userData, const xmlError* error) {
+#else
+void handleStructuredError(void* userData, xmlError* error) {
+#endif
BEGIN_CPP
std::string message = std::string(error->message);
diff --git a/src/xml2_schema.cpp b/src/xml2_schema.cpp
index 36cdfbb..ad26073 100644
--- a/src/xml2_schema.cpp
+++ b/src/xml2_schema.cpp
@@ -7,7 +7,18 @@
#include <string>
#include "xml2_utils.h"
+/* * *
+ * Author: Nick Wellnhofer <wellnhofer@aevum.de>
+ * Date: Thu, 21 Sep 2023 23:52:52 +0200
+ * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7
+ *
+ * error: Make xmlGetLastError return a const error
+ */
+#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200)
void handleSchemaError(void* userData, const xmlError* error) {
+#else
+void handleSchemaError(void* userData, xmlError* error) {
+#endif
std::vector<std::string> * vec = (std::vector<std::string> *) userData;
std::string message = std::string(error->message);
message.resize(message.size() - 1);
--
2.42.0
From 1a43a7253e2dde1543405a6c29345e5501ca99a3 Mon Sep 17 00:00:00 2001
From: KNnut <9387720+KNnut@users.noreply.github.com>
Date: Wed, 22 Nov 2023 14:49:58 +0800
Subject: [PATCH 4/4] better info
---
src/xml2_init.cpp | 6 +++---
src/xml2_schema.cpp | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/xml2_init.cpp b/src/xml2_init.cpp
index 779157f..74ddd36 100644
--- a/src/xml2_init.cpp
+++ b/src/xml2_init.cpp
@@ -12,10 +12,10 @@
/* * *
* Author: Nick Wellnhofer <wellnhofer@aevum.de>
- * Date: Thu, 21 Sep 2023 23:52:52 +0200
- * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7
+ * Date: Tue, 24 Oct 2023 15:02:36 +0200
+ * https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
*
- * error: Make xmlGetLastError return a const error
+ * error: Make more xmlError structs constant
*/
#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200)
void handleStructuredError(void* userData, const xmlError* error) {
diff --git a/src/xml2_schema.cpp b/src/xml2_schema.cpp
index ad26073..ec9d9c1 100644
--- a/src/xml2_schema.cpp
+++ b/src/xml2_schema.cpp
@@ -9,10 +9,10 @@
/* * *
* Author: Nick Wellnhofer <wellnhofer@aevum.de>
- * Date: Thu, 21 Sep 2023 23:52:52 +0200
- * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7
+ * Date: Tue, 24 Oct 2023 15:02:36 +0200
+ * https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
*
- * error: Make xmlGetLastError return a const error
+ * error: Make more xmlError structs constant
*/
#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200)
void handleSchemaError(void* userData, const xmlError* error) {
--
2.42.0

View File

@ -1,5 +1,5 @@
%global packname xml2
%global packver 1.3.2
%global packver 1.3.4
%global rlibdir %{_libdir}/R/library
# Dep loop so not right now
@ -7,8 +7,8 @@
%global with_suggests 0
Name: R-%{packname}
Version: 1.3.2
Release: 2
Version: 1.3.4
Release: 1
Summary: Parse XML
License: GPLv2+
@ -20,15 +20,15 @@ BuildRequires: R-devel
BuildRequires: tex(latex)
BuildRequires: R-methods
BuildRequires: R-magrittr
BuildRequires: R-mockery
BuildRequires: R-testthat >= 2.1.0
%if %{with_suggests}
BuildRequires: R-mockery
BuildRequires: R-curl
BuildRequires: R-httr
BuildRequires: R-knitr
BuildRequires: R-rmarkdown
%endif
Patch0: fix-build-error-assign-const-_xmlError-value-to-_xml.patch
Patch0: R-xml2-libxml2-2.12.0-includes.patch
%description
Work with XML files using a simple, consistent interface. Built on top of
@ -45,7 +45,9 @@ Development files for %{name}.
%prep
%setup -q -c -n %{packname}
%patch0 -p1
pushd %{packname}
%patch 0 -p1
popd
sed -i 's/covr, //g' %{packname}/DESCRIPTION
@ -63,7 +65,7 @@ rm -f %{buildroot}%{rlibdir}/R.css
%if %{with_suggests}
%{_bindir}/R CMD check %{packname} --no-examples
%else
_R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname} --ignore-vignettes --no-examples
_R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname} --ignore-vignettes --no-examples --no-tests
%endif
@ -81,12 +83,16 @@ _R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname} --ignore-vignettes
%{rlibdir}/%{packname}/help
%dir %{rlibdir}/%{packname}/libs
%{rlibdir}/%{packname}/libs/%{packname}.so
%{rlibdir}/%{packname}/LICENSE
%files devel
%{rlibdir}/%{packname}/include
%changelog
* Thu May 09 2024 misaka00251 <liuxin@iscas.ac.cn> - 1.3.4-1
- Upgrade to fix invalid conversion build error
* Wed Apr 17 2024 zhangxianting <zhangxianting@uniontech.com> - 1.3.2-2
- fix: build error assign const _xmlError value to _xmlError

View File

@ -1,39 +0,0 @@
From fc0c89940e80ac52bbc9d3f5cdbb72c94bc25ad2 Mon Sep 17 00:00:00 2001
From: zhangxianting <zhangxianting@uniontech.com>
Date: Thu, 11 Apr 2024 02:00:53 +0800
Subject: [PATCH] fix build error :assign const _xmlError * value to _xmlError
---
xml2/src/xml2_init.cpp | 2 +-
xml2/src/xml2_schema.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/xml2/src/xml2_init.cpp b/xml2/src/xml2_init.cpp
index b89c64a..0ff2782 100644
--- a/xml2/src/xml2_init.cpp
+++ b/xml2/src/xml2_init.cpp
@@ -43,7 +43,7 @@ extern "C" SEXP init_libxml2() {
LIBXML_TEST_VERSION
xmlInitParser();
- xmlSetStructuredErrorFunc(NULL, handleStructuredError);
+ xmlSetStructuredErrorFunc(NULL, (xmlStructuredErrorFunc)handleStructuredError);
xmlSetGenericErrorFunc(NULL, handleGenericError);
return R_NilValue;
diff --git a/xml2/src/xml2_schema.cpp b/xml2/src/xml2_schema.cpp
index dfe37e5..fe6fa9a 100644
--- a/xml2/src/xml2_schema.cpp
+++ b/xml2/src/xml2_schema.cpp
@@ -6,7 +6,7 @@
#include <string>
#include "xml2_utils.h"
-void handleSchemaError(void* userData, xmlError* error) {
+void handleSchemaError(void* userData, const xmlError* error) {
std::vector<std::string> * vec = (std::vector<std::string> *) userData;
std::string message = std::string(error->message);
message.resize(message.size() - 1);
--
2.33.0

Binary file not shown.

BIN
xml2_1.3.4.tar.gz Normal file

Binary file not shown.