From dbe78217c0205dad372c84b2cf0a299003787952 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 10 Jul 2023 14:30:49 +0200 Subject: [PATCH] commit: Always enable generation pf composefs metadata if possible There is no particular cost to always adding composefs metadata to rpm-ostree composes, so always do so if libostree is new enough and has the support compiled in. --- src/libpriv/rpmostree-postprocess.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libpriv/rpmostree-postprocess.cxx b/src/libpriv/rpmostree-postprocess.cxx index 9b38da931a..3030ce5b3a 100644 --- a/src/libpriv/rpmostree-postprocess.cxx +++ b/src/libpriv/rpmostree-postprocess.cxx @@ -835,8 +835,21 @@ rpmostree_compose_commit (int rootfs_fd, OstreeRepo *repo, const char *parent_re if (!ostree_repo_write_mtree (repo, mtree, &root_tree, cancellable, error)) return glnx_prefix_error (error, "While writing tree"); - // Unfortunately this API takes GVariantDict, not GVariantBuilder, so convert + // Unfortunately these API takes GVariantDict, not GVariantBuilder, so convert g_autoptr (GVariantDict) metadata_dict = g_variant_dict_new (src_metadata); + +#if OSTREE_CHECK_VERSION(2023, 4) + g_autoptr (GError) local_error = NULL; + if (!ostree_repo_commit_add_composefs_metadata ( + repo, 0, metadata_dict, (OstreeRepoFile *)root_tree, cancellable, &local_error) + && !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)) + { + g_propagate_prefixed_error (error, util::move_nullify (local_error), + "Adding composefs metadata"); + return FALSE; + } +#endif + if (!container) { if (!ostree_commit_metadata_for_bootable (root_tree, metadata_dict, cancellable, error))