From 7c570a2e8e91fbcd4701fa8e7860224ec590832e Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Fri, 14 Sep 2018 10:52:23 -0400 Subject: [PATCH] libpriv/util: Add getter for layer version Prep for another patch. Some callers will need to know whether some layers contain certain fixes before proceeding. We already have that information handy so just expose it. We should probably do something about that massive argument list... will return to that at some point. But at least with the new base layer accessor from the previous patch, there aren't many callers affected by the added argument. Closes: #1560 Approved by: cgwalters --- src/daemon/rpmostreed-deployment-utils.c | 7 ++++--- src/daemon/rpmostreed-transaction-types.c | 2 +- src/libpriv/rpmostree-util.c | 7 +++++-- src/libpriv/rpmostree-util.h | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/daemon/rpmostreed-deployment-utils.c b/src/daemon/rpmostreed-deployment-utils.c index 9d8f31fa..7014bac7 100644 --- a/src/daemon/rpmostreed-deployment-utils.c +++ b/src/daemon/rpmostreed-deployment-utils.c @@ -265,9 +265,10 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, g_auto(GStrv) layered_pkgs = NULL; g_autoptr(GVariant) removed_base_pkgs = NULL; g_autoptr(GVariant) replaced_base_pkgs = NULL; - if (!rpmostree_deployment_get_layered_info (repo, deployment, &is_layered, &base_checksum, - &layered_pkgs, &removed_base_pkgs, - &replaced_base_pkgs, error)) + if (!rpmostree_deployment_get_layered_info (repo, deployment, &is_layered, NULL, + &base_checksum, &layered_pkgs, + &removed_base_pkgs, &replaced_base_pkgs, + error)) return NULL; g_autoptr(GVariant) base_commit = NULL; diff --git a/src/daemon/rpmostreed-transaction-types.c b/src/daemon/rpmostreed-transaction-types.c index d4a843ce..1f5ecd68 100644 --- a/src/daemon/rpmostreed-transaction-types.c +++ b/src/daemon/rpmostreed-transaction-types.c @@ -1041,7 +1041,7 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, g_autoptr(GVariant) removed = NULL; g_autoptr(GVariant) replaced = NULL; if (!rpmostree_deployment_get_layered_info (repo, merge_deployment, NULL, NULL, NULL, - &removed, &replaced, error)) + NULL, &removed, &replaced, error)) return FALSE; g_autoptr(GHashTable) nevra_to_name = g_hash_table_new (g_str_hash, g_str_equal); diff --git a/src/libpriv/rpmostree-util.c b/src/libpriv/rpmostree-util.c index 2136b6f1..7fc8f090 100644 --- a/src/libpriv/rpmostree-util.c +++ b/src/libpriv/rpmostree-util.c @@ -483,6 +483,7 @@ gboolean rpmostree_deployment_get_layered_info (OstreeRepo *repo, OstreeDeployment *deployment, gboolean *out_is_layered, + guint *out_layer_version, char **out_base_layer, char ***out_layered_pkgs, GVariant **out_removed_base_pkgs, @@ -564,6 +565,8 @@ rpmostree_deployment_get_layered_info (OstreeRepo *repo, if (out_is_layered != NULL) *out_is_layered = is_layered; + if (out_layer_version != NULL) + *out_layer_version = clientlayer_version; if (out_base_layer != NULL) *out_base_layer = g_steal_pointer (&base_layer); if (out_layered_pkgs != NULL) @@ -597,8 +600,8 @@ rpmostree_deployment_get_base_layer (OstreeRepo *repo, char **out_base_layer, GError **error) { - return rpmostree_deployment_get_layered_info (repo, deployment, NULL, out_base_layer, - NULL, NULL, NULL, error); + return rpmostree_deployment_get_layered_info (repo, deployment, NULL, NULL, + out_base_layer, NULL, NULL, NULL, error); } static gboolean diff --git a/src/libpriv/rpmostree-util.h b/src/libpriv/rpmostree-util.h index 64c2dca7..ccd2af7f 100644 --- a/src/libpriv/rpmostree-util.h +++ b/src/libpriv/rpmostree-util.h @@ -138,10 +138,12 @@ gboolean rpmostree_str_ptrarray_contains (GPtrArray *strs, const char *str); +/* XXX: just return a struct out of these */ gboolean rpmostree_deployment_get_layered_info (OstreeRepo *repo, OstreeDeployment *deployment, gboolean *out_is_layered, + guint *out_layer_version, char **out_base_layer, char ***out_layered_pkgs, GVariant **out_removed_base_pkgs,