lib/deltas: Support signed delta in dump
This checks if the static delta file is signed or not to be able to correctly get the superblock to dump. Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
This commit is contained in:
parent
0c48423c26
commit
bf0c09ffe1
|
|
@ -819,6 +819,8 @@ _ostree_repo_static_delta_dump (OstreeRepo *self,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
glnx_autofd int superblock_fd = -1;
|
glnx_autofd int superblock_fd = -1;
|
||||||
|
g_autoptr(GVariant) delta = NULL;
|
||||||
|
g_autoptr(GVariant) delta_superblock = NULL;
|
||||||
|
|
||||||
if (strchr (delta_id, '/'))
|
if (strchr (delta_id, '/'))
|
||||||
{
|
{
|
||||||
|
|
@ -837,13 +839,28 @@ _ostree_repo_static_delta_dump (OstreeRepo *self,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_autoptr(GVariant) delta_superblock = NULL;
|
gboolean is_signed = _ostree_repo_static_delta_is_signed(self, superblock_fd, NULL, NULL);
|
||||||
if (!ot_variant_read_fd (superblock_fd, 0,
|
if (is_signed)
|
||||||
(GVariantType*)OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT,
|
{
|
||||||
TRUE, &delta_superblock, error))
|
if (!ot_variant_read_fd (superblock_fd, 0, (GVariantType*)OSTREE_STATIC_DELTA_SIGNED_FORMAT,
|
||||||
return FALSE;
|
TRUE, &delta, error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
g_autoptr(GVariant) child = g_variant_get_child_value (delta, 1);
|
||||||
|
g_autoptr(GBytes) bytes = g_variant_get_data_as_bytes(child);
|
||||||
|
delta_superblock = g_variant_new_from_bytes ((GVariantType*)OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT,
|
||||||
|
bytes, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!ot_variant_read_fd (superblock_fd, 0,
|
||||||
|
(GVariantType*)OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT,
|
||||||
|
TRUE, &delta_superblock, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
g_print ("Delta: %s\n", delta_id);
|
g_print ("Delta: %s\n", delta_id);
|
||||||
|
g_print ("Signed: %s\n", is_signed ? "yes" : "no");
|
||||||
g_autoptr(GVariant) from_commit_v = NULL;
|
g_autoptr(GVariant) from_commit_v = NULL;
|
||||||
g_variant_get_child (delta_superblock, 2, "@ay", &from_commit_v);
|
g_variant_get_child (delta_superblock, 2, "@ay", &from_commit_v);
|
||||||
g_autofree char *from_commit = NULL;
|
g_autofree char *from_commit = NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue