Skip to content

Commit

Permalink
core: Add composefs digest for local commits too
Browse files Browse the repository at this point in the history
This pairs with dbe7821
where we generate composefs metadata for base images.

It's going to be useful to do it for client side builds too, so
that we can treat them symmetrically.  It doesn't have
a very high cost, just a metadata traversal.
  • Loading branch information
cgwalters committed Sep 12, 2023
1 parent 5500157 commit 1dee2d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/libpriv/rpmostree-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4713,6 +4713,19 @@ rpmostree_context_commit (RpmOstreeContext *self, const char *parent,
if (!ostree_commit_metadata_for_bootable (root, metadata_dict, cancellable, error))
return FALSE;
}
#if OSTREE_CHECK_VERSION(2023, 4)
{
g_autoptr (GError) local_error = NULL;
if (!ostree_repo_commit_add_composefs_metadata (
self->ostreerepo, 0, metadata_dict, (OstreeRepoFile *)root, 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
g_autoptr (GVariant) metadata = g_variant_dict_end (metadata_dict);

{
Expand Down
3 changes: 3 additions & 0 deletions tests/kolainst/destructive/layering-local
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ fi
ostree show --print-metadata-key=ostree.bootable ${booted_commit} >out.txt
assert_file_has_content_literal out.txt 'true'
echo "ok bootable metadata"
ostree show --print-metadata-key=ostree.composefs.digest.v0 ${booted_commit} >out.txt
assert_file_has_content_literal out.txt 'byte'
echo "ok composefs metadata on client generated commit"

# check we could uninstall the package using either its NEVRA or name
rpm-ostree uninstall foo-1.2-3.x86_64
Expand Down

0 comments on commit 1dee2d4

Please sign in to comment.