From a77a008262dcf6aa1284352dc62f7b8c3a67b3d2 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Oct 05 2015 09:27:17 +0000 Subject: Adjust for fedora-rpi --- diff --git a/0001-Set-releasever.patch b/0001-Set-releasever.patch new file mode 100644 index 0000000..9ffccbb --- /dev/null +++ b/0001-Set-releasever.patch @@ -0,0 +1,48 @@ +From 47f0e8777b57162f29b4605b628822f5ee6b932f 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 c5f75f2..09aa387 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.5.0 + 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..50190a3 --- /dev/null +++ b/0002-Make-it-possible-to-disable-compression.patch @@ -0,0 +1,117 @@ +From cc7b3d7c9d6cce7723366eaa635bae1a75c6f1bc 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 09aa387..2c16e46 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.5.0 + diff --git a/appliance-tools.spec b/appliance-tools.spec index bc4ca2f..0a890c5 100644 --- a/appliance-tools.spec +++ b/appliance-tools.spec @@ -5,7 +5,7 @@ Summary: Tools for building Appliances Name: appliance-tools Version: 007.8 -Release: 6%{?dist} +Release: 6%{?dist}.lr1 License: GPLv2 Group: System Environment/Base URL: https://git.fedorahosted.org/git/appliance-tools.git @@ -16,6 +16,7 @@ URL: https://git.fedorahosted.org/git/appliance-tools.git # git checkout appliance-tools-007.8 # make dist Source0: appliance-tools-%{version}.tar.bz2 + Patch0: appliance-tools-nss.hack Requires: livecd-tools >= 020 curl rsync kpartx Requires: zlib @@ -28,6 +29,9 @@ BuildRequires: /usr/bin/pod2man BuildArch: noarch ExcludeArch: ppc64 s390 s390x +Patch666: 0001-Set-releasever.patch +Patch667: 0002-Make-it-possible-to-disable-compression.patch + %description Tools for generating appliance images on Fedora based systems including @@ -36,6 +40,8 @@ derived distributions such as RHEL, CentOS and others. %prep %setup -q %patch0 -p1 +%patch666 -p1 +%patch667 -p1 %build make