ostree-install: allow configuring additional depenencies for runroot

A lorax template used for the ostree-installer might need an additional
package dependency (e.g., flatpak to embed a flatpak repository) - add
a config key 'extra_runroot_pkgs' to the ostree installer configuration
to allow supplementing the set of packages installed into the runroot.

Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
This commit is contained in:
Owen W. Taylor 2019-10-10 15:11:38 -04:00
parent c346492df4
commit 72bf795bd4
4 changed files with 14 additions and 3 deletions

View File

@ -1527,6 +1527,11 @@ an OSTree repository. This always runs in Koji as a ``runroot`` task.
``template_repo`` needs to point to a Git repository from which to take the ``template_repo`` needs to point to a Git repository from which to take the
templates. templates.
If the templates need to run with additional dependencies, that can be configured
with the optional key:
* ``extra_runroot_pkgs`` -- (*[str]*)
**ostree_installer_overwrite** = False **ostree_installer_overwrite** = False
(*bool*) -- by default if a variant including OSTree installer also creates (*bool*) -- by default if a variant including OSTree installer also creates
regular installer images in buildinstall phase, there will be conflicts (as regular installer images in buildinstall phase, there will be conflicts (as

View File

@ -1132,6 +1132,7 @@ def make_schema():
"rootfs_size": {"type": "string"}, "rootfs_size": {"type": "string"},
"template_repo": {"type": "string"}, "template_repo": {"type": "string"},
"template_branch": {"type": "string"}, "template_branch": {"type": "string"},
"extra_runroot_pkgs": {"$ref": "#/definitions/list_of_strings"},
}, },
"additionalProperties": False, "additionalProperties": False,
}), }),

View File

@ -195,6 +195,8 @@ class OstreeInstallerThread(WorkerThread):
' '.join([shlex_quote(x) for x in lorax_cmd])) ' '.join([shlex_quote(x) for x in lorax_cmd]))
packages = ['pungi', 'lorax', 'ostree'] packages = ['pungi', 'lorax', 'ostree']
packages += config.get('extra_runroot_pkgs', [])
log_file = os.path.join(self.logdir, 'runroot.log') log_file = os.path.join(self.logdir, 'runroot.log')
runroot = Runroot(compose) runroot = Runroot(compose)

View File

@ -126,7 +126,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.assertEqual(compose.im.add.mock_calls, self.assertEqual(compose.im.add.mock_calls,
[mock.call('Everything', 'x86_64', image)]) [mock.call('Everything', 'x86_64', image)])
def assertRunrootCall(self, koji, sources, release, isfinal=False, extra=[], weight=None): def assertRunrootCall(self, koji, sources, release, isfinal=False, extra=[],
extra_pkgs=[], weight=None):
lorax_cmd = [ lorax_cmd = [
'lorax', 'lorax',
'--product=Fedora', '--product=Fedora',
@ -156,7 +157,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
[mock.call('rrt', 'x86_64', [mock.call('rrt', 'x86_64',
'rm -rf %s && %s' % (outdir, ' '.join(lorax_cmd)), 'rm -rf %s && %s' % (outdir, ' '.join(lorax_cmd)),
channel=None, mounts=[self.topdir], channel=None, mounts=[self.topdir],
packages=['pungi', 'lorax', 'ostree'], packages=['pungi', 'lorax', 'ostree'] + extra_pkgs,
task_id=True, use_shell=True, weight=weight, task_id=True, use_shell=True, weight=weight,
chown_paths=[outdir])]) chown_paths=[outdir])])
self.assertEqual(koji.run_runroot_cmd.call_args_list, self.assertEqual(koji.run_runroot_cmd.call_args_list,
@ -418,6 +419,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
'add_arch_template': ['other_file.txt'], 'add_arch_template': ['other_file.txt'],
'template_repo': 'git://example.com/templates.git', 'template_repo': 'git://example.com/templates.git',
'template_branch': 'f24', 'template_branch': 'f24',
'extra_runroot_pkgs': ['templatedep'],
} }
koji = KojiWrapper.return_value koji = KojiWrapper.return_value
koji.run_runroot_cmd.return_value = { koji.run_runroot_cmd.return_value = {
@ -445,7 +447,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
isfinal=True, isfinal=True,
extra=['--add-template=%s/some_file.txt' % templ_dir, extra=['--add-template=%s/some_file.txt' % templ_dir,
'--add-arch-template=%s/other_file.txt' % templ_dir, '--add-arch-template=%s/other_file.txt' % templ_dir,
'--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) '--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)],
extra_pkgs=['templatedep'])
self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path)
self.assertImageAdded(self.compose, ImageCls, iso) self.assertImageAdded(self.compose, ImageCls, iso)
self.assertAllCopied(copy_all) self.assertAllCopied(copy_all)