[ostree] core: pack: Fix calculation of size of pack objects
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: pack: Fix calculation of size of pack objects
- Date: Sat, 5 May 2012 20:02:16 +0000 (UTC)
commit c0e73c9fa0c5113deafcf65d51783af165a80e76
Author: Colin Walters <walters verbum org>
Date: Sat May 5 16:00:53 2012 -0400
core: pack: Fix calculation of size of pack objects
In archive mode, due to the previous change, we're now only
looking at metadata size, which is clearly wrong.
src/ostree/ot-builtin-pack.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/src/ostree/ot-builtin-pack.c b/src/ostree/ot-builtin-pack.c
index 7edee9e..9aaa1c7 100644
--- a/src/ostree/ot-builtin-pack.c
+++ b/src/ostree/ot-builtin-pack.c
@@ -575,8 +575,6 @@ cluster_objects_stupidly (OtRepackData *data,
ot_lptrarray GPtrArray *ret_data_clusters = NULL;
ot_lptrarray GPtrArray *meta_object_list = NULL;
ot_lptrarray GPtrArray *data_object_list = NULL;
- ot_lobj GFile *object_path = NULL;
- ot_lobj GFileInfo *object_info = NULL;
meta_object_list = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
data_object_list = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
@@ -589,21 +587,27 @@ cluster_objects_stupidly (OtRepackData *data,
OstreeObjectType objtype;
guint64 size;
GVariant *v;
+ ot_lobj GFile *object_path = NULL;
+ ot_lobj GFileInfo *object_info = NULL;
ostree_object_name_deserialize (serialized_key, &checksum, &objtype);
- g_clear_object (&object_path);
- object_path = ostree_repo_get_object_path (data->repo, checksum, objtype);
-
- g_clear_object (&object_info);
- object_info = g_file_query_info (object_path, OSTREE_GIO_FAST_QUERYINFO,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- cancellable, error);
- if (!object_info)
- goto out;
+ if (OSTREE_OBJECT_TYPE_IS_META (objtype))
+ {
+ object_path = ostree_repo_get_object_path (data->repo, checksum, objtype);
- if (g_file_info_get_file_type (object_info) != G_FILE_TYPE_REGULAR)
- continue;
+ object_info = g_file_query_info (object_path, OSTREE_GIO_FAST_QUERYINFO,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ cancellable, error);
+ if (!object_info)
+ goto out;
+ }
+ else
+ {
+ if (!ostree_repo_load_file (data->repo, checksum, NULL, &object_info, NULL,
+ cancellable, error))
+ goto out;
+ }
size = g_file_info_get_attribute_uint64 (object_info, G_FILE_ATTRIBUTE_STANDARD_SIZE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]