[ostree] core: Add standard::size to info we get from archives
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Add standard::size to info we get from archives
- Date: Thu, 19 Jan 2012 14:55:02 +0000 (UTC)
commit 39fe050f04335963f4dd6bc0b3a42096faf94178
Author: Colin Walters <walters verbum org>
Date: Thu Jan 19 09:54:09 2012 -0500
core: Add standard::size to info we get from archives
This makes "ostree ls" show the file size.
src/libostree/ostree-repo-file.c | 18 ++++++++++++++++++
src/libotutil/ot-gio-utils.h | 2 +-
2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index 818bd6d..dd22d38 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -816,6 +816,8 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
const char *name = NULL;
gboolean ret = FALSE;
GFileInfo *ret_info = NULL;
+ GFile *archive_data_path = NULL;
+ GFileInfo *archive_data_info = NULL;
GVariant *archive_metadata = NULL;
GVariant *files_variant = NULL;
GVariant *dirs_variant = NULL;
@@ -850,6 +852,20 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
goto out;
if (!ostree_parse_archived_file_meta (archive_metadata, &ret_info, NULL, error))
goto out;
+
+ archive_data_path = ostree_repo_get_object_path (self->repo, checksum,
+ OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT);
+ archive_data_info = g_file_query_info (archive_data_path,
+ OSTREE_GIO_FAST_QUERYINFO,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ cancellable,
+ error);
+ if (!archive_data_info)
+ goto out;
+
+ g_file_info_set_attribute_uint64 (ret_info, "standard::size",
+ g_file_info_get_attribute_uint64 (archive_data_info,
+ "standard::size"));
}
else
{
@@ -902,6 +918,8 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
out:
g_clear_object (&ret_info);
g_clear_object (&local_child);
+ g_clear_object (&archive_data_path);
+ g_clear_object (&archive_data_info);
if (matcher)
g_file_attribute_matcher_unref (matcher);
ot_clear_gvariant (&archive_metadata);
diff --git a/src/libotutil/ot-gio-utils.h b/src/libotutil/ot-gio-utils.h
index 8a46069..46c8e3c 100644
--- a/src/libotutil/ot-gio-utils.h
+++ b/src/libotutil/ot-gio-utils.h
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
* readlink(). Other things require opening the file, or also
* stat()ing the parent directory.
*/
-#define OSTREE_GIO_FAST_QUERYINFO ("standard::name,standard::type,standard::is-symlink,standard::symlink-target,standard::is-hidden," \
+#define OSTREE_GIO_FAST_QUERYINFO ("standard::name,standard::type,standard::size,standard::is-symlink,standard::symlink-target,standard::is-hidden," \
"unix::device,unix::inode,unix::mode,unix::uid,unix::gid,unix::rdev")
GFileType ot_gfile_type_for_mode (guint32 mode);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]