[Pkg-libvirt-commits] [libguestfs] 09/78: builder: Disable internal parallel xzcat on RHEL 6.

Hilko Bengen bengen at moszumanska.debian.org
Fri May 9 12:55:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 30bdadf032d1c210bae6e2785277afe030d9baf4
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Sat Mar 29 14:55:01 2014 +0000

    builder: Disable internal parallel xzcat on RHEL 6.
---
 builder/pxzcat-c.c | 26 ++++++++++++++++++--------
 configure.ac       |  8 +++++++-
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/builder/pxzcat-c.c b/builder/pxzcat-c.c
index f905b31..9415995 100644
--- a/builder/pxzcat-c.c
+++ b/builder/pxzcat-c.c
@@ -36,6 +36,10 @@
 
 #include "ignore-value.h"
 
+#if HAVE_LIBLZMA
+#include <lzma.h>
+#endif
+
 #ifdef HAVE_CAML_UNIXSUPPORT_H
 #include <caml/unixsupport.h>
 #else
@@ -43,18 +47,24 @@
 extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
 #endif
 
-#ifdef HAVE_LIBLZMA
-#include <lzma.h>
+#if defined (HAVE_LIBLZMA) && \
+  defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \
+  defined (HAVE_LZMA_INDEX_STREAM_PADDING)
+#define PARALLEL_XZCAT 1
+#else
+#define PARALLEL_XZCAT 0
+#endif
 
+#if PARALLEL_XZCAT
 static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
-#endif
+#endif /* PARALLEL_XZCAT */
 
 value
 virt_builder_pxzcat (value inputfilev, value outputfilev)
 {
   CAMLparam2 (inputfilev, outputfilev);
 
-#ifdef HAVE_LIBLZMA
+#if PARALLEL_XZCAT
 
   /* Parallel implementation of xzcat (pxzcat). */
   /* XXX Make number of threads configurable? */
@@ -73,7 +83,7 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
    */
   pxzcat (inputfilev, outputfilev, nr_threads);
 
-#else
+#else /* !PARALLEL_XZCAT */
 
   /* Fallback: use regular xzcat. */
   int fd;
@@ -105,12 +115,12 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
   if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
     caml_failwith (XZCAT " program failed, see earlier error messages");
 
-#endif
+#endif /* !PARALLEL_XZCAT */
 
   CAMLreturn (Val_unit);
 }
 
-#ifdef HAVE_LIBLZMA
+#if PARALLEL_XZCAT
 
 #define DEBUG 0
 
@@ -649,4 +659,4 @@ worker_thread (void *vp)
   return &state->status;
 }
 
-#endif /* HAVE_LIBLZMA */
+#endif /* PARALLEL_XZCAT */
diff --git a/configure.ac b/configure.ac
index 5b13c1d..7e1c068 100644
--- a/configure.ac
+++ b/configure.ac
@@ -677,10 +677,16 @@ test "x$XZCAT" = "xno" && AC_MSG_ERROR([xzcat must be installed])
 AC_DEFINE_UNQUOTED([XZCAT],["$XZCAT"],[Name of xzcat program.])
 
 dnl liblzma can be used by virt-builder (optional).
-PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
+PKG_CHECK_MODULES([LIBLZMA], [liblzma], [
     AC_SUBST([LIBLZMA_CFLAGS])
     AC_SUBST([LIBLZMA_LIBS])
     AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
+
+    dnl Old lzma in RHEL 6 didn't have some APIs we need.
+    old_LIBS="$LIBS"
+    LIBS="$LIBS $LIBLZMA_LIBS"
+    AC_CHECK_FUNCS([lzma_index_stream_flags lzma_index_stream_padding])
+    LIBS="$old_LIBS"
 ],
 [AC_MSG_WARN([liblzma not found, virt-builder will be slower])])
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list