Skip to content

Commit

Permalink
core: Add rpmostree.rpmmd-repos metadata to client layers too
Browse files Browse the repository at this point in the history
This is a logical followup to:

 - "core: Add rpmostree.repo metadata to imported packages" AKA a52cb7d
 - "compose: Add rpmostree.rpmmd-repo metadata to commits by default" AKA e7a42f7

Basically I'd like to display this in `status` at least, though how we render it
gets...interesting when there is layering in play. For now though let's just
capture the data the same way we do server side.

Theoretically we could reconstruct this data by walking all of the pkgrefs in
the tree but...ugh. It's just a lot simpler to have it in this form too just
like the server-side path.

Closes: #1296
Approved by: jlebon
  • Loading branch information
cgwalters authored and rh-atomic-bot committed Mar 8, 2018
1 parent cdd3227 commit 9cbec27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libpriv/rpmostree-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4090,6 +4090,11 @@ rpmostree_context_commit (RpmOstreeContext *self,
g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.clientlayer",
g_variant_new_boolean (TRUE));


/* Record the rpm-md information on the client just like we do on the server side */
g_autoptr(GVariant) rpmmd_meta = rpmostree_context_get_rpmmd_repo_commit_metadata (self);
g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.rpmmd-repos", rpmmd_meta);

/* embed packages (really, "patterns") layered */
g_autoptr(GVariant) pkgs =
g_variant_dict_lookup_value (self->spec->dict, "packages", G_VARIANT_TYPE ("as"));
Expand Down
2 changes: 2 additions & 0 deletions src/libpriv/rpmostree-importer.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ get_lead_sig_header_as_bytes (RpmOstreeImporter *self,
* https://github.com/rpm-software-management/libdnf/pull/199/
* https://github.com/projectatomic/rpm-ostree/issues/774
* https://github.com/projectatomic/rpm-ostree/pull/1072
*
* Note overlap with rpmostree_context_get_rpmmd_repo_commit_metadata()
*/
static GVariant *
repo_metadata_for_package (DnfRepo *repo)
Expand Down
6 changes: 6 additions & 0 deletions tests/vmcheck/test-layering-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ vm_cmd ostree show --print-metadata-key rpmostree.repo ${pkgref} >refdata.txt
assert_file_has_content refdata.txt 'id.*test-repo'
assert_file_has_content refdata.txt 'timestamp'
rm -f refs.txt refdata.txt
# And that we have rpmmd-repos on the layered commit
vm_cmd ostree show --print-metadata-key rpmostree.rpmmd-repos $(vm_get_deployment_info 0 checksum) > rpmmd-meta.txt
assert_file_has_content rpmmd-meta.txt 'id.*test-repo'
assert_file_has_content rpmmd-meta.txt 'timestamp'
rm -f rpmmd-meta.txt

# This will cover things like us failing to break hardlinks for the rpmdb,
# as well as rofiles-fuse
vm_cmd ostree fsck
Expand Down

0 comments on commit 9cbec27

Please sign in to comment.