Blame SOURCES/0022-appliance-Use-gzip-compressed-cpio-files-if-supermin.patch

022f11
From f9a0c0ba0ddbdd351199f52eccf9b183556d3ed4 Mon Sep 17 00:00:00 2001
022f11
From: "Richard W.M. Jones" <rjones@redhat.com>
022f11
Date: Wed, 28 Aug 2013 22:35:42 +0100
022f11
Subject: [PATCH] appliance: Use gzip-compressed cpio files if supermin-helper
022f11
 supports it.
022f11
022f11
supermin-helper >= 4.1.4 has new support for compressed cpio files
022f11
(not hostfiles).  Detect if this is supported, and use it.
022f11
022f11
(cherry picked from commit ca4b4089689c0c908ee56a8021d65a79d39d803e)
022f11
---
022f11
 appliance/Makefile.am | 23 +++++++++++++++++------
022f11
 configure.ac          | 15 +++++++++++++++
022f11
 2 files changed, 32 insertions(+), 6 deletions(-)
022f11
022f11
diff --git a/appliance/Makefile.am b/appliance/Makefile.am
022f11
index 54d3379..a9cc9fe 100644
022f11
--- a/appliance/Makefile.am
022f11
+++ b/appliance/Makefile.am
022f11
@@ -35,14 +35,18 @@ superminfs_DATA = \
022f11
 	supermin.d/init.img \
022f11
 	supermin.d/udev-rules.img
022f11
 
022f11
+if SUPERMIN_HELPER_COMPRESSED_CPIO
022f11
+GZ = .gz
022f11
+endif
022f11
+
022f11
 if ENABLE_DAEMON
022f11
 superminfs_DATA += \
022f11
-	supermin.d/daemon.img
022f11
+	supermin.d/daemon.img$(GZ)
022f11
 endif
022f11
 
022f11
 if ENABLE_APPLIANCE
022f11
 superminfs_DATA += \
022f11
-	supermin.d/base.img \
022f11
+	supermin.d/base.img$(GZ) \
022f11
 	supermin.d/hostfiles
022f11
 endif
022f11
 
022f11
@@ -73,20 +77,27 @@ excludelist: excludelist.in Makefile
022f11
 	cmp -s $@ $@-t || mv $@-t $@
022f11
 	rm -f $@-t
022f11
 
022f11
-supermin.d/base.img supermin.d/hostfiles: stamp-supermin
022f11
+supermin.d/base.img$(GZ) supermin.d/hostfiles: stamp-supermin
022f11
 stamp-supermin: make.sh packagelist excludelist
022f11
-	rm -f $@ supermin.d/base.img supermin.d/hostfiles
022f11
+	rm -f $@ supermin.d/base.img$(GZ) supermin.d/hostfiles
022f11
 	./make.sh
022f11
+if SUPERMIN_HELPER_COMPRESSED_CPIO
022f11
+	gzip -9 supermin.d/base.img
022f11
+endif
022f11
 	touch $@
022f11
 
022f11
-supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
022f11
-	rm -f $@ $@-t
022f11
+supermin.d/daemon.img$(GZ): ../daemon/guestfsd guestfsd.suppressions
022f11
+	rm -f $@ $@-t $@-tt
022f11
 	rm -rf tmp-d
022f11
 	mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
022f11
 	ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
022f11
 	ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
022f11
 	( cd tmp-d && find | cpio --quiet -o -H newc ) > $@-t
022f11
 	rm -r tmp-d
022f11
+if SUPERMIN_HELPER_COMPRESSED_CPIO
022f11
+	gzip -9 -c $@-t > $@-tt
022f11
+	mv $@-tt $@-t
022f11
+endif
022f11
 	mv $@-t $@
022f11
 
022f11
 supermin.d/init.img: init
022f11
diff --git a/configure.ac b/configure.ac
022f11
index 75232e8..3e8a274 100644
022f11
--- a/configure.ac
022f11
+++ b/configure.ac
022f11
@@ -445,6 +445,21 @@ AC_CHECK_PROGS([SUPERMIN],
022f11
 AC_CHECK_PROGS([SUPERMIN_HELPER],
022f11
                [supermin-helper febootstrap-supermin-helper],[no])
022f11
 
022f11
+dnl supermin >= 4.1.4 supports compressed cpio images.
022f11
+AC_MSG_CHECKING([for supermin-helper version])
022f11
+supermin_helper_version=`$SUPERMIN_HELPER --version | awk '{print $2}'`
022f11
+AC_MSG_RESULT([$supermin_helper_version])
022f11
+AC_MSG_CHECKING([if supermin-helper supports compressed cpio images])
022f11
+supermin_helper_version_int=`echo "$supermin_helper_version" | awk -F. '{print $1 * 1000000 + $2 * 1000 + $3}'`
022f11
+if test $supermin_helper_version_int -ge 4001004; then
022f11
+    supermin_helper_compressed_cpio=yes
022f11
+else
022f11
+    supermin_helper_compressed_cpio=yes
022f11
+fi
022f11
+AC_MSG_RESULT([$supermin_helper_compressed_cpio])
022f11
+AM_CONDITIONAL([SUPERMIN_HELPER_COMPRESSED_CPIO],
022f11
+               [test "x$supermin_helper_compressed_cpio" = "xyes"])
022f11
+
022f11
 dnl Pass supermin --packager-config option.
022f11
 dnl
022f11
 dnl Note that in febootstrap >= 3.21 / supermin >= 4.1.0, this option
022f11
-- 
022f11
1.8.3.1
022f11