diff --git a/doc/configuration.rst b/doc/configuration.rst index 3ab4a385..1bde2bc3 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -543,6 +543,7 @@ Options * ``add_arch_template`` -- *[str]* (default empty) * ``add_template_var`` -- *[str]* (default empty) * ``add_arch_template_var`` -- *[str]* (default empty) + * ``rootfs_size`` -- [*int*] (default empty) **lorax_extra_sources** (*list*) -- a variant/arch mapping with urls for extra source repositories added to Lorax command line. Either one repo or a list can be specified. diff --git a/pungi/checks.py b/pungi/checks.py index ad4dcbd5..530e2a99 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -1153,6 +1153,7 @@ def make_schema(): 'add_arch_template': {"$ref": "#/definitions/list_of_strings"}, 'add_template_var': {"$ref": "#/definitions/list_of_strings"}, 'add_arch_template_var': {"$ref": "#/definitions/list_of_strings"}, + "rootfs_size": {"type": "integer"}, }, "additionalProperties": False, }), diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index 088863ec..04081def 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -69,6 +69,7 @@ class BuildinstallPhase(PhaseBase): add_arch_template = [] add_template_var = [] add_arch_template_var = [] + rootfs_size = None for data in get_arch_variant_data(self.compose.conf, 'lorax_options', arch, variant): if not data.get('noupgrade', True): noupgrade = False @@ -80,6 +81,7 @@ class BuildinstallPhase(PhaseBase): add_arch_template.extend(data.get('add_arch_template', [])) add_template_var.extend(data.get('add_template_var', [])) add_arch_template_var.extend(data.get('add_arch_template_var', [])) + rootfs_size = data.get("rootfs_size") output_dir = os.path.join(output_dir, variant.uid) output_topdir = output_dir @@ -125,6 +127,7 @@ class BuildinstallPhase(PhaseBase): add_template_var=add_template_var, add_arch_template_var=add_arch_template_var, noupgrade=noupgrade, + rootfs_size=rootfs_size, log_dir=log_dir) return 'rm -rf %s && %s' % (shlex_quote(output_topdir), ' '.join([shlex_quote(x) for x in lorax_cmd])) diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 38937029..46ee981d 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -125,6 +125,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -135,6 +136,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -145,6 +147,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')]) self.assertItemsEqual( get_volid.mock_calls, @@ -191,6 +194,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')], any_order=True) self.assertItemsEqual( @@ -254,6 +258,7 @@ class TestBuildinstallPhase(PungiTestCase): 'add_arch_template': ['bar'], 'add_template_var': ['baz=1'], 'add_arch_template_var': ['quux=2'], + "rootfs_size": 3, }, 'amd64': {'noupgrade': False} }), @@ -292,6 +297,7 @@ class TestBuildinstallPhase(PungiTestCase): add_template=['foo', 'FOO'], add_arch_template=['bar'], add_template_var=['baz=1'], add_arch_template_var=['quux=2'], bugurl='http://example.com', + rootfs_size=3, log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -302,6 +308,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -312,6 +319,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')]) self.assertItemsEqual( get_volid.mock_calls, @@ -367,6 +375,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -377,6 +386,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -387,6 +397,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')]) self.assertItemsEqual( get_volid.mock_calls, @@ -442,6 +453,7 @@ class TestBuildinstallPhase(PungiTestCase): add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], bugurl=None, + rootfs_size=None, log_dir=buildinstall_topdir + '/x86_64/Server/logs'), mock.call('Test', '1', '1', ['http://localhost/work/amd64/repo', @@ -452,6 +464,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=buildinstall_topdir + '/amd64/Server/logs'), mock.call('Test', '1', '1', ['http://localhost/work/amd64/repo', @@ -462,6 +475,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=buildinstall_topdir + '/amd64/Client/logs')]) self.assertItemsEqual( get_volid.mock_calls, @@ -510,6 +524,7 @@ class TestBuildinstallPhase(PungiTestCase): add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], bugurl=None, + rootfs_size=None, log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -520,6 +535,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', @@ -532,6 +548,7 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, add_template=[], add_arch_template=[], add_template_var=[], add_arch_template_var=[], + rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])