diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index ed606604..787664b3 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -117,6 +117,7 @@ ostree_content_stream_parse ostree_content_file_parse ostree_content_file_parse_at ostree_raw_file_to_archive_z2_stream +ostree_raw_file_to_archive_z2_stream_with_options ostree_raw_file_to_content_stream ostree_checksum_file_from_input ostree_checksum_file diff --git a/src/libostree/libostree.sym b/src/libostree/libostree.sym index a07e5d3b..7c7c3aef 100644 --- a/src/libostree/libostree.sym +++ b/src/libostree/libostree.sym @@ -381,12 +381,10 @@ global: * NOTE NOTE NOTE */ -/* Uncomment this when adding the first new symbol for 2 -LIBOSTREE_2017.XX { +LIBOSTREE_2017.3 { global: - someostree_symbol_deleteme; + ostree_raw_file_to_archive_z2_stream_with_options; } LIBOSTREE_2017.2; -*/ /* Stub section for the stable release *after* this development one; don't * edit this other than to update the last number. This is just a copy/paste diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index af36d98b..cf238b41 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -506,6 +506,46 @@ ostree_raw_file_to_archive_z2_stream (GInputStream *input, out_input, cancellable, error); } +/** + * ostree_raw_file_to_archive_z2_stream_with_options: + * @input: File raw content stream + * @file_info: A file info + * @xattrs: (allow-none): Optional extended attributes + * @options: (nullable): A GVariant `a{sv}` with an extensible set of flags + * @out_input: (out): Serialized object stream + * @cancellable: Cancellable + * @error: Error + * + * Like ostree_raw_file_to_archive_z2_stream(), but supports an extensible set + * of flags. The following flags are currently defined: + * + * - `compression-level` (`i`): Level of compression to use, 0–9, with 0 being + * the least compression, and <0 giving the default level (currently 6). + * + * Since: 2017.3 + */ +gboolean +ostree_raw_file_to_archive_z2_stream_with_options (GInputStream *input, + GFileInfo *file_info, + GVariant *xattrs, + GVariant *options, + GInputStream **out_input, + GCancellable *cancellable, + GError **error) +{ + gint compression_level = -1; + + if (options) + (void) g_variant_lookup (options, "compression-level", "i", &compression_level); + + if (compression_level < 0) + compression_level = OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL; + + return _ostree_raw_file_to_archive_stream (input, file_info, xattrs, + compression_level, + out_input, cancellable, error); +} + /** * ostree_raw_file_to_content_stream: * @input: File raw content stream diff --git a/src/libostree/ostree-core.h b/src/libostree/ostree-core.h index a3419949..bd3d5f2c 100644 --- a/src/libostree/ostree-core.h +++ b/src/libostree/ostree-core.h @@ -311,6 +311,16 @@ ostree_raw_file_to_archive_z2_stream (GInputStream *input, GCancellable *cancellable, GError **error); +_OSTREE_PUBLIC +gboolean +ostree_raw_file_to_archive_z2_stream_with_options (GInputStream *input, + GFileInfo *file_info, + GVariant *xattrs, + GVariant *options, + GInputStream **out_input, + GCancellable *cancellable, + GError **error); + _OSTREE_PUBLIC gboolean ostree_raw_file_to_content_stream (GInputStream *input, GFileInfo *file_info,