livemedia-creator: Use --compress-arg in mksquashfs
Previously the --compress-arg option was only used for tar, this adds support for it to the squashfs.img creation used with live isos.
This commit is contained in:
parent
babf823b1b
commit
361c6de2de
@ -120,8 +120,13 @@ def squashfs_args(opts):
|
|||||||
"""
|
"""
|
||||||
compression = opts.compression or "xz"
|
compression = opts.compression or "xz"
|
||||||
arch = ArchData(opts.arch or os.uname().machine)
|
arch = ArchData(opts.arch or os.uname().machine)
|
||||||
if compression == "xz" and arch.bcj:
|
if compression == "xz" and arch.bcj and not opts.compress_args:
|
||||||
|
# default to bcj when using xz
|
||||||
compressargs = ["-Xbcj", arch.bcj]
|
compressargs = ["-Xbcj", arch.bcj]
|
||||||
|
elif opts.compress_args:
|
||||||
|
compressargs = []
|
||||||
|
for arg in opts.compress_args:
|
||||||
|
compressargs += arg.split(" ", 1)
|
||||||
else:
|
else:
|
||||||
compressargs = []
|
compressargs = []
|
||||||
return (compression, compressargs)
|
return (compression, compressargs)
|
||||||
|
@ -56,12 +56,18 @@ class CreatorTest(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
for arch in test_arches:
|
for arch in test_arches:
|
||||||
opts = DataHolder(compression=None, arch=arch)
|
opts = DataHolder(compression=None, compress_args=[], arch=arch)
|
||||||
self.assertEqual(squashfs_args(opts), test_arches[arch], (opts, squashfs_args(opts)))
|
self.assertEqual(squashfs_args(opts), test_arches[arch], (opts, squashfs_args(opts)))
|
||||||
|
|
||||||
opts = DataHolder(compression="lzma", arch="x86_64")
|
opts = DataHolder(compression="lzma", compress_args=[], arch="x86_64")
|
||||||
self.assertEqual(squashfs_args(opts), ("lzma", []), (opts, squashfs_args(opts)))
|
self.assertEqual(squashfs_args(opts), ("lzma", []), (opts, squashfs_args(opts)))
|
||||||
|
|
||||||
|
opts = DataHolder(compression="xz", compress_args=["-X32767"], arch="x86_64")
|
||||||
|
self.assertEqual(squashfs_args(opts), ("xz", ["-X32767"]), (opts, squashfs_args(opts)))
|
||||||
|
|
||||||
|
opts = DataHolder(compression="xz", compress_args=["-X32767", "-Xbcj x86"], arch="x86_64")
|
||||||
|
self.assertEqual(squashfs_args(opts), ("xz", ["-X32767", "-Xbcj", "x86"]), (opts, squashfs_args(opts)))
|
||||||
|
|
||||||
def make_appliance_test(self):
|
def make_appliance_test(self):
|
||||||
"""Test creating the appliance description XML file"""
|
"""Test creating the appliance description XML file"""
|
||||||
lorax_templates = find_templates("./share/")
|
lorax_templates = find_templates("./share/")
|
||||||
@ -122,8 +128,8 @@ class CreatorTest(unittest.TestCase):
|
|||||||
with tempfile.TemporaryDirectory(prefix="lorax.test.root.") as mount_dir:
|
with tempfile.TemporaryDirectory(prefix="lorax.test.root.") as mount_dir:
|
||||||
# Make a fake kernel and initrd
|
# Make a fake kernel and initrd
|
||||||
mkFakeBoot(mount_dir)
|
mkFakeBoot(mount_dir)
|
||||||
opts = DataHolder(project="Fedora", releasever="devel", compression="xz", arch="x86_64",
|
opts = DataHolder(project="Fedora", releasever="devel", compression="xz", compress_args=[],
|
||||||
squashfs_only=True)
|
arch="x86_64", squashfs_only=True)
|
||||||
make_runtime(opts, mount_dir, work_dir)
|
make_runtime(opts, mount_dir, work_dir)
|
||||||
|
|
||||||
# Make sure it made an install.img
|
# Make sure it made an install.img
|
||||||
@ -146,8 +152,8 @@ class CreatorTest(unittest.TestCase):
|
|||||||
with tempfile.TemporaryDirectory(prefix="lorax.test.root.") as mount_dir:
|
with tempfile.TemporaryDirectory(prefix="lorax.test.root.") as mount_dir:
|
||||||
# Make a fake kernel and initrd
|
# Make a fake kernel and initrd
|
||||||
mkFakeBoot(mount_dir)
|
mkFakeBoot(mount_dir)
|
||||||
opts = DataHolder(project="Fedora", releasever="devel", compression="xz", arch="x86_64",
|
opts = DataHolder(project="Fedora", releasever="devel", compression="xz", compress_args=[],
|
||||||
squashfs_only=False)
|
arch="x86_64", squashfs_only=False)
|
||||||
make_runtime(opts, mount_dir, work_dir)
|
make_runtime(opts, mount_dir, work_dir)
|
||||||
|
|
||||||
# Make sure it made an install.img
|
# Make sure it made an install.img
|
||||||
|
Loading…
Reference in New Issue
Block a user