[libguestfs] Enable gzip-compressed appliance.

Richard W.M. Jones rjones at fedoraproject.org
Thu Aug 29 08:14:30 UTC 2013


commit 3d9012f3ec6cff9425e3422ea49a49c05366a447
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Thu Aug 29 08:56:52 2013 +0100

    Enable gzip-compressed appliance.
    
    - Note this requires supermin >= 4.1.4.

 ...se-gzip-compressed-cpio-files-if-supermin.patch |   99 ++++++++++++++++++++
 libguestfs.spec                                    |   12 ++-
 2 files changed, 108 insertions(+), 3 deletions(-)
---
diff --git a/0001-appliance-Use-gzip-compressed-cpio-files-if-supermin.patch b/0001-appliance-Use-gzip-compressed-cpio-files-if-supermin.patch
new file mode 100644
index 0000000..e12ee34
--- /dev/null
+++ b/0001-appliance-Use-gzip-compressed-cpio-files-if-supermin.patch
@@ -0,0 +1,99 @@
+From ca4b4089689c0c908ee56a8021d65a79d39d803e Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Wed, 28 Aug 2013 22:35:42 +0100
+Subject: [PATCH] appliance: Use gzip-compressed cpio files if supermin-helper
+ supports it.
+
+supermin-helper >= 4.1.4 has new support for compressed cpio files
+(not hostfiles).  Detect if this is supported, and use it.
+---
+ appliance/Makefile.am | 23 +++++++++++++++++------
+ configure.ac          | 15 +++++++++++++++
+ 2 files changed, 32 insertions(+), 6 deletions(-)
+
+diff --git a/appliance/Makefile.am b/appliance/Makefile.am
+index 54d3379..a9cc9fe 100644
+--- a/appliance/Makefile.am
++++ b/appliance/Makefile.am
+@@ -35,14 +35,18 @@ superminfs_DATA = \
+ 	supermin.d/init.img \
+ 	supermin.d/udev-rules.img
+ 
++if SUPERMIN_HELPER_COMPRESSED_CPIO
++GZ = .gz
++endif
++
+ if ENABLE_DAEMON
+ superminfs_DATA += \
+-	supermin.d/daemon.img
++	supermin.d/daemon.img$(GZ)
+ endif
+ 
+ if ENABLE_APPLIANCE
+ superminfs_DATA += \
+-	supermin.d/base.img \
++	supermin.d/base.img$(GZ) \
+ 	supermin.d/hostfiles
+ endif
+ 
+@@ -73,20 +77,27 @@ excludelist: excludelist.in Makefile
+ 	cmp -s $@ $@-t || mv $@-t $@
+ 	rm -f $@-t
+ 
+-supermin.d/base.img supermin.d/hostfiles: stamp-supermin
++supermin.d/base.img$(GZ) supermin.d/hostfiles: stamp-supermin
+ stamp-supermin: make.sh packagelist excludelist
+-	rm -f $@ supermin.d/base.img supermin.d/hostfiles
++	rm -f $@ supermin.d/base.img$(GZ) supermin.d/hostfiles
+ 	./make.sh
++if SUPERMIN_HELPER_COMPRESSED_CPIO
++	gzip -9 supermin.d/base.img
++endif
+ 	touch $@
+ 
+-supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
+-	rm -f $@ $@-t
++supermin.d/daemon.img$(GZ): ../daemon/guestfsd guestfsd.suppressions
++	rm -f $@ $@-t $@-tt
+ 	rm -rf tmp-d
+ 	mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
+ 	ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
+ 	ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
+ 	( cd tmp-d && find | cpio --quiet -o -H newc ) > $@-t
+ 	rm -r tmp-d
++if SUPERMIN_HELPER_COMPRESSED_CPIO
++	gzip -9 -c $@-t > $@-tt
++	mv $@-tt $@-t
++endif
+ 	mv $@-t $@
+ 
+ supermin.d/init.img: init
+diff --git a/configure.ac b/configure.ac
+index 0d481a8..a85590e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -446,6 +446,21 @@ AC_CHECK_PROGS([SUPERMIN],
+ AC_CHECK_PROGS([SUPERMIN_HELPER],
+                [supermin-helper febootstrap-supermin-helper],[no])
+ 
++dnl supermin >= 4.1.4 supports compressed cpio images.
++AC_MSG_CHECKING([for supermin-helper version])
++supermin_helper_version=`$SUPERMIN_HELPER --version | awk '{print $2}'`
++AC_MSG_RESULT([$supermin_helper_version])
++AC_MSG_CHECKING([if supermin-helper supports compressed cpio images])
++supermin_helper_version_int=`echo "$supermin_helper_version" | awk -F. '{print $1 * 1000000 + $2 * 1000 + $3}'`
++if test $supermin_helper_version_int -ge 4001004; then
++    supermin_helper_compressed_cpio=yes
++else
++    supermin_helper_compressed_cpio=yes
++fi
++AC_MSG_RESULT([$supermin_helper_compressed_cpio])
++AM_CONDITIONAL([SUPERMIN_HELPER_COMPRESSED_CPIO],
++               [test "x$supermin_helper_compressed_cpio" = "xyes"])
++
+ dnl Pass supermin --packager-config option.
+ dnl
+ dnl Note that in febootstrap >= 3.21 / supermin >= 4.1.0, this option
+-- 
+1.8.3.1
+
diff --git a/libguestfs.spec b/libguestfs.spec
index fdfb1e0..5fdaedf 100644
--- a/libguestfs.spec
+++ b/libguestfs.spec
@@ -12,7 +12,7 @@ Summary:       Access and modify virtual machine disk images
 Name:          libguestfs
 Epoch:         1
 Version:       1.23.18
-Release:       3%{?dist}
+Release:       4%{?dist}
 License:       LGPLv2+
 
 # Source and patches.
@@ -21,13 +21,14 @@ Source0:       http://libguestfs.org/download/1.23-development/%{name}-%{version
 
 # Upstream since 2013-08-28.
 Patch1:        0001-javadoc-Install-javadoc-in-datadir-javadoc-libguestf.patch
+Patch2:        0001-appliance-Use-gzip-compressed-cpio-files-if-supermin.patch
 BuildRequires: automake, autoconf, libtool, gettext-devel
 
 # Basic build requirements:
 BuildRequires: perl(Pod::Simple)
 BuildRequires: perl(Pod::Man)
 BuildRequires: /usr/bin/pod2text
-BuildRequires: supermin >= 4.1.1
+BuildRequires: supermin >= 4.1.4
 BuildRequires: hivex-devel >= 1.2.7-7
 BuildRequires: perl(Win::Hivex)
 BuildRequires: perl(Win::Hivex::Regedit)
@@ -110,7 +111,7 @@ BuildRequires: %{appliance_buildreqs}
 Requires:      %{appliance_buildreqs}
 
 # For building the appliance.
-Requires:      supermin-helper >= 4.1.1
+Requires:      supermin-helper >= 4.1.4
 
 # For core inspection API.
 Requires:      libdb-utils
@@ -563,6 +564,7 @@ for %{name}.
 %setup -q
 
 %patch1 -p1
+%patch2 -p1
 autoreconf -i
 
 if [ "$(getenforce | tr '[A-Z]' '[a-z]')" != "disabled" ]; then
@@ -954,6 +956,10 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/libguestfs
 
 
 %changelog
+* Thu Aug 29 2013 Richard W.M. Jones <rjones at redhat.com> - 1:1.23.18-4
+- Enable gzip-compressed appliance.
+- Note this requires supermin >= 4.1.4.
+
 * Wed Aug 28 2013 Richard W.M. Jones <rjones at redhat.com> - 1:1.23.18-3
 - Fix javadoc location to use _javadocdir macro.
 - Call ldconfig in java post and postun scripts.


More information about the scm-commits mailing list