summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-10-13 19:55:16 -0400
committerColin Walters <walters@verbum.org>2012-10-14 17:10:57 -0400
commit0d04738801a066a96cd8c5bd0c3bb5becabc4032 (patch)
tree75a18dffc9f6142b08fb9280c4fd61bd47ab0eb5
parent2b90e987bff45dea9f8f0df7876affdc7a9286c7 (diff)
downloadostree-0d04738801a066a96cd8c5bd0c3bb5becabc4032.tar.gz
core: Rework archive-z mode to have header be uncompressed
This is an incompatible change to archive-z, thus it is now renamed to archive-z2 and ostree will no longer parse archive-z. I noticed in perf that we were spending some time zlib-decompressing file headers, which is just inefficient. Rather than do this, keep the headers uncompressed, and just zlib-compress content.
-rw-r--r--src/libostree/ostree-core.c183
-rw-r--r--src/libostree/ostree-core.h40
-rw-r--r--src/libostree/ostree-repo.c112
-rw-r--r--src/libostree/ostree-repo.h2
-rw-r--r--src/ostree/ostree-pull.c27
-rwxr-xr-xtests/t0002-archivez.sh2
-rwxr-xr-xtests/t0011-pull-archive-z.sh2
7 files changed, 235 insertions, 133 deletions
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index ac9bc2e6..8b77a36a 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -28,6 +28,8 @@
#include "ostree.h"
#include "otutil.h"
+#include <gio/gfiledescriptorbased.h>
+
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
@@ -239,6 +241,41 @@ ostree_file_header_new (GFileInfo *file_info,
return ret;
}
+GVariant *
+ostree_zlib_file_header_new (GFileInfo *file_info,
+ GVariant *xattrs)
+{
+ guint64 size;
+ guint32 uid;
+ guint32 gid;
+ guint32 mode;
+ guint32 rdev;
+ const char *symlink_target;
+ GVariant *ret;
+ ot_lvariant GVariant *tmp_xattrs = NULL;
+
+ size = g_file_info_get_size (file_info);
+ uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid");
+ gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid");
+ mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
+ rdev = g_file_info_get_attribute_uint32 (file_info, "unix::rdev");
+
+ if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_SYMBOLIC_LINK)
+ symlink_target = g_file_info_get_symlink_target (file_info);
+ else
+ symlink_target = "";
+
+ if (xattrs == NULL)
+ tmp_xattrs = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("(ayay)"), NULL, 0));
+
+ ret = g_variant_new ("(tuuuus@a(ayay))",
+ GUINT64_TO_BE (size), GUINT32_TO_BE (uid),
+ GUINT32_TO_BE (gid), GUINT32_TO_BE (mode), GUINT32_TO_BE (rdev),
+ symlink_target, xattrs ? xattrs : tmp_xattrs);
+ g_variant_ref_sink (ret);
+ return ret;
+}
+
static gboolean
write_padding (GOutputStream *output,
guint alignment,
@@ -390,7 +427,8 @@ ostree_raw_file_to_content_stream (GInputStream *input,
}
gboolean
-ostree_content_stream_parse (GInputStream *input,
+ostree_content_stream_parse (gboolean compressed,
+ GInputStream *input,
guint64 input_length,
gboolean trusted,
GInputStream **out_input,
@@ -439,18 +477,29 @@ ostree_content_stream_parse (GInputStream *input,
if (!g_input_stream_read_all (input, buf, archive_header_size, &bytes_read,
cancellable, error))
goto out;
- file_header = g_variant_new_from_data (OSTREE_FILE_HEADER_GVARIANT_FORMAT,
+ file_header = g_variant_new_from_data (compressed ? OSTREE_ZLIB_FILE_HEADER_GVARIANT_FORMAT : OSTREE_FILE_HEADER_GVARIANT_FORMAT,
buf, archive_header_size, trusted,
g_free, buf);
buf = NULL;
- if (!ostree_file_header_parse (file_header,
- out_file_info ? &ret_file_info : NULL,
- out_xattrs ? &ret_xattrs : NULL,
- error))
- goto out;
- if (ret_file_info)
- g_file_info_set_size (ret_file_info, input_length - archive_header_size - 8);
+ if (compressed)
+ {
+ if (!ostree_zlib_file_header_parse (file_header,
+ out_file_info ? &ret_file_info : NULL,
+ out_xattrs ? &ret_xattrs : NULL,
+ error))
+ goto out;
+ }
+ else
+ {
+ if (!ostree_file_header_parse (file_header,
+ out_file_info ? &ret_file_info : NULL,
+ out_xattrs ? &ret_xattrs : NULL,
+ error))
+ goto out;
+ if (ret_file_info)
+ g_file_info_set_size (ret_file_info, input_length - archive_header_size - 8);
+ }
if (g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR
&& out_input)
@@ -459,7 +508,13 @@ ostree_content_stream_parse (GInputStream *input,
* assuming the caller doesn't seek, this should be fine. We might
* want to wrap it though in a non-seekable stream.
**/
- ret_input = g_object_ref (input);
+ if (compressed)
+ {
+ ot_lobj GConverter *zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW);
+ ret_input = g_converter_input_stream_new (input, zlib_decomp);
+ }
+ else
+ ret_input = g_object_ref (input);
}
ret = TRUE;
@@ -468,39 +523,11 @@ ostree_content_stream_parse (GInputStream *input,
ot_transfer_out_value (out_xattrs, &ret_xattrs);
out:
return ret;
-
-}
-
-gboolean
-ostree_zlib_content_stream_open (GInputStream *input,
- guint64 *out_len,
- GInputStream **out_uncompressed,
- GCancellable *cancellable,
- GError **error)
-{
- gboolean ret = FALSE;
- guint64 uncompressed_len;
- ot_lobj GConverter *zlib_decomp = NULL;
- ot_lobj GInputStream *uncomp_input = NULL;
-
- if (!g_input_stream_read_all (input, &uncompressed_len, sizeof (guint64),
- NULL, cancellable, error))
- goto out;
-
- uncompressed_len = GUINT64_FROM_BE (uncompressed_len);
- zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW);
- uncomp_input = g_converter_input_stream_new (input, zlib_decomp);
-
- if (out_len)
- *out_len = uncompressed_len;
- ot_transfer_out_value (out_uncompressed, &uncomp_input);
- ret = TRUE;
- out:
- return ret;
}
gboolean
-ostree_content_file_parse (GFile *content_path,
+ostree_content_file_parse (gboolean compressed,
+ GFile *content_path,
gboolean trusted,
GInputStream **out_input,
GFileInfo **out_file_info,
@@ -510,6 +537,7 @@ ostree_content_file_parse (GFile *content_path,
{
gboolean ret = FALSE;
guint64 length;
+ struct stat stbuf;
ot_lobj GInputStream *file_input = NULL;
ot_lobj GInputStream *ret_input = NULL;
ot_lobj GFileInfo *content_file_info = NULL;
@@ -520,15 +548,15 @@ ostree_content_file_parse (GFile *content_path,
if (!file_input)
goto out;
- content_file_info = g_file_input_stream_query_info ((GFileInputStream*)file_input,
- OSTREE_GIO_FAST_QUERYINFO,
- cancellable, error);
- if (!content_file_info)
- goto out;
+ if (fstat (g_file_descriptor_based_get_fd ((GFileDescriptorBased*)file_input), &stbuf) < 0)
+ {
+ ot_util_set_error_from_errno (error, errno);
+ goto out;
+ }
- length = g_file_info_get_size (content_file_info);
+ length = stbuf.st_size;
- if (!ostree_content_stream_parse (file_input, length, trusted,
+ if (!ostree_content_stream_parse (compressed, file_input, length, trusted,
out_input ? &ret_input : NULL,
&ret_file_info, &ret_xattrs,
cancellable, error))
@@ -1034,6 +1062,67 @@ ostree_file_header_parse (GVariant *metadata,
}
gboolean
+ostree_zlib_file_header_parse (GVariant *metadata,
+ GFileInfo **out_file_info,
+ GVariant **out_xattrs,
+ GError **error)
+{
+ gboolean ret = FALSE;
+ guint64 size;
+ guint32 uid, gid, mode, rdev;
+ const char *symlink_target;
+ ot_lobj GFileInfo *ret_file_info = NULL;
+ ot_lvariant GVariant *ret_xattrs = NULL;
+
+ g_variant_get (metadata, "(tuuuu&s@a(ayay))", &size,
+ &uid, &gid, &mode, &rdev,
+ &symlink_target, &ret_xattrs);
+
+ size = GUINT64_FROM_BE (size);
+ uid = GUINT32_FROM_BE (uid);
+ gid = GUINT32_FROM_BE (gid);
+ mode = GUINT32_FROM_BE (mode);
+ rdev = GUINT32_FROM_BE (rdev);
+
+ ret_file_info = g_file_info_new ();
+ g_file_info_set_size (ret_file_info, size);
+ g_file_info_set_attribute_uint32 (ret_file_info, "standard::type", ot_gfile_type_for_mode (mode));
+ g_file_info_set_attribute_boolean (ret_file_info, "standard::is-symlink", S_ISLNK (mode));
+ g_file_info_set_attribute_uint32 (ret_file_info, "unix::uid", uid);
+ g_file_info_set_attribute_uint32 (ret_file_info, "unix::gid", gid);
+ g_file_info_set_attribute_uint32 (ret_file_info, "unix::mode", mode);
+
+ if (S_ISREG (mode))
+ {
+ ;
+ }
+ else if (S_ISLNK (mode))
+ {
+ g_file_info_set_attribute_byte_string (ret_file_info, "standard::symlink-target", symlink_target);
+ }
+ else if (S_ISCHR (mode) || S_ISBLK (mode))
+ {
+ g_file_info_set_attribute_uint32 (ret_file_info, "unix::rdev", rdev);
+ }
+ else if (S_ISFIFO (mode))
+ {
+ ;
+ }
+ else
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Corrupted archive file; invalid mode %u", mode);
+ goto out;
+ }
+
+ ret = TRUE;
+ ot_transfer_out_value(out_file_info, &ret_file_info);
+ ot_transfer_out_value(out_xattrs, &ret_xattrs);
+ out:
+ return ret;
+}
+
+gboolean
ostree_create_file_from_input (GFile *dest_file,
GFileInfo *finfo,
GVariant *xattrs,
diff --git a/src/libostree/ostree-core.h b/src/libostree/ostree-core.h
index da044507..83f688b1 100644
--- a/src/libostree/ostree-core.h
+++ b/src/libostree/ostree-core.h
@@ -87,6 +87,21 @@ typedef enum {
*/
#define OSTREE_COMMIT_GVARIANT_FORMAT G_VARIANT_TYPE ("(a{sv}aya(say)sstayay)")
+/*
+ * filez objects:
+ * <BE guint32 containing variant length>
+ * t - size
+ * u - uid
+ * u - gid
+ * u - mode
+ * u - rdev
+ * s - symlink target
+ * a(ayay) - xattrs
+ * ---
+ * zlib-compressed data
+ */
+#define OSTREE_ZLIB_FILE_HEADER_GVARIANT_FORMAT G_VARIANT_TYPE ("(tuuuusa(ayay))")
+
const GVariantType *ostree_metadata_variant_type (OstreeObjectType objtype);
gboolean ostree_validate_checksum_string (const char *sha256,
@@ -145,9 +160,6 @@ gboolean ostree_map_metadata_file (GFile *file,
GVariant **out_variant,
GError **error);
-GVariant *ostree_file_header_new (GFileInfo *file_info,
- GVariant *xattrs);
-
gboolean ostree_write_variant_with_size (GOutputStream *output,
GVariant *variant,
guint64 alignment_offset,
@@ -156,12 +168,23 @@ gboolean ostree_write_variant_with_size (GOutputStream *output,
GCancellable *cancellable,
GError **error);
+GVariant *ostree_file_header_new (GFileInfo *file_info,
+ GVariant *xattrs);
+GVariant *ostree_zlib_file_header_new (GFileInfo *file_info,
+ GVariant *xattrs);
+
gboolean ostree_file_header_parse (GVariant *data,
GFileInfo **out_file_info,
GVariant **out_xattrs,
GError **error);
+gboolean ostree_zlib_file_header_parse (GVariant *data,
+ GFileInfo **out_file_info,
+ GVariant **out_xattrs,
+ GError **error);
+
gboolean
-ostree_content_stream_parse (GInputStream *input,
+ostree_content_stream_parse (gboolean compressed,
+ GInputStream *input,
guint64 input_length,
gboolean trusted,
GInputStream **out_input,
@@ -170,13 +193,8 @@ ostree_content_stream_parse (GInputStream *input,
GCancellable *cancellable,
GError **error);
-gboolean ostree_zlib_content_stream_open (GInputStream *input,
- guint64 *out_len,
- GInputStream **out_uncompressed,
- GCancellable *cancellable,
- GError **error);
-
-gboolean ostree_content_file_parse (GFile *content_path,
+gboolean ostree_content_file_parse (gboolean compressed,
+ GFile *content_path,
gboolean trusted,
GInputStream **out_input,
GFileInfo **out_file_info,
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 4033f296..29d14182 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -589,8 +589,8 @@ ostree_repo_mode_from_string (const char *mode,
ret_mode = OSTREE_REPO_MODE_BARE;
else if (strcmp (mode, "archive") == 0)
ret_mode = OSTREE_REPO_MODE_ARCHIVE;
- else if (strcmp (mode, "archive-z") == 0)
- ret_mode = OSTREE_REPO_MODE_ARCHIVE_Z;
+ else if (strcmp (mode, "archive-z2") == 0)
+ ret_mode = OSTREE_REPO_MODE_ARCHIVE_Z2;
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -886,46 +886,13 @@ stage_object (OstreeRepo *self,
checksum_input = ostree_checksum_input_stream_new (input, checksum);
}
- if (objtype == OSTREE_OBJECT_TYPE_FILE
- && repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z)
- {
- gssize bytes_written;
- guint64 len_be;
- ot_lobj GOutputStream *raw_out_stream = NULL;
- ot_lobj GConverter *zlib_compressor = NULL;
- ot_lobj GOutputStream *compressed_out_stream = NULL;
-
- if (!ostree_create_temp_regular_file (self->tmp_dir,
- ostree_object_type_to_string (objtype), NULL,
- &temp_file, &raw_out_stream,
- cancellable, error))
- goto out;
-
- len_be = GUINT64_TO_BE (file_object_length);
- if (!g_output_stream_write_all (raw_out_stream, (const guchar*) &len_be,
- sizeof (guint64), NULL, cancellable, error))
- goto out;
-
- zlib_compressor = (GConverter*)g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW, 9);
- compressed_out_stream = g_converter_output_stream_new (raw_out_stream, zlib_compressor);
-
- bytes_written = g_output_stream_splice (compressed_out_stream,
- checksum_input ? (GInputStream*)checksum_input : input,
- G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
- cancellable, error);
- if (bytes_written < 0)
- goto out;
-
- staged_raw_file = TRUE;
- temp_file_is_regular = TRUE;
- }
- else if (objtype == OSTREE_OBJECT_TYPE_FILE)
+ if (objtype == OSTREE_OBJECT_TYPE_FILE)
{
ot_lobj GInputStream *file_input = NULL;
ot_lobj GFileInfo *file_info = NULL;
ot_lvariant GVariant *xattrs = NULL;
- if (!ostree_content_stream_parse (checksum_input ? (GInputStream*)checksum_input : input,
+ if (!ostree_content_stream_parse (FALSE, checksum_input ? (GInputStream*)checksum_input : input,
file_object_length, FALSE,
&file_input, &file_info, &xattrs,
cancellable, error))
@@ -943,6 +910,40 @@ stage_object (OstreeRepo *self,
goto out;
staged_raw_file = TRUE;
}
+ else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
+ {
+ ot_lvariant GVariant *file_meta = NULL;
+ ot_lobj GOutputStream *temp_out = NULL;
+ ot_lobj GConverter *zlib_compressor = NULL;
+ ot_lobj GOutputStream *compressed_out_stream = NULL;
+
+ if (!ostree_create_temp_regular_file (self->tmp_dir,
+ ostree_object_type_to_string (objtype), NULL,
+ &temp_file, &temp_out,
+ cancellable, error))
+ goto out;
+ temp_file_is_regular = TRUE;
+
+ file_meta = ostree_zlib_file_header_new (file_info, xattrs);
+
+ if (!ostree_write_variant_with_size (temp_out, file_meta, 0, NULL, NULL,
+ cancellable, error))
+ goto out;
+
+ if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
+ {
+ zlib_compressor = (GConverter*)g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW, 9);
+ compressed_out_stream = g_converter_output_stream_new (temp_out, zlib_compressor);
+
+ if (g_output_stream_splice (compressed_out_stream, file_input,
+ G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
+ cancellable, error) < 0)
+ goto out;
+ }
+
+ if (!g_output_stream_close (temp_out, cancellable, error))
+ goto out;
+ }
else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE)
{
ot_lvariant GVariant *file_meta = NULL;
@@ -1043,7 +1044,7 @@ stage_object (OstreeRepo *self,
ot_lvariant GVariant *xattrs = NULL;
gboolean is_regular;
- if (!ostree_content_file_parse (temp_file, FALSE, &file_input,
+ if (!ostree_content_file_parse (FALSE, temp_file, FALSE, &file_input,
&file_info, &xattrs,
cancellable, error))
goto out;
@@ -1112,7 +1113,7 @@ get_loose_object_dirs (OstreeRepo *self,
ret_object_dirs = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
- if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE_Z)
+ if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE_Z2)
object_dir_to_scan = self->uncompressed_objects_dir;
else
object_dir_to_scan = self->objects_dir;
@@ -1249,7 +1250,7 @@ scan_loose_devino (OstreeRepo *self,
case OSTREE_REPO_MODE_ARCHIVE:
skip = !g_str_has_suffix (name, ".filecontent");
break;
- case OSTREE_REPO_MODE_ARCHIVE_Z:
+ case OSTREE_REPO_MODE_ARCHIVE_Z2:
skip = !g_str_has_suffix (name, ".filez");
break;
case OSTREE_REPO_MODE_BARE:
@@ -1542,7 +1543,7 @@ ostree_repo_get_object_path (OstreeRepo *self,
gboolean compressed;
compressed = (type == OSTREE_OBJECT_TYPE_FILE
- && ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE_Z);
+ && ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE_Z2);
relpath = ostree_get_relative_object_path (checksum, type, compressed);
ret = g_file_resolve_relative_path (self->repodir, relpath);
g_free (relpath);
@@ -1860,7 +1861,7 @@ ostree_repo_write_ref (OstreeRepo *self,
goto out;
if (self->mode == OSTREE_REPO_MODE_ARCHIVE
- || self->mode == OSTREE_REPO_MODE_ARCHIVE_Z)
+ || self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
{
if (!write_ref_summary (self, NULL, error))
goto out;
@@ -2823,23 +2824,12 @@ ostree_repo_load_file (OstreeRepo *self,
}
}
break;
- case OSTREE_REPO_MODE_ARCHIVE_Z:
+ case OSTREE_REPO_MODE_ARCHIVE_Z2:
{
- ot_lobj GInputStream *file_in = NULL;
- ot_lobj GInputStream *uncomp_input = NULL;
- guint64 uncompressed_len;
-
- file_in = (GInputStream*)gs_file_read_noatime (loose_path, cancellable, error);
- if (!file_in)
- goto out;
-
- if (!ostree_zlib_content_stream_open (file_in, &uncompressed_len, &uncomp_input,
- cancellable, error))
- goto out;
-
- if (!ostree_content_stream_parse (uncomp_input, uncompressed_len, TRUE,
- &ret_input, &ret_file_info, &ret_xattrs,
- cancellable, error))
+ if (!ostree_content_file_parse (TRUE, loose_path, TRUE,
+ out_input ? &ret_input : NULL,
+ &ret_file_info, &ret_xattrs,
+ cancellable, error))
goto out;
}
break;
@@ -3277,7 +3267,7 @@ find_loose_for_checkout (OstreeRepo *self,
case OSTREE_REPO_MODE_ARCHIVE:
path = ostree_repo_get_archive_content_path (self, checksum);
break;
- case OSTREE_REPO_MODE_ARCHIVE_Z:
+ case OSTREE_REPO_MODE_ARCHIVE_Z2:
{
if (self->enable_uncompressed_cache)
path = get_uncompressed_object_cache_path (self, checksum);
@@ -3385,7 +3375,7 @@ checkout_file_thread (GSimpleAsyncResult *result,
if (!is_symlink &&
((checkout_data->repo->mode == OSTREE_REPO_MODE_BARE && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_NONE)
|| (checkout_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER)
- || (checkout_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER)))
+ || (checkout_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2 && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER)))
{
if (!find_loose_for_checkout (checkout_data->repo, checksum, &loose_path,
cancellable, error))
@@ -3396,7 +3386,7 @@ checkout_file_thread (GSimpleAsyncResult *result,
*/
if (!is_symlink
&& loose_path == NULL
- && repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z
+ && repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
&& checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER
&& repo->enable_uncompressed_cache)
{
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index baed3ce9..4b11c81d 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -45,7 +45,7 @@ GFile * ostree_repo_get_path (OstreeRepo *self);
typedef enum {
OSTREE_REPO_MODE_BARE,
OSTREE_REPO_MODE_ARCHIVE,
- OSTREE_REPO_MODE_ARCHIVE_Z
+ OSTREE_REPO_MODE_ARCHIVE_Z2
} OstreeRepoMode;
gboolean ostree_repo_mode_from_string (const char *mode,
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index 765976e9..4c0e2ddd 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/ostree/ostree-pull.c
@@ -389,7 +389,7 @@ scan_dirtree_object (OtPullData *pull_data,
{
gboolean ret = FALSE;
int i, n;
- gboolean compressed = pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z;
+ gboolean compressed = pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z2;
ot_lvariant GVariant *tree = NULL;
ot_lvariant GVariant *files_variant = NULL;
ot_lvariant GVariant *dirs_variant = NULL;
@@ -557,7 +557,7 @@ process_one_file_request (OtFetchOneContentItemData *data)
{
OtPullData *pull_data = data->pull_data;
const char *checksum = data->checksum;
- gboolean compressed = pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z;
+ gboolean compressed = pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z2;
ot_lfree char *objpath = NULL;
SoupURI *obj_uri = NULL;
@@ -593,7 +593,7 @@ content_fetch_on_complete (GObject *object,
ot_lobj GInputStream *file_object_input = NULL;
ot_lvariant GVariant *xattrs = NULL;
- compressed = data->pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z;
+ compressed = data->pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z2;
was_content_fetch = data->fetching_content;
if (was_content_fetch)
@@ -637,20 +637,25 @@ content_fetch_on_complete (GObject *object,
if (!need_content_fetch && compressed)
{
- ot_lobj GInputStream *uncomp_input = NULL;
+ ot_lobj GInputStream *file_in = NULL;
+ ot_lobj GFileInfo *file_info = NULL;
+ ot_lvariant GVariant *xattrs = NULL;
+ ot_lobj GInputStream *object_input = NULL;
g_assert (data->content_path != NULL);
- content_input = (GInputStream*)g_file_read (data->content_path, cancellable, error);
- if (!content_input)
+ if (!ostree_content_file_parse (TRUE, data->content_path, FALSE,
+ &file_in, &file_info, &xattrs,
+ cancellable, error))
goto out;
- if (!ostree_zlib_content_stream_open (content_input, &length, &uncomp_input,
- cancellable, error))
+ if (!ostree_raw_file_to_content_stream (file_in, file_info, xattrs,
+ &object_input, &length,
+ cancellable, error))
goto out;
data->pull_data->outstanding_content_stage_requests++;
ostree_repo_stage_content_async (data->pull_data->repo, data->checksum,
- uncomp_input, length,
+ object_input, length,
cancellable,
content_fetch_on_stage_complete, data);
}
@@ -797,7 +802,7 @@ idle_fetch_metadata_object (gpointer data)
SoupURI *obj_uri = NULL;
gboolean compressed;
- compressed = pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z;
+ compressed = pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z2;
ostree_object_name_deserialize (fetch_data->object, &checksum, &objtype);
@@ -1249,7 +1254,7 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
switch (pull_data->remote_mode)
{
case OSTREE_REPO_MODE_ARCHIVE:
- case OSTREE_REPO_MODE_ARCHIVE_Z:
+ case OSTREE_REPO_MODE_ARCHIVE_Z2:
break;
default:
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
diff --git a/tests/t0002-archivez.sh b/tests/t0002-archivez.sh
index 46248ead..08448162 100755
--- a/tests/t0002-archivez.sh
+++ b/tests/t0002-archivez.sh
@@ -23,7 +23,7 @@ set -e
echo '1..11'
-setup_test_repository "archive-z"
+setup_test_repository "archive-z2"
echo "ok setup"
. ${SRCDIR}/archive-test.sh
diff --git a/tests/t0011-pull-archive-z.sh b/tests/t0011-pull-archive-z.sh
index 2f80a153..c06003fa 100755
--- a/tests/t0011-pull-archive-z.sh
+++ b/tests/t0011-pull-archive-z.sh
@@ -23,6 +23,6 @@ set -e
echo '1..2'
-setup_fake_remote_repo1 "archive-z"
+setup_fake_remote_repo1 "archive-z2"
. ${SRCDIR}/pull-test.sh