lib/repo: Update summary code to use newer hashing API
And drop the unnecessary wrapper. Closes: #1287 Approved by: jlebon
This commit is contained in:
parent
de5f781089
commit
40a0b9fb73
|
|
@ -4746,18 +4746,16 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||||
if (!glnx_openat_rdonly (self->repo_dir_fd, superblock, TRUE, &superblock_file_fd, error))
|
if (!glnx_openat_rdonly (self->repo_dir_fd, superblock, TRUE, &superblock_file_fd, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_autoptr(GInputStream) in_stream = g_unix_input_stream_new (superblock_file_fd, FALSE);
|
g_autoptr(GBytes) superblock_content = ot_fd_readall_or_mmap (superblock_file_fd, 0, error);
|
||||||
if (!in_stream)
|
if (!superblock_content)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
g_auto(OtChecksum) hasher = { 0, };
|
||||||
|
ot_checksum_init (&hasher);
|
||||||
|
ot_checksum_update_bytes (&hasher, superblock_content);
|
||||||
|
guint8 digest[OSTREE_SHA256_DIGEST_LEN];
|
||||||
|
ot_checksum_get_digest (&hasher, digest, sizeof (digest));
|
||||||
|
|
||||||
g_autofree guchar *csum = NULL;
|
g_variant_dict_insert_value (&deltas_builder, delta_names->pdata[i], ot_gvariant_new_bytearray (digest, sizeof (digest)));
|
||||||
if (!ot_gio_checksum_stream (in_stream,
|
|
||||||
&csum,
|
|
||||||
cancellable,
|
|
||||||
error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
g_variant_dict_insert_value (&deltas_builder, delta_names->pdata[i], ot_gvariant_new_bytearray (csum, 32));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delta_names->len > 0)
|
if (delta_names->len > 0)
|
||||||
|
|
|
||||||
|
|
@ -252,17 +252,6 @@ ot_gio_splice_get_checksum (GOutputStream *out,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
ot_gio_checksum_stream (GInputStream *in,
|
|
||||||
guchar **out_csum,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
if (!out_csum)
|
|
||||||
return TRUE;
|
|
||||||
return ot_gio_splice_get_checksum (NULL, in, out_csum, cancellable, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
ot_checksum_file_at (int dfd,
|
ot_checksum_file_at (int dfd,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
|
|
||||||
|
|
@ -88,11 +88,6 @@ gboolean ot_gio_splice_update_checksum (GOutputStream *out,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean ot_gio_checksum_stream (GInputStream *in,
|
|
||||||
guchar **out_csum,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
char * ot_checksum_file_at (int dfd,
|
char * ot_checksum_file_at (int dfd,
|
||||||
const char *path,
|
const char *path,
|
||||||
GChecksumType checksum_type,
|
GChecksumType checksum_type,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue