From 0522b9508337c52db1b85968d8f841da0c6d35c8 Mon Sep 17 00:00:00 2001 From: Ruixin Date: Fri, 21 Jul 2017 00:35:26 +0000 Subject: [PATCH] Deployment: add ostree.endoflife When metadata contains ostree.endoflife attribute, its information will be added to the deployment Variant, which will later be shown in rpm-ostree status command --- src/app/rpmostree-builtin-status.c | 6 ++++++ src/daemon/rpmostreed-deployment-utils.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/rpmostree-builtin-status.c b/src/app/rpmostree-builtin-status.c index e19eb107ac..02008c053f 100644 --- a/src/app/rpmostree-builtin-status.c +++ b/src/app/rpmostree-builtin-status.c @@ -244,6 +244,7 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy, const gchar *os_name; const gchar *checksum; const gchar *version_string; + const gchar *end_of_life_string; const gchar *unlocked; const gchar *live_inprogress; const gchar *live_replaced; @@ -563,6 +564,11 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy, print_kv ("Unlocked", max_key_len, unlocked); g_print ("%s%s", bold_suffix, red_suffix); } + /* look for ostree.endoflife attribute in the deployment */ + g_variant_dict_lookup (dict, "ostree.endoflife", "&s", &end_of_life_string); + + if (end_of_life_string) + g_print ("\n end-of-life: %s", end_of_life_string); } return TRUE; diff --git a/src/daemon/rpmostreed-deployment-utils.c b/src/daemon/rpmostreed-deployment-utils.c index ee8f18163a..0c4fc5a7f5 100644 --- a/src/daemon/rpmostreed-deployment-utils.c +++ b/src/daemon/rpmostreed-deployment-utils.c @@ -133,12 +133,21 @@ variant_add_commit_details (GVariantDict *dict, { g_autoptr(GVariant) metadata = NULL; g_autofree gchar *version_commit = NULL; + g_autofree gchar *end_of_life = NULL; guint64 timestamp = 0; timestamp = ostree_commit_get_timestamp (commit); metadata = g_variant_get_child_value (commit, 0); if (metadata != NULL) - g_variant_lookup (metadata, "version", "s", &version_commit); + { + g_variant_lookup (metadata, "version", "s", &version_commit); + /* only add the attribute for the base commit */ + if (prefix != NULL) + g_variant_lookup (metadata, "ostree.endoflife", "s", &end_of_life); + } + + if (end_of_life != NULL) + g_variant_dict_insert (dict, "ostree.endoflife", "s", end_of_life); if (version_commit != NULL) g_variant_dict_insert (dict, glnx_strjoina (prefix ?: "", "version"),