Enable gzip-compressed appliance.

- Note this requires supermin >= 4.1.4.
This commit is contained in:
Richard W.M. Jones 2013-08-29 08:56:52 +01:00
parent ad8cf8e105
commit 3d9012f3ec
2 changed files with 108 additions and 3 deletions

View File

@ -0,0 +1,99 @@
From ca4b4089689c0c908ee56a8021d65a79d39d803e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@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

View File

@ -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@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@redhat.com> - 1:1.23.18-3
- Fix javadoc location to use _javadocdir macro.
- Call ldconfig in java post and postun scripts.