Blame SOURCES/0033-v2v-i-ova-Prefer-pigz-or-pxz-for-uncompressing-OVA-f.patch

151578
From 3c4780cda6bfdd20d2a71857e326cc9cd2fd708c Mon Sep 17 00:00:00 2001
151578
From: "Richard W.M. Jones" <rjones@redhat.com>
151578
Date: Mon, 8 May 2017 09:55:42 +0100
151578
Subject: [PATCH] v2v: -i ova: Prefer pigz or pxz for uncompressing OVA files
151578
 (RHBZ#1448739).
151578
151578
If the parallel tools pigz or pxz are available, prefer them for
151578
uncompressing gz- and xz-compressed OVA files respectively.  If not
151578
available then gzip or xz are used as normal.
151578
---
151578
 v2v/input_ova.ml | 14 ++++++++++++--
151578
 1 file changed, 12 insertions(+), 2 deletions(-)
151578
151578
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
151578
index c91011873..69cdf576b 100644
151578
--- a/v2v/input_ova.ml
151578
+++ b/v2v/input_ova.ml
151578
@@ -40,9 +40,19 @@ let libvirt_supports_json_raw_driver () =
151578
   else
151578
     true
151578
 
151578
+let pigz_available =
151578
+  let test = lazy (shell_command "pigz --help >/dev/null 2>&1" = 0) in
151578
+  fun () -> Lazy.force test
151578
+
151578
+let pxz_available =
151578
+  let test = lazy (shell_command "pxz --help >/dev/null 2>&1" = 0) in
151578
+  fun () -> Lazy.force test
151578
+
151578
 let zcat_command_of_format = function
151578
-  | `GZip -> "gzip -c -d"
151578
-  | `XZ -> "xz -c -d"
151578
+  | `GZip ->
151578
+     if pigz_available () then "pigz -c -d" else "gzip -c -d"
151578
+  | `XZ ->
151578
+     if pxz_available () then "pxz -c -d" else "xz -c -d"
151578
 
151578
 (* Untar part or all files from tar archive. If [paths] is specified it is
151578
  * a list of paths in the tar archive.
151578
-- 
151578
2.14.3
151578