From 5392f2d629a5f7c12456a9ae125e21ddf93933d3 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 20 Apr 2016 09:55:13 +0200 Subject: common: Break out xdg_app_mtree_create_root helper --- app/xdg-app-builtins-build-export.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'app') diff --git a/app/xdg-app-builtins-build-export.c b/app/xdg-app-builtins-build-export.c index e8e531c..345f93b 100644 --- a/app/xdg-app-builtins-build-export.c +++ b/app/xdg-app-builtins-build-export.c @@ -341,26 +341,8 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable, mtree = ostree_mutable_tree_new (); - { - g_autoptr(GVariant) dirmeta = NULL; - g_autoptr(GFileInfo) file_info = g_file_info_new (); - g_autofree guchar *csum; - g_autofree char *checksum = NULL; - - g_file_info_set_name (file_info, "/"); - g_file_info_set_file_type (file_info, G_FILE_TYPE_DIRECTORY); - g_file_info_set_attribute_uint32 (file_info, "unix::uid", 0); - g_file_info_set_attribute_uint32 (file_info, "unix::gid", 0); - g_file_info_set_attribute_uint32 (file_info, "unix::mode", 040755); - - dirmeta = ostree_create_directory_metadata (file_info, NULL); - if (!ostree_repo_write_metadata (repo, OSTREE_OBJECT_TYPE_DIR_META, NULL, - dirmeta, &csum, cancellable, error)) - goto out; - - checksum = ostree_checksum_from_bytes (csum); - ostree_mutable_tree_set_metadata_checksum (mtree, checksum); - } + if (!xdg_app_mtree_create_root (repo, mtree, cancellable, error)) + goto out; if (!ostree_mutable_tree_ensure_dir (mtree, "files", &files_mtree, error)) goto out; -- cgit v1.2.1