[Libguestfs] [PATCH ubuntu] generator: Make 'xz' into an optional group.
Richard W.M. Jones
rjones at redhat.com
Thu May 20 09:43:04 UTC 2010
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-------------- next part --------------
>From b253ab9346518d3a31ce572f3d37300a9a2ff086 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Thu, 20 May 2010 10:39:44 +0100
Subject: [PATCH] generator: Make 'xz' into an optional group.
On Ubuntu <= Karmic, xz-utils was not packaged, and therefore
any xz-related tests would fail. Thus make this an optional
group so that we can test for this and avoid running the tests
if xz utils are not present.
---
daemon/tar.c | 8 ++++++++
src/generator.ml | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/daemon/tar.c b/daemon/tar.c
index 941f80b..ce3ca78 100644
--- a/daemon/tar.c
+++ b/daemon/tar.c
@@ -28,6 +28,14 @@
#include "../src/guestfs_protocol.h"
#include "daemon.h"
#include "actions.h"
+#include "optgroups.h"
+
+int
+optgroup_xz_available (void)
+{
+ int r = access ("/usr/bin/xz", X_OK);
+ return r == 0;
+}
/* Redirect errors from the tar command to the error file, then
* provide functions for reading it in. We overwrite the file each
diff --git a/src/generator.ml b/src/generator.ml
index 73ab8fa..45a5ebf 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4473,7 +4473,7 @@ This command writes zeroes over the entire C<device>. Compare
with C<guestfs_zero> which just zeroes the first few blocks of
a device.");
- ("txz_in", (RErr, [FileIn "tarball"; Pathname "directory"]), 229, [],
+ ("txz_in", (RErr, [FileIn "tarball"; Pathname "directory"]), 229, [Optional "xz"],
[InitBasicFS, Always, TestOutput (
[["txz_in"; "../images/helloworld.tar.xz"; "/"];
["cat"; "/hello"]], "hello\n")],
@@ -4482,7 +4482,7 @@ a device.");
This command uploads and unpacks local file C<tarball> (an
I<xz compressed> tar file) into C<directory>.");
- ("txz_out", (RErr, [Pathname "directory"; FileOut "tarball"]), 230, [],
+ ("txz_out", (RErr, [Pathname "directory"; FileOut "tarball"]), 230, [Optional "xz"],
[],
"pack directory into compressed tarball",
"\
--
1.6.3.3
More information about the Libguestfs
mailing list