libpriv/util: Factor out function to get version

Will be used by the history work.

Closes: #1823
Approved by: mike-nguyen
This commit is contained in:
Jonathan Lebon 2019-05-01 10:04:01 -04:00 committed by Atomic Bot
parent fcd2afaade
commit 4499ac4ce0
3 changed files with 18 additions and 16 deletions

View File

@ -3544,21 +3544,6 @@ apply_rpmfi_overrides (RpmOstreeContext *self,
return TRUE;
}
/* FIXME: This is a copy of ot_admin_checksum_version */
static char *
checksum_version (GVariant *checksum)
{
g_autoptr(GVariant) metadata = NULL;
const char *ret = NULL;
metadata = g_variant_get_child_value (checksum, 0);
if (!g_variant_lookup (metadata, "version", "&s", &ret))
return NULL;
return g_strdup (ret);
}
static gboolean
add_install (RpmOstreeContext *self,
DnfPackage *pkg,
@ -4357,7 +4342,7 @@ rpmostree_context_commit (RpmOstreeContext *self,
if (!ostree_repo_load_commit (self->ostreerepo, parent, &commit, NULL, error))
return FALSE;
parent_version = checksum_version (commit);
parent_version = rpmostree_checksum_version (commit);
/* copy the version tag */
if (parent_version)

View File

@ -374,6 +374,21 @@ rpmostree_str_replace (const char *buf,
return g_regex_replace_literal (regex, buf, -1, 0, new, 0, error);
}
/* FIXME: This is a copy of ot_admin_checksum_version */
char *
rpmostree_checksum_version (GVariant *checksum)
{
g_autoptr(GVariant) metadata = NULL;
const char *ret = NULL;
metadata = g_variant_get_child_value (checksum, 0);
if (!g_variant_lookup (metadata, "version", "&s", &ret))
return NULL;
return g_strdup (ret);
}
static gboolean
pull_content_only_recurse (OstreeRepo *dest,
OstreeRepo *src,

View File

@ -88,6 +88,8 @@ rpmostree_str_replace (const char *buf,
const char *new,
GError **error);
char *
rpmostree_checksum_version (GVariant *checksum);
gboolean
rpmostree_pull_content_only (OstreeRepo *dest,