psss / rpms / libguestfs

Forked from rpms/libguestfs 5 years ago
Clone
Blob Blame History Raw
From 71004a0d015b4d019324ec31b88a842bcad96fef Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 22 Oct 2013 14:22:46 +0100
Subject: [PATCH] builder: Use pxzcat (optionally) to speed up xzcat step.

(cherry picked from commit d4450c6590744ab96c7e0c3b21325d1eff666f29)
---
 README             | 3 +++
 builder/builder.ml | 6 ++++--
 configure.ac       | 3 +++
 mllib/config.ml.in | 4 ++++
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/README b/README
index d9c0219..0e442e1 100644
--- a/README
+++ b/README
@@ -170,6 +170,9 @@ The full requirements are described below.
 | gpg          |             | O | Used by virt-builder for digital        |
 |              |             |   | signatures                              |
 +--------------+-------------+---+-----------------------------------------+
+| pxzcat       |             | O | Can be used by virt-builder for fast    |
+|              |             |   | uncompression of templates.             |
++--------------+-------------+---+-----------------------------------------+
 | findlib      |             | O | For the OCaml bindings.                 |
 +--------------+-------------+---+-----------------------------------------+
 | ocaml-gettext|             | O | For localizing OCaml virt-* tools.      |
diff --git a/builder/builder.ml b/builder/builder.ml
index f6d0ad9..9951e71 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -323,9 +323,11 @@ let main () =
 
       output, Some size, format, delete_output_file, do_resize, true in
 
-  (* Create xzcat command to uncompress from input to output. *)
+  (* Create xzcat/pxzcat command to uncompress from input to output. *)
   let xzcat_command input output =
-    sprintf "%s %s > %s" Config.xzcat input output
+    match Config.pxzcat with
+    | None -> sprintf "%s %s > %s" Config.xzcat input output
+    | Some pxzcat -> sprintf "%s %s -o %s" pxzcat input output
   in
 
   if not do_resize then (
diff --git a/configure.ac b/configure.ac
index 35f254d..2e35252 100644
--- a/configure.ac
+++ b/configure.ac
@@ -702,6 +702,9 @@ dnl Check for xzcat (required).
 AC_PATH_PROGS([XZCAT],[xzcat],[no])
 test "x$XZCAT" = "xno" && AC_MSG_ERROR([xzcat must be installed])
 
+dnl Check for pxzcat (optional).
+AC_PATH_PROGS([PXZCAT],[pxzcat],[no])
+
 dnl Check for QEMU for running binaries on this $host_cpu, fall
 dnl back to basic 'qemu'.  Allow the user to override it.
 qemu_system="$(
diff --git a/mllib/config.ml.in b/mllib/config.ml.in
index 129741d..5586c5c 100644
--- a/mllib/config.ml.in
+++ b/mllib/config.ml.in
@@ -20,3 +20,7 @@ let package_name = "@PACKAGE_NAME@"
 let package_version = "@PACKAGE_VERSION@"
 
 let xzcat = "@XZCAT@"
+let pxzcat =
+  match "@PXZCAT@" with
+  | "no" -> None
+  | path -> Some path
-- 
1.8.4.2