buildinstall: Expose lorax's --rootfs-size argument

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ář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-01-07 10:48:28 +01:00
parent 682f959ee0
commit ba260c24e8
4 changed files with 22 additions and 0 deletions

View File

@ -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.

View File

@ -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,
}),

View File

@ -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]))

View File

@ -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')])