diff --git a/0001-Set-releasever.patch b/0001-Set-releasever.patch new file mode 100644 index 0000000..ff0ecd8 --- /dev/null +++ b/0001-Set-releasever.patch @@ -0,0 +1,48 @@ +From 31653832d72ce7dc6203cb10133ba94b05880dab Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Mon, 5 Oct 2015 05:17:54 -0400 +Subject: [PATCH 1/2] Set releasever + +...so that $releasever is properly substituted in the kickstart repository +locations. +--- + appcreate/appliance.py | 4 ++-- + tools/appliance-creator | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/appcreate/appliance.py b/appcreate/appliance.py +index 3afe993..f77b13b 100644 +--- a/appcreate/appliance.py ++++ b/appcreate/appliance.py +@@ -43,13 +43,13 @@ class ApplianceImageCreator(ImageCreator): + + """ + +- def __init__(self, ks, name, disk_format, vmem, vcpu): ++ def __init__(self, ks, name, disk_format, vmem, vcpu, releasever=None): + """Initialize a ApplianceImageCreator instance. + + This method takes the same arguments as ImageCreator.__init__() + + """ +- ImageCreator.__init__(self, ks, name) ++ ImageCreator.__init__(self, ks, name, releasever=releasever) + + self.__instloop = None + self.__imgdir = None +diff --git a/tools/appliance-creator b/tools/appliance-creator +index 1708431..9e3fa15 100755 +--- a/tools/appliance-creator ++++ b/tools/appliance-creator +@@ -129,7 +129,7 @@ def main(): + if options.name: + name = options.name + +- creator = appcreate.ApplianceImageCreator(ks, name, options.disk_format, options.vmem, options.vcpu) ++ creator = appcreate.ApplianceImageCreator(ks, name, options.disk_format, options.vmem, options.vcpu, releasever=options.version) + creator.tmpdir = options.tmpdir + creator.checksum = options.checksum + +-- +2.9.3 + diff --git a/0002-Make-it-possible-to-disable-compression.patch b/0002-Make-it-possible-to-disable-compression.patch new file mode 100644 index 0000000..51ae2c4 --- /dev/null +++ b/0002-Make-it-possible-to-disable-compression.patch @@ -0,0 +1,117 @@ +From 042ec7b7c2f5e6a4b0bbf1818c2cd93ba9ebde8f Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Mon, 5 Oct 2015 05:14:42 -0400 +Subject: [PATCH 2/2] Make it possible to disable compression + +--- + appcreate/appliance.py | 25 +++++++++++++++---------- + docs/appliance-creator.pod | 6 +++++- + tools/appliance-creator | 4 +++- + 3 files changed, 23 insertions(+), 12 deletions(-) + +diff --git a/appcreate/appliance.py b/appcreate/appliance.py +index f77b13b..258396d 100644 +--- a/appcreate/appliance.py ++++ b/appcreate/appliance.py +@@ -43,7 +43,7 @@ class ApplianceImageCreator(ImageCreator): + + """ + +- def __init__(self, ks, name, disk_format, vmem, vcpu, releasever=None): ++ def __init__(self, ks, name, disk_format, vmem, vcpu, releasever=None, no_compress=False): + """Initialize a ApplianceImageCreator instance. + + This method takes the same arguments as ImageCreator.__init__() +@@ -55,6 +55,7 @@ class ApplianceImageCreator(ImageCreator): + self.__imgdir = None + self.__disks = {} + self.__disk_format = disk_format ++ self.__compress = not no_compress + + #appliance parameters + self.vmem = vmem +@@ -629,14 +630,18 @@ class ApplianceImageCreator(ImageCreator): + else: + logging.debug("moving disks to stage location") + for name in self.__disks.keys(): +- rc = subprocess.call(["xz", "-z", "%s/%s-%s.%s" %(self.__imgdir, self.name, name, self.__disk_format)]) +- if rc == 0: +- logging.debug("compression successful") +- if rc != 0: +- raise CreatorError("Unable to compress disk to %s" % self.__disk_format) +- +- src = "%s/%s-%s.%s.xz" % (self.__imgdir, self.name, name, self.__disk_format) +- dst = "%s/%s-%s.%s.xz" % (self._outdir, self.name, name, self.__disk_format) ++ src = "%s/%s-%s.%s" % (self.__imgdir, self.name, name, self.__disk_format) ++ dst = "%s/%s-%s.%s" % (self._outdir, self.name, name, self.__disk_format) ++ ++ if self.__compress: ++ rc = subprocess.call(["xz", "-z", src]) ++ if rc == 0: ++ logging.debug("compression successful") ++ if rc != 0: ++ raise CreatorError("Unable to compress disk to %s" % self.__disk_format) ++ src = "%s.xz" % (src) ++ dst = "%s.xz" % (dst) ++ + logging.debug("moving %s to %s" % (src, dst)) + shutil.move(src, dst) + #write meta data in stage dir +@@ -647,7 +652,7 @@ class ApplianceImageCreator(ImageCreator): + for name in self.__disks.keys(): + dst = "%s/%s-%s.%s" % (self._outdir, self.name, name, self.__disk_format) + logging.debug("converting %s image to %s" % (self.__disks[name].lofile, dst)) +- if self.__disk_format == "qcow2": ++ if self.__compress and self.__disk_format == "qcow2": + logging.debug("using compressed qcow2") + compressflag = "-c" + else: +diff --git a/docs/appliance-creator.pod b/docs/appliance-creator.pod +index 93bebad..a0ad804 100644 +--- a/docs/appliance-creator.pod ++++ b/docs/appliance-creator.pod +@@ -38,7 +38,7 @@ Name of appliance image to be created (default based on config name) + + =item -f FORMAT, --format=FORMAT + +-Disk format, this will take any input that qemu-img convert will take (raw, qcow2, vmdk, ...) Note: not all disk formats with work with all virt technologies. raw images are xz compressed, qcow2 images use compression. ++Disk format, this will take any input that qemu-img convert will take (raw, qcow2, vmdk, ...) Note: not all disk formats with work with all virt technologies. raw images are xz compressed, qcow2 images use compression (unless disabled with --no-compress option. + + =item --vmem=VMEM + +@@ -52,6 +52,10 @@ Number of virtual cpus for appliance (default: 1) + + Generate a checksum for the created appliance + ++=item --no-compress ++ ++Disable image compression. ++ + =back + + =head1 SYSTEM DIRECTORY OPTIONS +diff --git a/tools/appliance-creator b/tools/appliance-creator +index 9e3fa15..3ffc22c 100755 +--- a/tools/appliance-creator ++++ b/tools/appliance-creator +@@ -57,6 +57,8 @@ def parse_options(args): + help=("Generate a checksum for the created appliance")) + appopt.add_option("-f", "--format", type="string", dest="disk_format", default="raw", + help="Disk format (default: raw)") ++ appopt.add_option("", "--no-compress", action="store_true", dest="no_compress", default=False, ++ help="Avoid compressing the image") + parser.add_option_group(appopt) + + +@@ -129,7 +131,7 @@ def main(): + if options.name: + name = options.name + +- creator = appcreate.ApplianceImageCreator(ks, name, options.disk_format, options.vmem, options.vcpu, releasever=options.version) ++ creator = appcreate.ApplianceImageCreator(ks, name, options.disk_format, options.vmem, options.vcpu, releasever=options.version, no_compress=options.no_compress) + creator.tmpdir = options.tmpdir + creator.checksum = options.checksum + +-- +2.9.3 + diff --git a/appliance-tools.spec b/appliance-tools.spec index 1cbb8dd..cbbf31c 100644 --- a/appliance-tools.spec +++ b/appliance-tools.spec @@ -1,13 +1,17 @@ Name: appliance-tools Summary: Tools for building Appliances Version: 008.0 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 Group: System Environment/Base URL: https://pagure.io/appliance-tools Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.bz2 +# Patches backported from upstream +Patch0: 0001-Set-releasever.patch +Patch1: 0002-Make-it-possible-to-disable-compression.patch + # Ensure system deps are installed (rhbz#1409536) Requires: python2-imgcreate >= 1:24.0-3 Requires: python-urlgrabber @@ -27,7 +31,7 @@ Tools for generating appliance images on Fedora based systems including derived distributions such as RHEL, CentOS and others. %prep -%autosetup +%autosetup -p1 %build make @@ -51,6 +55,9 @@ rm -fv %{buildroot}%{_pkgdocdir}/COPYING %{python2_sitelib}/ec2convert/* %changelog +* Tue Feb 28 2017 Neal Gompa - 008.0-3 +- Backport patches to make more RPi friendly (#1270606) + * Fri Feb 10 2017 Fedora Release Engineering - 008.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild