common: Export xdg_app_repo_collect_sizes

tingping/wmclass
Alexander Larsson 2016-04-27 09:41:14 +02:00
parent a304b786f4
commit 9624dd67da
2 changed files with 26 additions and 16 deletions

View File

@ -1465,13 +1465,13 @@ xdg_app_repo_set_title (OstreeRepo *repo,
"unix::device,unix::inode,unix::mode,unix::uid,unix::gid,unix::rdev")
static gboolean
xdg_app_repo_collect_sizes (OstreeRepo *repo,
GFile *file,
GFileInfo *file_info,
guint64 *installed_size,
guint64 *download_size,
GCancellable *cancellable,
GError **error)
_xdg_app_repo_collect_sizes (OstreeRepo *repo,
GFile *file,
GFileInfo *file_info,
guint64 *installed_size,
guint64 *download_size,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GFileEnumerator) dir_enum = NULL;
GFileInfo *child_info_tmp;
@ -1508,7 +1508,7 @@ xdg_app_repo_collect_sizes (OstreeRepo *repo,
const char *name = g_file_info_get_name (child_info);
g_autoptr(GFile) child = g_file_get_child (file, name);
if (!xdg_app_repo_collect_sizes (repo, child, child_info, installed_size, download_size, cancellable, error))
if (!_xdg_app_repo_collect_sizes (repo, child, child_info, installed_size, download_size, cancellable, error))
return FALSE;
}
}
@ -1516,6 +1516,17 @@ xdg_app_repo_collect_sizes (OstreeRepo *repo,
return TRUE;
}
gboolean
xdg_app_repo_collect_sizes (OstreeRepo *repo,
GFile *root,
guint64 *installed_size,
guint64 *download_size,
GCancellable *cancellable,
GError **error)
{
return _xdg_app_repo_collect_sizes (repo, root, NULL, installed_size, download_size, cancellable, error);
}
gboolean
xdg_app_repo_update (OstreeRepo *repo,
const char **gpg_key_ids,
@ -1556,23 +1567,16 @@ xdg_app_repo_update (OstreeRepo *repo,
for (l = ordered_keys; l; l = l->next)
{
const char *ref = l->data;
const char *commit = g_hash_table_lookup (refs, ref);
g_autoptr(GVariant) commit_obj = NULL;
g_autoptr(GFile) root = NULL;
g_autoptr(GFile) metadata = NULL;
guint64 installed_size = 0;
guint64 download_size = 0;
g_autofree char *metadata_contents = NULL;
g_assert (commit);
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, commit, &commit_obj, error))
return FALSE;
if (!ostree_repo_read_commit (repo, ref, &root, NULL, NULL, error))
return FALSE;
if (!xdg_app_repo_collect_sizes (repo, root, NULL, &installed_size, &download_size, cancellable, error))
if (!xdg_app_repo_collect_sizes (repo, root, &installed_size, &download_size, cancellable, error))
return FALSE;
metadata = g_file_get_child (root, "metadata");

View File

@ -183,6 +183,12 @@ gboolean xdg_app_repo_update (OstreeRepo *repo,
const char *gpg_homedir,
GCancellable *cancellable,
GError **error);
gboolean xdg_app_repo_collect_sizes (OstreeRepo *repo,
GFile *root,
guint64 *installed_size,
guint64 *download_size,
GCancellable *cancellable,
GError **error);
gboolean xdg_app_mtree_create_root (OstreeRepo *repo,
OstreeMutableTree *mtree,