diff --git a/src/daemon/rpmostreed-deployment-utils.c b/src/daemon/rpmostreed-deployment-utils.c index e5d4ab86ff..1699bdee9e 100644 --- a/src/daemon/rpmostreed-deployment-utils.c +++ b/src/daemon/rpmostreed-deployment-utils.c @@ -231,28 +231,36 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, &replaced_base_pkgs, error)) return NULL; + g_autoptr(GVariant) base_commit = NULL; if (is_layered) { - g_autoptr(GVariant) base_commit = NULL; - - if (!ostree_repo_load_variant (repo, - OSTREE_OBJECT_TYPE_COMMIT, - base_checksum, - &base_commit, - error)) + if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, + base_checksum, &base_commit, error)) return NULL; g_variant_dict_insert (&dict, "base-checksum", "s", base_checksum); variant_add_commit_details (&dict, "base-", base_commit); /* for layered commits, check if their base commit has end of life attribute */ variant_add_metadata_attribute (&dict, OSTREE_COMMIT_META_KEY_ENDOFLIFE, "endoflife", base_commit); + + /* See below for base commit metadata */ + g_autoptr(GVariant) layered_metadata = g_variant_get_child_value (commit, 0); + g_variant_dict_insert (&dict, "layered-commit-meta", "@a{sv}", layered_metadata); } else { + base_commit = g_variant_ref (commit); base_checksum = g_strdup (csum); variant_add_metadata_attribute (&dict, OSTREE_COMMIT_META_KEY_ENDOFLIFE, "endoflife", commit); } + /* We used to bridge individual keys, but that was annoying; just pass through all + * of the commit metadata. + */ + { g_autoptr(GVariant) base_meta = g_variant_get_child_value (commit, 0); + g_variant_dict_insert (&dict, "base-commit-meta", "@a{sv}", base_meta); + } + sigs = rpmostreed_deployment_gpg_results (repo, refspec, base_checksum, &gpg_enabled); variant_add_commit_details (&dict, NULL, commit); diff --git a/tests/vmcheck/test-basic.sh b/tests/vmcheck/test-basic.sh index 4ae27d1a0f..61ca6a59b9 100755 --- a/tests/vmcheck/test-basic.sh +++ b/tests/vmcheck/test-basic.sh @@ -31,8 +31,10 @@ vm_assert_status_jq \ '.deployments[0]["requested-packages"]' \ '.deployments[0]["requested-local-packages"]' \ '.deployments[0]["base-removals"]' \ - '.deployments[0]["requested-base-removals"]' -echo "ok empty pkg arrays in status json" + '.deployments[0]["requested-base-removals"]' \ + '.deployments[0]["base-commit-meta"]' \ + '.deployments[0]["layered-commit-meta"]|not' +echo "ok empty pkg arrays, and commit meta correct in status json" # Be sure an unprivileged user exists and that we can SSH into it. This is a bit # underhanded, but we need a bona fide user session to verify non-priv status, diff --git a/tests/vmcheck/test-layering-basic.sh b/tests/vmcheck/test-layering-basic.sh index 0e01444239..0c72a817c8 100755 --- a/tests/vmcheck/test-layering-basic.sh +++ b/tests/vmcheck/test-layering-basic.sh @@ -63,7 +63,9 @@ echo "ok pkg-add foo" vm_reboot vm_assert_status_jq \ '.deployments[0]["base-checksum"]' \ - '.deployments[0]["pending-base-checksum"]|not' + '.deployments[0]["pending-base-checksum"]|not' \ + '.deployments[0]["base-commit-meta"]' \ + '.deployments[0]["layered-commit-meta"]["rpmostree.clientlayer_version"] == 2' vm_assert_layered_pkg foo-1.0 present echo "ok pkg foo added"