From ba260c24e89a17b13ddb807a1b59a788c68eb8a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 7 Jan 2019 10:48:28 +0100 Subject: [PATCH] buildinstall: Expose lorax's --rootfs-size argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already make this possible for the ostree installer, but it was missing from the traditional one. The default behaviour is to let lorax decide, but if user knows better, they can overwrite in configuration. JIRA: COMPOSE-3188 Signed-off-by: Lubomír Sedlář --- doc/configuration.rst | 1 + pungi/checks.py | 1 + pungi/phases/buildinstall.py | 3 +++ tests/test_buildinstall.py | 17 +++++++++++++++++ 4 files changed, 22 insertions(+) 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')])