summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-static-delta-compilation.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-10-05 11:14:17 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-10-05 15:41:00 +0000
commitfc33ae018dccbcab633b69474db0811987355212 (patch)
treeb1a08152d553cc48e525000c6601ef4729dedb30 /src/libostree/ostree-repo-static-delta-compilation.c
parenta903f96673ec8c42c7ccc60018a56b09539ad8f9 (diff)
downloadostree-fc33ae018dccbcab633b69474db0811987355212.tar.gz
lib/deltas: Move variant read helper into the deltas code
What the deltas code is doing is weird/unfortunate. The name `ot_variant_read()` conflicts too much with `ot_variant_read_fd()`. Since nothing else uses it, move it into the deltas code. Closes: #1254 Approved by: jlebon
Diffstat (limited to 'src/libostree/ostree-repo-static-delta-compilation.c')
-rw-r--r--src/libostree/ostree-repo-static-delta-compilation.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c
index 759a75a4..a3b28470 100644
--- a/src/libostree/ostree-repo-static-delta-compilation.c
+++ b/src/libostree/ostree-repo-static-delta-compilation.c
@@ -1141,6 +1141,19 @@ get_fallback_headers (OstreeRepo *self,
return TRUE;
}
+/* Get an input stream for a GVariant */
+static GInputStream *
+variant_to_inputstream (GVariant *variant)
+{
+ GMemoryInputStream *ret = (GMemoryInputStream*)
+ g_memory_input_stream_new_from_data (g_variant_get_data (variant),
+ g_variant_get_size (variant),
+ NULL);
+ g_object_set_data_full ((GObject*)ret, "ot-variant-data",
+ g_variant_ref (variant), (GDestroyNotify) g_variant_unref);
+ return (GInputStream*)ret;
+}
+
/**
* ostree_repo_static_delta_generate:
* @self: Repo
@@ -1349,7 +1362,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
/* Hardcode xz for now */
compressor = (GConverter*)_ostree_lzma_compressor_new (NULL);
compression_type_char = 'x';
- part_payload_in = ot_variant_read (delta_part_content);
+ part_payload_in = variant_to_inputstream (delta_part_content);
part_payload_out = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
part_payload_compressor = (GConverterOutputStream*)g_converter_output_stream_new ((GOutputStream*)part_payload_out, compressor);
@@ -1386,7 +1399,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
g_ptr_array_add (part_temp_paths, g_steal_pointer (&part_tmpf));
}
- part_in = ot_variant_read (delta_part);
+ part_in = variant_to_inputstream (delta_part);
if (!ot_gio_splice_get_checksum (part_temp_outstream, part_in,
&part_checksum,
cancellable, error))