[ostree] core: Remove some useless wrapping of packfile unpacking in checkout
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Remove some useless wrapping of packfile unpacking in checkout
- Date: Wed, 7 Dec 2011 02:39:42 +0000 (UTC)
commit c32141c2bf654e2280e5410f23fa410809e815ee
Author: Colin Walters <walters verbum org>
Date: Tue Dec 6 20:09:09 2011 -0500
core: Remove some useless wrapping of packfile unpacking in checkout
src/libostree/ostree-core.c | 81 -------------------------------------------
src/libostree/ostree-repo.c | 14 +++++++-
2 files changed, 13 insertions(+), 82 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index edbd546..e4fc1f0 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -724,40 +724,6 @@ ostree_pack_file (GOutputStream *output,
return ret;
}
-static gboolean
-unpack_meta (GFile *file,
- GFile *dest_file,
- GChecksum **out_checksum,
- GError **error)
-{
- gboolean ret = FALSE;
- GFileInputStream *in = NULL;
- GChecksum *ret_checksum = NULL;
- GFileOutputStream *out = NULL;
-
- in = g_file_read (file, NULL, error);
- if (!in)
- goto out;
-
- out = g_file_replace (dest_file, NULL, FALSE, 0, NULL, error);
- if (!out)
- goto out;
-
- if (!ot_gio_splice_and_checksum ((GOutputStream*)out, (GInputStream*)in,
- out_checksum ? &ret_checksum : NULL, NULL, error))
- goto out;
-
- if (!g_output_stream_close ((GOutputStream*)out, NULL, error))
- goto out;
-
- ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
- out:
- ot_clear_checksum (&ret_checksum);
- g_clear_object (&in);
- return ret;
-}
-
gboolean
ostree_parse_packed_file (GFile *file,
GFileInfo **out_file_info,
@@ -1181,50 +1147,3 @@ ostree_create_temp_regular_file (GFile *dir,
g_clear_object (&ret_stream);
return ret;
}
-
-static gboolean
-unpack_file (GFile *file,
- GFile *dest_file,
- GChecksum **out_checksum,
- GCancellable *cancellable,
- GError **error)
-{
- gboolean ret = FALSE;
- GFileInfo *finfo;
- GVariant *metadata = NULL;
- GVariant *xattrs = NULL;
- GInputStream *in = NULL;
- GChecksum *ret_checksum = NULL;
-
- if (!ostree_parse_packed_file (file, &finfo, &xattrs, &in, cancellable, error))
- goto out;
-
- if (!ostree_create_file_from_input (dest_file, finfo, xattrs, in,
- OSTREE_OBJECT_TYPE_FILE,
- out_checksum ? &ret_checksum : NULL,
- cancellable, error))
- goto out;
-
- ret = TRUE;
- ot_transfer_out_value (out_checksum, ret_checksum);
- out:
- g_clear_object (&finfo);
- g_clear_object (&in);
- ot_clear_gvariant (&xattrs);
- ot_clear_gvariant (&metadata);
- ot_clear_checksum (&ret_checksum);
- return ret;
-}
-
-gboolean
-ostree_unpack_object (GFile *file,
- OstreeObjectType objtype,
- GFile *dest,
- GChecksum **out_checksum,
- GError **error)
-{
- if (objtype == OSTREE_OBJECT_TYPE_META)
- return unpack_meta (file, dest, out_checksum, error);
- else
- return unpack_file (file, dest, out_checksum, NULL, error);
-}
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 1b2052c..2b896a0 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2027,6 +2027,8 @@ checkout_tree (OstreeRepo *self,
gboolean ret = FALSE;
GError *temp_error = NULL;
GFileInfo *file_info = NULL;
+ GInputStream *packed_input = NULL;
+ GVariant *packed_xattrs = NULL;
GFileEnumerator *dir_enum = NULL;
GFile *destination_f = NULL;
GFile *child = NULL;
@@ -2066,7 +2068,15 @@ checkout_tree (OstreeRepo *self,
if (priv->archive)
{
- if (!ostree_unpack_object (object_path, OSTREE_OBJECT_TYPE_FILE, dest_path, NULL, error))
+ if (!ostree_parse_packed_file (object_path, NULL, &packed_xattrs, &packed_input,
+ cancellable, error))
+ goto out;
+
+ if (!ostree_create_file_from_input (dest_path, file_info, packed_xattrs,
+ packed_input,
+ OSTREE_OBJECT_TYPE_FILE,
+ NULL,
+ cancellable, error))
goto out;
}
else
@@ -2094,6 +2104,8 @@ checkout_tree (OstreeRepo *self,
out:
g_clear_object (&dir_enum);
g_clear_object (&file_info);
+ g_clear_object (&packed_input);
+ ot_clear_gvariant (&packed_xattrs);
g_clear_object (&child);
g_clear_object (&object_path);
g_clear_object (&dest_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]