diff --git a/src/app/rpmostree-builtin-status.c b/src/app/rpmostree-builtin-status.c index df15da2e4a..f5ab3ed221 100644 --- a/src/app/rpmostree-builtin-status.c +++ b/src/app/rpmostree-builtin-status.c @@ -216,6 +216,8 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy, { g_autoptr(GVariant) child = g_variant_iter_next_value (&iter); g_autoptr(GVariantDict) dict = NULL; + g_autoptr(GVariantDict) commit_meta_dict = NULL; + g_autoptr(GVariantDict) layered_commit_meta_dict = NULL; gboolean is_locally_assembled = FALSE; g_autofree const gchar **origin_packages = NULL; g_autofree const gchar **origin_requested_packages = NULL; @@ -307,6 +309,23 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy, if (base_checksum != NULL) is_locally_assembled = TRUE; + /* Load the commit metadata into a dict */ + { g_autoptr(GVariant) commit_meta_v = NULL; + g_assert (g_variant_dict_lookup (dict, "base-commit-meta", "@a{sv}", &commit_meta_v)); + commit_meta_dict = g_variant_dict_new (commit_meta_v); + } + if (is_locally_assembled) + { + g_autoptr(GVariant) layered_commit_meta_v = NULL; + g_assert (g_variant_dict_lookup (dict, "layered-commit-meta", "@a{sv}", &layered_commit_meta_v)); + layered_commit_meta_dict = g_variant_dict_new (layered_commit_meta_v); + } + + const gchar *source_title = NULL; + g_variant_dict_lookup (commit_meta_dict, OSTREE_COMMIT_META_KEY_SOURCE_TITLE, "&s", &source_title); + if (source_title) + g_print (" %s %s\n", libsd_special_glyph (TREE_RIGHT), source_title); + if (is_locally_assembled) g_assert (g_variant_dict_lookup (dict, "base-timestamp", "t", &t)); else diff --git a/tests/vmcheck/overlay.sh b/tests/vmcheck/overlay.sh index 4f613fbddb..99a2724624 100755 --- a/tests/vmcheck/overlay.sh +++ b/tests/vmcheck/overlay.sh @@ -21,13 +21,19 @@ set -x # And then this code path in the VM -# get csum of current default deployment +# get csum and origin of current default deployment commit=$(rpm-ostree status --json | \ python -c ' import sys, json; deployment = json.load(sys.stdin)["deployments"][0] print deployment["checksum"] exit()') +origin=$(rpm-ostree status --json | \ + python -c ' +import sys, json; +deployment = json.load(sys.stdin)["deployments"][0] +print deployment["origin"] +exit()') if [[ -z $commit ]] || ! ostree rev-parse $commit; then echo "Error while determining current commit" >&2 @@ -59,6 +65,6 @@ fi rm -vrf vmcheck/usr/etc/selinux/targeted/semanage.*.LOCK # ✀✀✀ END tmp hack -ostree commit --parent=none -b vmcheck --link-checkout-speedup \ +ostree commit --parent=none -b vmcheck --add-metadata-string=ostree.source-title="Dev overlay on ${origin}" --add-metadata-string=rpmostree.original-origin=${origin} --link-checkout-speedup \ --selinux-policy=vmcheck --tree=dir=vmcheck ostree admin deploy vmcheck diff --git a/tests/vmcheck/test-basic.sh b/tests/vmcheck/test-basic.sh index 61ca6a59b9..5d93f7b9a0 100755 --- a/tests/vmcheck/test-basic.sh +++ b/tests/vmcheck/test-basic.sh @@ -32,7 +32,7 @@ vm_assert_status_jq \ '.deployments[0]["requested-local-packages"]' \ '.deployments[0]["base-removals"]' \ '.deployments[0]["requested-base-removals"]' \ - '.deployments[0]["base-commit-meta"]' \ + '.deployments[0]["base-commit-meta"]["ostree.source-title"]|contains("overlay")' \ '.deployments[0]["layered-commit-meta"]|not' echo "ok empty pkg arrays, and commit meta correct in status json"