The change allows for setting the parameters as described below to Lorax. Lorax, a program called during the buildInstall phase, creates the SquashFS during the buildInstall phase. The Squash filesystem is present both on the DVD and the BOOT.ISO. squashfs_only --- (str) passes --squashfs-only option. configuration_file --- (str or scm_dict) passes -c option to Lorax. The final goal of this change is to allow for optimization of the installation medium size. This pull request is related to the Fedora change proposal, which is available at this location: https://fedoraproject.org/wiki/Category:Changes/OptimizeSquashFS See the change proposal for more information about the benefits of higher compression ratio. Jira: RHELCMP-693 Signed-off-by: Bohdan Khomutskyi <bkhomuts@redhat.com>
95 lines
2.9 KiB
Python
95 lines
2.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
try:
|
|
import unittest2 as unittest
|
|
except ImportError:
|
|
import unittest
|
|
|
|
import six
|
|
|
|
from pungi.wrappers.lorax import LoraxWrapper
|
|
|
|
|
|
class LoraxWrapperTest(unittest.TestCase):
|
|
def setUp(self):
|
|
self.lorax = LoraxWrapper()
|
|
|
|
def test_get_command_with_minimal_arguments(self):
|
|
cmd = self.lorax.get_lorax_cmd(
|
|
"product", "version", "release", "/mnt/repo_baseurl", "/mnt/output_dir"
|
|
)
|
|
|
|
self.assertEqual(cmd[0], "lorax")
|
|
six.assertCountEqual(
|
|
self,
|
|
cmd[1:],
|
|
[
|
|
"--product=product",
|
|
"--version=version",
|
|
"--release=release",
|
|
"--source=file:///mnt/repo_baseurl",
|
|
"/mnt/output_dir",
|
|
],
|
|
)
|
|
|
|
def test_get_command_with_all_arguments(self):
|
|
cmd = self.lorax.get_lorax_cmd(
|
|
"product",
|
|
"version",
|
|
"release",
|
|
"/mnt/repo_baseurl",
|
|
"/mnt/output_dir",
|
|
variant="Server",
|
|
bugurl="http://example.com/",
|
|
nomacboot=True,
|
|
noupgrade=True,
|
|
is_final=True,
|
|
buildarch="x86_64",
|
|
volid="VOLUME_ID",
|
|
buildinstallpackages=["bash", "vim"],
|
|
add_template=["t1", "t2"],
|
|
add_arch_template=["ta1", "ta2"],
|
|
add_template_var=["v1", "v2"],
|
|
add_arch_template_var=["va1", "va2"],
|
|
log_dir="/tmp",
|
|
dracut_args=["--foo", "bar"],
|
|
squashfs_only=True,
|
|
configuration_file="/storage/RHEL-7.8-20200731.n.0/"
|
|
+ "logs/x86_64/buildinstall-Server-logs/lorax.conf",
|
|
)
|
|
|
|
self.assertEqual(cmd[0], "lorax")
|
|
six.assertCountEqual(
|
|
self,
|
|
cmd[1:],
|
|
[
|
|
"--product=product",
|
|
"--version=version",
|
|
"--release=release",
|
|
"--variant=Server",
|
|
"--source=file:///mnt/repo_baseurl",
|
|
"--bugurl=http://example.com/",
|
|
"--buildarch=x86_64",
|
|
"--volid=VOLUME_ID",
|
|
"--nomacboot",
|
|
"--noupgrade",
|
|
"--isfinal",
|
|
"--installpkgs=bash",
|
|
"--installpkgs=vim",
|
|
"--add-template=t1",
|
|
"--add-template=t2",
|
|
"--add-arch-template=ta1",
|
|
"--add-arch-template=ta2",
|
|
"--add-template-var=v1",
|
|
"--add-template-var=v2",
|
|
"--add-arch-template-var=va1",
|
|
"--add-arch-template-var=va2",
|
|
"--logfile=/tmp/lorax.log",
|
|
"--dracut-arg=--foo",
|
|
"--dracut-arg=bar",
|
|
"--squashfs-only",
|
|
"-c=/storage/RHEL-7.8-20200731.n.0/"
|
|
+ "logs/x86_64/buildinstall-Server-logs/lorax.conf",
|
|
"/mnt/output_dir",
|
|
],
|
|
)
|