[libvirt] [PATCH] build: bump min libxml2 to 2.9.1

Daniel P. Berrangé berrange at redhat.com
Mon Jul 22 14:47:57 UTC 2019


The various distros have the following libxml2 vesions:

        CentOS 7: 2.9.1
  Debian Stretch: 2.9.4
   FreeBSD Ports: 2.9.9
Ubuntu 16.04 LTS: 2.9.3

Based on this sampling, we can reasonably bump libxml2 min
version to 2.9.1

The 'query_raw' struct field was added in version 2.6.28,
so can be assumed to exist.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 m4/virt-libxml.m4  | 18 ++----------------
 src/util/viruri.c  |  9 ---------
 tests/viruritest.c |  8 --------
 3 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/m4/virt-libxml.m4 b/m4/virt-libxml.m4
index 65012d506a..9aefbdc3f1 100644
--- a/m4/virt-libxml.m4
+++ b/m4/virt-libxml.m4
@@ -18,31 +18,17 @@ dnl <http://www.gnu.org/licenses/>.
 dnl
 
 AC_DEFUN([LIBVIRT_ARG_LIBXML], [
-  LIBVIRT_ARG_WITH([LIBXML], [libxml-2.0 (>= 2.6.0) location], [check])
+  LIBVIRT_ARG_WITH([LIBXML], [libxml-2.0 (>= 2.9.1) location], [check])
 ])
 
 AC_DEFUN([LIBVIRT_CHECK_LIBXML], [
-  LIBXML_REQUIRED="2.6.0"
+  LIBXML_REQUIRED="2.9.1"
 
   LIBVIRT_CHECK_PKG([LIBXML], [libxml-2.0], [$LIBXML_REQUIRED])
 
   if test "$with_libxml" = "no" ; then
     AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
   fi
-
-  dnl xmlURI structure has query_raw?
-  old_CFLAGS="$CFLAGS"
-  old_LIBS="$LIBS"
-  CFLAGS="$CFLAGS $LIBXML_CFLAGS"
-  LIBS="$LIBS $LIBXML_LIBS"
-
-  AC_CHECK_MEMBER([struct _xmlURI.query_raw],
-                  [AC_DEFINE([HAVE_XMLURI_QUERY_RAW], [1],
-                             [Have query_raw field in libxml2 xmlURI structure])],
-                  [], [#include <libxml/uri.h>])
-
-  CFLAGS="$old_CFLAGS"
-  LIBS="$old_LIBS"
 ])
 
 AC_DEFUN([LIBVIRT_RESULT_LIBXML], [
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 8e45a447b9..a43fe2afd4 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -183,13 +183,8 @@ virURIParse(const char *uri)
         ret->port = xmluri->port;
     if (VIR_STRDUP(ret->path, xmluri->path) < 0)
         goto error;
-#ifdef HAVE_XMLURI_QUERY_RAW
     if (VIR_STRDUP(ret->query, xmluri->query_raw) < 0)
         goto error;
-#else
-    if (VIR_STRDUP(ret->query, xmluri->query) < 0)
-        goto error;
-#endif
     if (VIR_STRDUP(ret->fragment, xmluri->fragment) < 0)
         goto error;
     if (VIR_STRDUP(ret->user, xmluri->user) < 0)
@@ -237,11 +232,7 @@ virURIFormat(virURIPtr uri)
     xmluri.server = uri->server;
     xmluri.port = uri->port;
     xmluri.path = uri->path;
-#ifdef HAVE_XMLURI_QUERY_RAW
     xmluri.query_raw = uri->query;
-#else
-    xmluri.query = uri->query;
-#endif
     xmluri.fragment = uri->fragment;
     xmluri.user = uri->user;
 
diff --git a/tests/viruritest.c b/tests/viruritest.c
index c09e5323bc..d419711135 100644
--- a/tests/viruritest.c
+++ b/tests/viruritest.c
@@ -196,23 +196,19 @@ mymain(void)
         { (char*)"foo", (char*)"two", false },
         { NULL, NULL, false },
     };
-#ifdef HAVE_XMLURI_QUERY_RAW
     virURIParam params3[] = {
         { (char*)"foo", (char*)"&one", false },
         { (char*)"bar", (char*)"&two", false },
         { NULL, NULL, false },
     };
-#endif
     virURIParam params4[] = {
         { (char*)"foo", (char*)"", false },
         { NULL, NULL, false },
     };
-#ifdef HAVE_XMLURI_QUERY_RAW
     virURIParam params5[] = {
         { (char*)"foo", (char*)"one two", false },
         { NULL, NULL, false },
     };
-#endif
     virURIParam params6[] = {
         { (char*)"foo", (char*)"one", false },
         { NULL, NULL, false },
@@ -222,16 +218,12 @@ mymain(void)
     TEST_PARAMS("foo=one&foo=two", "", params2);
     TEST_PARAMS("foo=one&&foo=two", "foo=one&foo=two", params2);
     TEST_PARAMS("foo=one;foo=two", "foo=one&foo=two", params2);
-#ifdef HAVE_XMLURI_QUERY_RAW
     TEST_PARAMS("foo=%26one&bar=%26two", "", params3);
-#endif
     TEST_PARAMS("foo", "foo=", params4);
     TEST_PARAMS("foo=", "", params4);
     TEST_PARAMS("foo=&", "foo=", params4);
     TEST_PARAMS("foo=&&", "foo=", params4);
-#ifdef HAVE_XMLURI_QUERY_RAW
     TEST_PARAMS("foo=one%20two", "", params5);
-#endif
     TEST_PARAMS("=bogus&foo=one", "foo=one", params6);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
-- 
2.21.0




More information about the libvir-list mailing list