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
This commit is contained in:
Jonathan Lebon 2018-09-14 10:52:23 -04:00 committed by Atomic Bot
parent 87ab4fafb6
commit 7c570a2e8e
4 changed files with 12 additions and 6 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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,