admin: Add ot_admin_checksum_version to get a dup of the version for a commit

This commit is contained in:
James Antill authored and Colin Walters committed 2014-10-23 10:21:17 -04:00
1 parent 49de180191
commit 52c0d89a8c
2 files changed
+27

No files matched your search

+23
View File
@@ -48,3 +48,26 @@ ot_admin_require_booted_deployment_or_osname (OstreeSysroot *sysroot,
out:
return ret;
}
/**
* ot_admin_checksum_version:
* @checksum: A GVariant from an ostree checksum.
*
*
* Get the version metadata string from a commit variant object, if it exists.
*
* Returns: A newly allocated string of the version, or %NULL is none
*/
char *
ot_admin_checksum_version (GVariant *checksum)
{
gs_unref_variant 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);
}
+4
View File
@@ -32,5 +32,9 @@ ot_admin_require_booted_deployment_or_osname (OstreeSysroot *sysroot,
const char *osname,
GCancellable *cancellable,
GError **error);
char *
ot_admin_checksum_version (GVariant *checksum);
G_END_DECLS