Merge remote-tracking branch 'up/master' into master-riscv64

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
This commit is contained in:
David Abdurachmanov 2019-03-30 21:16:02 +01:00
commit 4c476827ec
Signed by: davidlt
GPG Key ID: 7108702C938B13C1
8 changed files with 83 additions and 246 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ appliance-tools-004.5.tar.bz2
/appliance-tools-007.7.tar.bz2
/appliance-tools-007.8.tar.bz2
/appliance-tools-008.0.tar.bz2
/appliance-tools-009.0.tar.bz2

View File

@ -1,26 +0,0 @@
From 31760d1f5e73caf2525859de581e11c73e405218 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Sat, 10 Feb 2018 09:18:50 -0500
Subject: [PATCH] Remove usage of kickstart.get_modules() (rhbz#1544075)
As of pykickstart 3.9, this method doesn't exist anymore, and usage
of this was removed in livecd-tools already.
---
appcreate/appliance.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/appcreate/appliance.py b/appcreate/appliance.py
index 61f1c46..34971a3 100644
--- a/appcreate/appliance.py
+++ b/appcreate/appliance.py
@@ -66,7 +66,6 @@ class ApplianceImageCreator(ImageCreator):
#additional modules to include
self.modules = ["sym53c8xx", "aic7xxx", "mptspi"]
- self.modules.extend(kickstart.get_modules(self.ks))
# This determines which partition layout we'll be using
self.bootloader = None
--
2.14.3

View File

@ -1,48 +0,0 @@
From 31653832d72ce7dc6203cb10133ba94b05880dab Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
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

View File

@ -1,27 +0,0 @@
From fe2609302233148b8c670417748c0f036092c3d7 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Sun, 12 Mar 2017 18:20:49 -0400
Subject: [PATCH] Use --block-size with xz to make seekable xz-compressed
images (rhbz#984704)
---
appcreate/appliance.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/appcreate/appliance.py b/appcreate/appliance.py
index e489494..61f1c46 100644
--- a/appcreate/appliance.py
+++ b/appcreate/appliance.py
@@ -643,7 +643,8 @@ class ApplianceImageCreator(ImageCreator):
dst = "%s/%s-%s.%s" % (self._outdir, self.name, name, self.__disk_format)
if self.__compress:
- rc = subprocess.call(["xz", "-z", src])
+ # Compress with xz using 16 MiB block size for seekability
+ rc = subprocess.call(["xz", "-z", "--block-size=16777216", src])
if rc == 0:
logging.debug("compression successful")
if rc != 0:
--
2.9.3

View File

@ -0,0 +1,25 @@
From 52ca919e15e246324d084f2a9d03884aa9bfb81f Mon Sep 17 00:00:00 2001
From: Pablo Greco <psgreco@gmail.com>
Date: Thu, 22 Nov 2018 13:35:04 -0300
Subject: [PATCH] fstype is optional for swap, check mountpoint also
---
appcreate/partitionedfs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appcreate/partitionedfs.py b/appcreate/partitionedfs.py
index 3cc09c1..b738b80 100644
--- a/appcreate/partitionedfs.py
+++ b/appcreate/partitionedfs.py
@@ -110,7 +110,7 @@ class PartitionedMount(Mount):
logging.debug("Add %s part at %d of size %d" % (p['type'], p['start'], p['size']))
if p['fstype'].startswith('ext'):
fstype = 'ext2'
- if p['fstype'].startswith('swap'):
+ if p['fstype'].startswith('swap') or p['mountpoint'].startswith('swap'):
fstype = 'linux-swap'
if p['fstype'] == 'vfat':
fstype = 'fat32'
--
2.17.2

View File

@ -1,117 +0,0 @@
From 042ec7b7c2f5e6a4b0bbf1818c2cd93ba9ebde8f Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
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

View File

@ -1,52 +1,57 @@
%if (0%{?rhel} && 0%{?rhel} <= 7)
# Since the Python 3 stack in EPEL is missing too many dependencies,
# we're sticking with Python 2 there for now.
%global __python %{__python2}
%global python_pkgversion %{nil}
%else
# Default to Python 3 when not EL
%global __python %{__python3}
%global python_pkgversion %{python3_pkgversion}
%endif
Name: appliance-tools
Summary: Tools for building Appliances
Version: 008.0
Release: 8.0.riscv64%{?dist}
Version: 009.0
Release: 5%{?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
Patch3: 0001-Use-block-size-with-xz-to-make-seekable-xz-compresse.patch
Patch4: 0001-Remove-usage-of-kickstart.get_modules-rhbz-1544075.patch
# See: https://pagure.io/appliance-tools/pull-request/4
# See: https://pagure.io/appliance-tools/pull-request/3
# These are not arch specific changes, they are generic
Patch5: appliance-tools-008.0-riscv64-mods.patch
Patch0001: 0001-fstype-is-optional-for-swap-check-mountpoint-also.patch
# Ensure system deps are installed (rhbz#1409536)
Requires: python2-imgcreate >= 1:25.0-2
Requires: python2-urlgrabber
Requires: python%{python_pkgversion}-imgcreate >= 1:25.0-2
Requires: python%{python_pkgversion}-progress
Requires: python%{python_pkgversion}-future
Requires: curl rsync kpartx
Requires: zlib
Requires: qemu-img
Requires: xz
Requires: xfsprogs
Requires: sssd-client
BuildRequires: python2-devel
BuildRequires: python%{python_pkgversion}-devel
BuildRequires: /usr/bin/pod2man
BuildRequires: /usr/bin/which
BuildArch: noarch
%description
Tools for generating appliance images on Fedora based systems including
derived distributions such as RHEL, CentOS and others.
Tools for generating appliance images on Fedora based systems, including
derived distributions such as RHEL, CentOS, and others.
%prep
%autosetup -p1
%build
make
# Nothing to do
%install
%make_install
%make_install PYTHON=%{__python}
# Removing license as we'll mark it as license file later
rm -fv %{buildroot}%{_pkgdocdir}/COPYING
# Delete docs, we'll grab them later
rm -rf %{buildroot}%{_datadir}/doc/%{name}
%files
%doc README
@ -55,15 +60,39 @@ rm -fv %{buildroot}%{_pkgdocdir}/COPYING
%{_mandir}/man*/*
%{_bindir}/appliance-creator
%{_bindir}/ec2-converter
%dir %{python2_sitelib}/appcreate
%dir %{python2_sitelib}/ec2convert
%{python2_sitelib}/appcreate/*
%{python2_sitelib}/ec2convert/*
%{python_sitelib}/appcreate/
%{python_sitelib}/ec2convert/
%changelog
* Fri Jun 15 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> - 008.0-8.0.riscv64
- Allow xz to use all cores on machine for compression
- If bootloader is disabled use user provided disk label
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 009.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Nov 22 2018 Neal Gompa <ngompa13@gmail.com> - 009.0-4
- Backport fix to detect swap partition type correctly
* Thu Nov 22 2018 Neal Gompa <ngompa13@gmail.com> - 009.0-3
- Add missing dep for python-future
* Thu Nov 15 2018 Neal Gompa <ngompa13@gmail.com> - 009.0-2
- Fix package description grammar
- Fix grabbing docs on EL7
* Thu Nov 15 2018 Neal Gompa <ngompa13@gmail.com> - 009.0-1
- Update to 009.0 relase
- Dropped merged patches
- Added compatibility for EL7 builds
* Tue Nov 13 2018 Neal Gompa <ngompa13@gmail.com> - 008.0-11
- Port to Python 3
- Backport xz multi-threading support
- Refresh nss libs hack patch
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 008.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jul 05 2018 Kevin Fenzi <kevin@scrye.com> - 008.0-9
- Add a patch to open nss libs in the chroot to avoid install_root keeping them open.
- See https://bugzilla.redhat.com/show_bug.cgi?id=1591804
* Sat Feb 10 2018 Neal Gompa <ngompa13@gmail.com> - 008.0-8
- Fix compatibility with pykickstart 3.9+ (#1544075)

View File

@ -1 +1 @@
SHA512 (appliance-tools-008.0.tar.bz2) = 90407cef265c34e28bdea5f0d843e3342d04ab49c9752e4e77eb5cec0726e054eb36bbc6552495c1431f9367cdab382e443921b2c9f6f3f0579c774e4c45844b
SHA512 (appliance-tools-009.0.tar.bz2) = 2c85ff875b346e0223691690ccbbdf81dd1ac3ac4faf738e6edac79ca4fad849fefcacd75e852b0f7f12ccbb402bf16288d70e2e4bd90bc0d2afe0c7dbc0e84f