pungi/1278.patch

99 lines
4.7 KiB
Diff

From 72bf795bd45e15af86e1a4f96cfbe0d40d40a8cc Mon Sep 17 00:00:00 2001
From: Owen W. Taylor <otaylor@fishsoup.net>
Date: Oct 10 2019 19:13:38 +0000
Subject: 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>
---
diff --git a/doc/configuration.rst b/doc/configuration.rst
index 2c8a5a3..2ce9216 100644
--- a/doc/configuration.rst
+++ b/doc/configuration.rst
@@ -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
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
(*bool*) -- by default if a variant including OSTree installer also creates
regular installer images in buildinstall phase, there will be conflicts (as
diff --git a/pungi/checks.py b/pungi/checks.py
index a20d0f7..513728d 100644
--- a/pungi/checks.py
+++ b/pungi/checks.py
@@ -1132,6 +1132,7 @@ def make_schema():
"rootfs_size": {"type": "string"},
"template_repo": {"type": "string"},
"template_branch": {"type": "string"},
+ "extra_runroot_pkgs": {"$ref": "#/definitions/list_of_strings"},
},
"additionalProperties": False,
}),
diff --git a/pungi/phases/ostree_installer.py b/pungi/phases/ostree_installer.py
index 995ac96..46c774b 100644
--- a/pungi/phases/ostree_installer.py
+++ b/pungi/phases/ostree_installer.py
@@ -195,6 +195,8 @@ class OstreeInstallerThread(WorkerThread):
' '.join([shlex_quote(x) for x in lorax_cmd]))
packages = ['pungi', 'lorax', 'ostree']
+ packages += config.get('extra_runroot_pkgs', [])
+
log_file = os.path.join(self.logdir, 'runroot.log')
runroot = Runroot(compose)
diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py
index 0cce4b8..846e23a 100644
--- a/tests/test_ostree_installer_phase.py
+++ b/tests/test_ostree_installer_phase.py
@@ -126,7 +126,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.assertEqual(compose.im.add.mock_calls,
[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',
'--product=Fedora',
@@ -156,7 +157,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
[mock.call('rrt', 'x86_64',
'rm -rf %s && %s' % (outdir, ' '.join(lorax_cmd)),
channel=None, mounts=[self.topdir],
- packages=['pungi', 'lorax', 'ostree'],
+ packages=['pungi', 'lorax', 'ostree'] + extra_pkgs,
task_id=True, use_shell=True, weight=weight,
chown_paths=[outdir])])
self.assertEqual(koji.run_runroot_cmd.call_args_list,
@@ -418,6 +419,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
'add_arch_template': ['other_file.txt'],
'template_repo': 'git://example.com/templates.git',
'template_branch': 'f24',
+ 'extra_runroot_pkgs': ['templatedep'],
}
koji = KojiWrapper.return_value
koji.run_runroot_cmd.return_value = {
@@ -445,7 +447,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
isfinal=True,
extra=['--add-template=%s/some_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.assertImageAdded(self.compose, ImageCls, iso)
self.assertAllCopied(copy_all)