ostree: Add unified core mode for compose in rpm-ostree

rpm-ostree is moving to unified core composes and this is now working
for Silverblue & Kinoite.

This is untested for IoT but they should move to os-build with Fedora
37.

See: https://github.com/coreos/rpm-ostree/issues/729
Merges: https://pagure.io/pungi/pull-request/1626
Signed-off-by: Timothée Ravier <tim@siosm.fr>
This commit is contained in:
Timothée Ravier 2022-08-19 23:21:36 +02:00 committed by Lubomír Sedlář
parent 11fa342507
commit 603c61a033
8 changed files with 33 additions and 0 deletions

View File

@ -1707,6 +1707,8 @@ repository with a new commit.
* ``force_new_commit`` -- (*bool*) Do not use rpm-ostree's built-in change
detection.
Defaults to ``False``.
* ``unified_core`` -- (*bool*) Use rpm-ostree in unified core mode for composes.
Defaults to ``False``.
* ``version`` -- (*str*) Version string to be added as versioning metadata.
If this option is set to ``!OSTREE_VERSION_FROM_LABEL_DATE_TYPE_RESPIN``,
a value will be generated automatically as ``$VERSION.$RELEASE``.

View File

@ -332,6 +332,8 @@ This is a shortened configuration for Fedora Radhide compose as of 2019-10-14.
"tag_ref": False,
# Don't use change detection in ostree.
"force_new_commit": True,
# Use unified core mode for rpm-ostree composes
"unified_core": True,
# This is the location for the repo where new commit will be
# created. Note that this is outside of the compose dir.
"ostree_repo": "/mnt/koji/compose/ostree/repo/",

View File

@ -1027,6 +1027,7 @@ def make_schema():
},
"update_summary": {"type": "boolean"},
"force_new_commit": {"type": "boolean"},
"unified_core": {"type": "boolean"},
"version": {"type": "string"},
"config_branch": {"type": "string"},
"tag_ref": {"type": "boolean"},
@ -1061,6 +1062,7 @@ def make_schema():
"failable": {"$ref": "#/definitions/list_of_strings"},
"update_summary": {"type": "boolean"},
"force_new_commit": {"type": "boolean"},
"unified_core": {"type": "boolean"},
"version": {"type": "string"},
"config_branch": {"type": "string"},
"tag_ref": {"type": "boolean"},

View File

@ -65,6 +65,11 @@ def main(args=None):
action="store_true",
help="do not use rpm-ostree's built-in change detection",
)
treep.add_argument(
"--unified-core",
action="store_true",
help="use unified core mode in rpm-ostree",
)
installerp = subparser.add_parser(
"installer", help="Create an OSTree installer image"

View File

@ -43,6 +43,9 @@ class Tree(OSTree):
# because something went wrong.
"--touch-if-changed=%s.stamp" % self.commitid_file,
]
if self.unified_core:
# See https://github.com/coreos/rpm-ostree/issues/729
cmd.append("--unified-core")
if self.version:
# Add versioning metadata
cmd.append("--add-metadata-string=version=%s" % self.version)
@ -121,6 +124,7 @@ class Tree(OSTree):
self.extra_config = self.args.extra_config
self.ostree_ref = self.args.ostree_ref
self.force_new_commit = self.args.force_new_commit
self.unified_core = self.args.unified_core
if self.extra_config or self.ostree_ref:
if self.extra_config:

View File

@ -165,6 +165,7 @@ class OSTreeThread(WorkerThread):
("update-summary", config.get("update_summary", False)),
("ostree-ref", config.get("ostree_ref")),
("force-new-commit", config.get("force_new_commit", False)),
("unified-core", config.get("unified_core", False)),
]
)
packages = ["pungi", "ostree", "rpm-ostree"]

View File

@ -325,6 +325,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
"ostree-ref": None,
"force-new-commit": False,
"version": None,
"unified-core": False,
},
channel=None,
mounts=[self.topdir, self.repo],

View File

@ -238,6 +238,22 @@ class OstreeTreeScriptTest(helpers.PungiTestCase):
self.assertCorrectCall(run, extra_args=["--force-nocache"])
@mock.patch("kobo.shortcuts.run")
def test_unified_core(self, run):
helpers.touch(os.path.join(self.repo, "initialized"))
ostree.main(
[
"tree",
"--repo=%s" % self.repo,
"--log-dir=%s" % os.path.join(self.topdir, "logs", "Atomic"),
"--treefile=%s/fedora-atomic-docker-host.json" % self.topdir,
"--unified-core",
]
)
self.assertCorrectCall(run, extra_args=["--unified-core"])
@mock.patch("kobo.shortcuts.run")
def test_extra_config_with_extra_repos(self, run):
configdir = os.path.join(self.topdir, "config")