mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-19 22:50:35 +03:00
core: Port builtins to local alloc macros
This commit is contained in:
parent
8b6bf09d7a
commit
394fe75471
@ -168,11 +168,11 @@ fetch_uri (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
SoupMessage *msg = NULL;
|
||||
guint response;
|
||||
char *uri_string = NULL;
|
||||
GFile *ret_temp_filename = NULL;
|
||||
GOutputStream *output_stream = NULL;
|
||||
ot_lfree char *uri_string = NULL;
|
||||
ot_lobj GFile *ret_temp_filename = NULL;
|
||||
ot_lobj GOutputStream *output_stream = NULL;
|
||||
ot_lobj SoupMessage *msg = NULL;
|
||||
OstreeSoupChunkData chunkdata;
|
||||
|
||||
if (!ostree_create_temp_regular_file (ostree_repo_get_tmpdir (pull_data->repo),
|
||||
@ -227,9 +227,6 @@ fetch_uri (OtPullData *pull_data,
|
||||
out:
|
||||
if (ret_temp_filename)
|
||||
(void) unlink (ot_gfile_get_path_cached (ret_temp_filename));
|
||||
g_clear_object (&ret_temp_filename);
|
||||
g_free (uri_string);
|
||||
g_clear_object (&msg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -241,8 +238,8 @@ fetch_uri_contents_utf8 (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *tmpf = NULL;
|
||||
char *ret_contents = NULL;
|
||||
ot_lobj GFile *tmpf = NULL;
|
||||
ot_lfree char *ret_contents = NULL;
|
||||
gsize len;
|
||||
|
||||
if (!fetch_uri (pull_data, uri, "tmp-", &tmpf, cancellable, error))
|
||||
@ -263,8 +260,6 @@ fetch_uri_contents_utf8 (OtPullData *pull_data,
|
||||
out:
|
||||
if (tmpf)
|
||||
(void) unlink (ot_gfile_get_path_cached (tmpf));
|
||||
g_clear_object (&tmpf);
|
||||
g_free (ret_contents);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -276,9 +271,9 @@ fetch_one_pack_file (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *ret_cached_path = NULL;
|
||||
GFile *tmp_path = NULL;
|
||||
char *pack_name = NULL;
|
||||
ot_lobj GFile *ret_cached_path = NULL;
|
||||
ot_lobj GFile *tmp_path = NULL;
|
||||
ot_lfree char *pack_name = NULL;
|
||||
SoupURI *pack_uri = NULL;
|
||||
|
||||
if (!ostree_repo_get_cached_remote_pack_data (pull_data->repo, pull_data->remote_name,
|
||||
@ -310,9 +305,6 @@ fetch_one_pack_file (OtPullData *pull_data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_cached_path, &ret_cached_path);
|
||||
out:
|
||||
g_clear_object (&ret_cached_path);
|
||||
g_clear_object (&tmp_path);
|
||||
g_free (pack_name);
|
||||
if (pack_uri)
|
||||
soup_uri_free (pack_uri);
|
||||
return ret;
|
||||
@ -328,11 +320,11 @@ find_object_in_remote_packs (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *mapped_pack = NULL;
|
||||
GVariant *csum_bytes = NULL;
|
||||
char *ret_pack_checksum = NULL;
|
||||
guint64 offset;
|
||||
guint i;
|
||||
ot_lvariant GVariant *mapped_pack = NULL;
|
||||
ot_lvariant GVariant *csum_bytes = NULL;
|
||||
ot_lfree char *ret_pack_checksum = NULL;
|
||||
|
||||
csum_bytes = ostree_checksum_to_bytes (checksum);
|
||||
|
||||
@ -358,9 +350,6 @@ find_object_in_remote_packs (OtPullData *pull_data,
|
||||
if (out_offset)
|
||||
*out_offset = offset;
|
||||
out:
|
||||
ot_clear_gvariant (&mapped_pack);
|
||||
g_free (ret_pack_checksum);
|
||||
ot_clear_gvariant (&csum_bytes);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -371,9 +360,9 @@ fetch_one_cache_index (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
ot_lobj GFile *tmp_path = NULL;
|
||||
ot_lfree char *pack_index_name = NULL;
|
||||
SoupURI *index_uri = NULL;
|
||||
GFile *tmp_path = NULL;
|
||||
char *pack_index_name = NULL;
|
||||
|
||||
pack_index_name = g_strconcat ("ostpack-", pack_checksum, ".index", NULL);
|
||||
index_uri = suburi_new (pull_data->base_uri, "objects", "pack", pack_index_name, NULL);
|
||||
@ -396,8 +385,6 @@ fetch_one_cache_index (OtPullData *pull_data,
|
||||
out:
|
||||
if (tmp_path != NULL)
|
||||
(void) ot_gfile_unlink (tmp_path, NULL, NULL);
|
||||
g_clear_object (&tmp_path);
|
||||
g_free (pack_index_name);
|
||||
if (index_uri)
|
||||
soup_uri_free (index_uri);
|
||||
return ret;
|
||||
@ -409,13 +396,13 @@ fetch_and_cache_pack_indexes (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
SoupURI *superindex_uri = NULL;
|
||||
GFile *superindex_tmppath = NULL;
|
||||
GPtrArray *cached_indexes = NULL;
|
||||
GPtrArray *uncached_indexes = NULL;
|
||||
GVariant *superindex_variant = NULL;
|
||||
GVariantIter *contents_iter = NULL;
|
||||
guint i;
|
||||
ot_lobj GFile *superindex_tmppath = NULL;
|
||||
ot_lptrarray GPtrArray *cached_indexes = NULL;
|
||||
ot_lptrarray GPtrArray *uncached_indexes = NULL;
|
||||
ot_lvariant GVariant *superindex_variant = NULL;
|
||||
GVariantIter *contents_iter = NULL;
|
||||
SoupURI *superindex_uri = NULL;
|
||||
|
||||
superindex_uri = suburi_new (pull_data->base_uri, "objects", "pack", "index", NULL);
|
||||
|
||||
@ -447,8 +434,6 @@ fetch_and_cache_pack_indexes (OtPullData *pull_data,
|
||||
out:
|
||||
if (superindex_uri)
|
||||
soup_uri_free (superindex_uri);
|
||||
g_clear_object (&superindex_tmppath);
|
||||
ot_clear_gvariant (&superindex_variant);
|
||||
if (contents_iter)
|
||||
g_variant_iter_free (contents_iter);
|
||||
return ret;
|
||||
@ -463,9 +448,9 @@ fetch_loose_object (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
char *objpath = NULL;
|
||||
ot_lfree char *objpath = NULL;
|
||||
ot_lobj GFile *ret_temp_path = NULL;
|
||||
SoupURI *obj_uri = NULL;
|
||||
GFile *ret_temp_path = NULL;
|
||||
|
||||
objpath = ostree_get_relative_object_path (checksum, objtype);
|
||||
obj_uri = suburi_new (pull_data->base_uri, objpath, NULL);
|
||||
@ -479,8 +464,6 @@ fetch_loose_object (OtPullData *pull_data,
|
||||
out:
|
||||
if (obj_uri)
|
||||
soup_uri_free (obj_uri);
|
||||
g_clear_object (&ret_temp_path);
|
||||
g_free (objpath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -500,16 +483,16 @@ fetch_object_if_not_stored (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GInputStream *ret_input = NULL;
|
||||
GFile *temp_path = NULL;
|
||||
GFile *stored_path = NULL;
|
||||
GFile *pack_path = NULL;
|
||||
GMappedFile *pack_map = NULL;
|
||||
char *local_pack_checksum = NULL;
|
||||
char *remote_pack_checksum = NULL;
|
||||
guint64 pack_offset = 0;
|
||||
GVariant *pack_entry = NULL;
|
||||
gboolean is_stored;
|
||||
ot_lobj GInputStream *ret_input = NULL;
|
||||
ot_lobj GFile *temp_path = NULL;
|
||||
ot_lobj GFile *stored_path = NULL;
|
||||
ot_lobj GFile *pack_path = NULL;
|
||||
ot_lfree char *local_pack_checksum = NULL;
|
||||
ot_lfree char *remote_pack_checksum = NULL;
|
||||
ot_lvariant GVariant *pack_entry = NULL;
|
||||
GMappedFile *pack_map = NULL;
|
||||
|
||||
if (!ostree_repo_find_object (pull_data->repo, objtype, checksum,
|
||||
&stored_path, &local_pack_checksum, NULL,
|
||||
@ -574,15 +557,8 @@ fetch_object_if_not_stored (OtPullData *pull_data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_input, &ret_input);
|
||||
out:
|
||||
g_free (local_pack_checksum);
|
||||
g_clear_object (&stored_path);
|
||||
g_clear_object (&temp_path);
|
||||
g_clear_object (&pack_path);
|
||||
if (pack_map)
|
||||
g_mapped_file_unref (pack_map);
|
||||
ot_clear_gvariant (&pack_entry);
|
||||
g_clear_object (&pack_path);
|
||||
g_clear_object (&ret_input);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -594,8 +570,8 @@ fetch_and_store_object (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileInfo *file_info = NULL;
|
||||
GInputStream *input = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
ot_lobj GInputStream *input = NULL;
|
||||
|
||||
g_assert (objtype != OSTREE_OBJECT_TYPE_RAW_FILE);
|
||||
|
||||
@ -614,8 +590,6 @@ fetch_and_store_object (OtPullData *pull_data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&file_info);
|
||||
g_clear_object (&input);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -628,7 +602,7 @@ fetch_and_store_metadata (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *ret_variant = NULL;
|
||||
ot_lvariant GVariant *ret_variant = NULL;
|
||||
|
||||
if (!fetch_and_store_object (pull_data, checksum, objtype,
|
||||
cancellable, error))
|
||||
@ -641,7 +615,6 @@ fetch_and_store_metadata (OtPullData *pull_data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_variant, &ret_variant);
|
||||
out:
|
||||
ot_clear_gvariant (&ret_variant);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -652,14 +625,14 @@ fetch_and_store_file (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GInputStream *input = NULL;
|
||||
GFile *stored_path = NULL;
|
||||
char *pack_checksum = NULL;
|
||||
GVariant *archive_metadata_container = NULL;
|
||||
GVariant *archive_metadata = NULL;
|
||||
GFileInfo *archive_file_info = NULL;
|
||||
GVariant *archive_xattrs = NULL;
|
||||
gboolean skip_archive_fetch;
|
||||
ot_lobj GInputStream *input = NULL;
|
||||
ot_lobj GFile *stored_path = NULL;
|
||||
ot_lfree char *pack_checksum = NULL;
|
||||
ot_lvariant GVariant *archive_metadata_container = NULL;
|
||||
ot_lvariant GVariant *archive_metadata = NULL;
|
||||
ot_lobj GFileInfo *archive_file_info = NULL;
|
||||
ot_lvariant GVariant *archive_xattrs = NULL;
|
||||
|
||||
/* If we're fetching from an archive into a bare repository, we need
|
||||
* to explicitly check for raw file types locally.
|
||||
@ -717,13 +690,6 @@ fetch_and_store_file (OtPullData *pull_data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (pack_checksum);
|
||||
g_clear_object (&stored_path);
|
||||
g_clear_object (&input);
|
||||
ot_clear_gvariant (&archive_metadata_container);
|
||||
ot_clear_gvariant (&archive_metadata);
|
||||
ot_clear_gvariant (&archive_xattrs);
|
||||
g_clear_object (&archive_file_info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -734,12 +700,12 @@ fetch_and_store_tree_metadata_recurse (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *tree = NULL;
|
||||
GVariant *files_variant = NULL;
|
||||
GVariant *dirs_variant = NULL;
|
||||
int i, n;
|
||||
GFile *stored_path = NULL;
|
||||
char *pack_checksum = NULL;
|
||||
ot_lvariant GVariant *tree = NULL;
|
||||
ot_lvariant GVariant *files_variant = NULL;
|
||||
ot_lvariant GVariant *dirs_variant = NULL;
|
||||
ot_lobj GFile *stored_path = NULL;
|
||||
ot_lfree char *pack_checksum = NULL;
|
||||
|
||||
if (!fetch_and_store_metadata (pull_data, rev, OSTREE_OBJECT_TYPE_DIR_TREE,
|
||||
&tree, cancellable, error))
|
||||
@ -796,11 +762,6 @@ fetch_and_store_tree_metadata_recurse (OtPullData *pull_data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&tree);
|
||||
ot_clear_gvariant (&files_variant);
|
||||
ot_clear_gvariant (&dirs_variant);
|
||||
g_clear_object (&stored_path);
|
||||
g_free (pack_checksum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -811,7 +772,7 @@ fetch_and_store_commit_metadata_recurse (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *commit = NULL;
|
||||
ot_lvariant GVariant *commit = NULL;
|
||||
const char *tree_contents_checksum;
|
||||
const char *tree_meta_checksum;
|
||||
|
||||
@ -833,7 +794,6 @@ fetch_and_store_commit_metadata_recurse (OtPullData *pull_data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&commit);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -845,7 +805,7 @@ fetch_ref_contents (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
char *ret_contents = NULL;
|
||||
ot_lfree char *ret_contents = NULL;
|
||||
SoupURI *target_uri = NULL;
|
||||
|
||||
target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL);
|
||||
@ -861,7 +821,6 @@ fetch_ref_contents (OtPullData *pull_data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_contents, &ret_contents);
|
||||
out:
|
||||
g_free (ret_contents);
|
||||
if (target_uri)
|
||||
soup_uri_free (target_uri);
|
||||
return ret;
|
||||
@ -923,10 +882,10 @@ pull_one_ref (OtPullData *pull_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
char *key = NULL;
|
||||
char *remote_ref = NULL;
|
||||
char *baseurl = NULL;
|
||||
char *original_rev = NULL;
|
||||
ot_lfree char *key = NULL;
|
||||
ot_lfree char *remote_ref = NULL;
|
||||
ot_lfree char *baseurl = NULL;
|
||||
ot_lfree char *original_rev = NULL;
|
||||
|
||||
remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, branch);
|
||||
|
||||
@ -953,10 +912,6 @@ pull_one_ref (OtPullData *pull_data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (key);
|
||||
g_free (remote_ref);
|
||||
g_free (baseurl);
|
||||
g_free (original_rev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -966,7 +921,7 @@ parse_ref_summary (const char *contents,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTable *ret_refs = NULL;
|
||||
ot_lhash GHashTable *ret_refs = NULL;
|
||||
char **lines = NULL;
|
||||
char **iter = NULL;
|
||||
char *ref = NULL;
|
||||
@ -1010,8 +965,6 @@ parse_ref_summary (const char *contents,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_refs, &ret_refs);
|
||||
out:
|
||||
if (ret_refs)
|
||||
g_hash_table_unref (ret_refs);
|
||||
g_strfreev (lines);
|
||||
return ret;
|
||||
}
|
||||
@ -1021,22 +974,22 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OtPullData pull_data_real;
|
||||
OtPullData *pull_data = &pull_data_real;
|
||||
OstreeRepo *repo = NULL;
|
||||
char *path = NULL;
|
||||
char *baseurl = NULL;
|
||||
char *summary_data = NULL;
|
||||
SoupURI *summary_uri = NULL;
|
||||
GKeyFile *config = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
GHashTable *refs_to_fetch = NULL;
|
||||
GHashTable *commits_to_fetch = NULL;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
char *branch_rev = NULL;
|
||||
char **configured_branches = NULL;
|
||||
int i;
|
||||
GCancellable *cancellable = NULL;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lfree char *path = NULL;
|
||||
ot_lfree char *baseurl = NULL;
|
||||
ot_lfree char *summary_data = NULL;
|
||||
ot_lhash GHashTable *refs_to_fetch = NULL;
|
||||
ot_lhash GHashTable *commits_to_fetch = NULL;
|
||||
ot_lfree char *branch_rev = NULL;
|
||||
OtPullData pull_data_real;
|
||||
OtPullData *pull_data = &pull_data_real;
|
||||
SoupURI *summary_uri = NULL;
|
||||
GKeyFile *config = NULL;
|
||||
char **configured_branches = NULL;
|
||||
|
||||
context = g_option_context_new ("REMOTE [BRANCH...] - Download data from remote repository");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -1184,15 +1137,7 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (refs_to_fetch)
|
||||
g_hash_table_unref (refs_to_fetch);
|
||||
ot_clear_hashtable (&commits_to_fetch);
|
||||
g_strfreev (configured_branches);
|
||||
g_free (path);
|
||||
g_free (baseurl);
|
||||
g_free (summary_data);
|
||||
g_free (branch_rev);
|
||||
ot_clear_hashtable (&(pull_data->file_checksums_to_fetch));
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&pull_data->session);
|
||||
@ -1202,7 +1147,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
g_ptr_array_unref (pull_data->cached_pack_indexes);
|
||||
if (summary_uri)
|
||||
soup_uri_free (summary_uri);
|
||||
g_clear_object (&repo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ cat_one_file (GFile *f,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GInputStream *in = NULL;
|
||||
ot_lobj GInputStream *in = NULL;
|
||||
|
||||
in = (GInputStream*)g_file_read (f, cancellable, error);
|
||||
if (!in)
|
||||
@ -51,7 +51,6 @@ cat_one_file (GFile *f,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&in);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -60,13 +59,13 @@ ostree_builtin_cat (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
int i;
|
||||
GCancellable *cancellable = NULL;
|
||||
const char *rev;
|
||||
GOutputStream *stdout_stream = NULL;
|
||||
GFile *root = NULL;
|
||||
GFile *f = NULL;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lobj GOutputStream *stdout_stream = NULL;
|
||||
ot_lobj GFile *root = NULL;
|
||||
ot_lobj GFile *f = NULL;
|
||||
|
||||
context = g_option_context_new ("COMMIT PATH [PATH...] - Concatenate contents of files");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -101,11 +100,7 @@ ostree_builtin_cat (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&root);
|
||||
g_clear_object (&f);
|
||||
g_clear_object (&stdout_stream);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
return ret;
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ atomic_symlink_swap (GFile *dest,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *parent = NULL;
|
||||
char *tmp_name = NULL;
|
||||
GFile *tmp_link = NULL;
|
||||
ot_lobj GFile *parent = NULL;
|
||||
ot_lfree char *tmp_name = NULL;
|
||||
ot_lobj GFile *tmp_link = NULL;
|
||||
|
||||
parent = g_file_get_parent (dest);
|
||||
/* HACK - should use randomly generated temporary target name */
|
||||
@ -72,9 +72,6 @@ atomic_symlink_swap (GFile *dest,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (tmp_name);
|
||||
g_clear_object (&parent);
|
||||
g_clear_object (&tmp_link);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -85,11 +82,11 @@ parse_commit_from_symlink (GFile *symlink,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileInfo *file_info = NULL;
|
||||
const char *target;
|
||||
const char *last_dash;
|
||||
const char *checksum;
|
||||
char *ret_commit = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
ot_lfree char *ret_commit = NULL;
|
||||
|
||||
file_info = g_file_query_info (symlink, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
@ -115,8 +112,6 @@ parse_commit_from_symlink (GFile *symlink,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_commit, &ret_commit);
|
||||
out:
|
||||
g_free (ret_commit);
|
||||
g_clear_object (&file_info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -129,9 +124,9 @@ process_one_checkout (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepoFile *root = NULL;
|
||||
OstreeRepoFile *subtree = NULL;
|
||||
GFileInfo *file_info = NULL;
|
||||
ot_lobj OstreeRepoFile *root = NULL;
|
||||
ot_lobj OstreeRepoFile *subtree = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
|
||||
root = (OstreeRepoFile*)ostree_repo_file_new_root (repo, resolved_commit);
|
||||
if (!ostree_repo_file_ensure_resolved (root, error))
|
||||
@ -155,9 +150,6 @@ process_one_checkout (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&subtree);
|
||||
g_clear_object (&root);
|
||||
g_clear_object (&file_info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -168,13 +160,13 @@ process_many_checkouts (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GInputStream *stdin_stream = NULL;
|
||||
GDataInputStream *stdin_data = NULL;
|
||||
char *revision = NULL;
|
||||
char *subpath = NULL;
|
||||
char *resolved_commit = NULL;
|
||||
gsize len;
|
||||
GError *temp_error = NULL;
|
||||
ot_lobj GInputStream *stdin_stream = NULL;
|
||||
ot_lobj GDataInputStream *stdin_data = NULL;
|
||||
ot_lfree char *revision = NULL;
|
||||
ot_lfree char *subpath = NULL;
|
||||
ot_lfree char *resolved_commit = NULL;
|
||||
|
||||
stdin_stream = (GInputStream*)g_unix_input_stream_new (0, FALSE);
|
||||
stdin_data = g_data_input_stream_new (stdin_stream);
|
||||
@ -216,11 +208,6 @@ process_many_checkouts (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (subpath);
|
||||
g_free (revision);
|
||||
g_free (resolved_commit);
|
||||
g_clear_object (&stdin_stream);
|
||||
g_clear_object (&stdin_data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -230,18 +217,18 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error
|
||||
GOptionContext *context;
|
||||
GCancellable *cancellable = NULL;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
const char *commit;
|
||||
char *existing_commit = NULL;
|
||||
char *resolved_commit = NULL;
|
||||
const char *destination;
|
||||
char *suffixed_destination = NULL;
|
||||
char *tmp_destination = NULL;
|
||||
GFileInfo *symlink_file_info = NULL;
|
||||
GFile *checkout_target = NULL;
|
||||
GFile *checkout_target_tmp = NULL;
|
||||
GFile *symlink_target = NULL;
|
||||
gboolean skip_checkout;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lfree char *existing_commit = NULL;
|
||||
ot_lfree char *resolved_commit = NULL;
|
||||
ot_lfree char *suffixed_destination = NULL;
|
||||
ot_lfree char *tmp_destination = NULL;
|
||||
ot_lobj GFileInfo *symlink_file_info = NULL;
|
||||
ot_lobj GFile *checkout_target = NULL;
|
||||
ot_lobj GFile *checkout_target_tmp = NULL;
|
||||
ot_lobj GFile *symlink_target = NULL;
|
||||
|
||||
context = g_option_context_new ("COMMIT DESTINATION - Check out a commit into a filesystem tree");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -358,16 +345,7 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (suffixed_destination);
|
||||
g_free (tmp_destination);
|
||||
g_free (resolved_commit);
|
||||
g_free (existing_commit);
|
||||
g_clear_object (&symlink_target);
|
||||
g_clear_object (&checkout_target_tmp);
|
||||
g_clear_object (&checkout_target);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
g_clear_object (&symlink_file_info);
|
||||
return ret;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ ostree_builtin_checksum (int argc, char **argv, GFile *repo_path_path, GError **
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
GFile *f = NULL;
|
||||
ot_lobj GFile *f = NULL;
|
||||
AsyncChecksumData data;
|
||||
|
||||
context = g_option_context_new ("FILENAME - Checksum a file or directory");
|
||||
@ -87,7 +87,6 @@ ostree_builtin_checksum (int argc, char **argv, GFile *repo_path_path, GError **
|
||||
out:
|
||||
if (data.loop)
|
||||
g_main_loop_unref (data.loop);
|
||||
g_clear_object (&f);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
return ret;
|
||||
|
@ -68,12 +68,12 @@ parse_statoverride_file (GHashTable **out_mode_add,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *path = NULL;
|
||||
char *contents = NULL;
|
||||
gsize len;
|
||||
GHashTable *ret_hash = NULL;
|
||||
char **iter = NULL; /* nofree */
|
||||
ot_lhash GHashTable *ret_hash = NULL;
|
||||
ot_lobj GFile *path = NULL;
|
||||
ot_lfree char *contents = NULL;
|
||||
char **lines = NULL;
|
||||
char **iter = NULL;
|
||||
|
||||
path = ot_gfile_new_for_path (statoverride_file);
|
||||
|
||||
@ -111,11 +111,7 @@ parse_statoverride_file (GHashTable **out_mode_add,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_mode_add, &ret_hash);
|
||||
out:
|
||||
if (ret_hash)
|
||||
g_hash_table_unref (ret_hash);
|
||||
g_free (contents);
|
||||
g_strfreev (lines);
|
||||
g_clear_object (&path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -150,24 +146,24 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
GFile *arg = NULL;
|
||||
char *parent = NULL;
|
||||
char *commit_checksum = NULL;
|
||||
GVariant *parent_commit = NULL;
|
||||
GVariant *metadata = NULL;
|
||||
GMappedFile *metadata_mappedf = NULL;
|
||||
GFile *metadata_f = NULL;
|
||||
OstreeRepoCommitModifier *modifier = NULL;
|
||||
char *contents_checksum = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
OstreeMutableTree *mtree = NULL;
|
||||
char *tree_type = NULL;
|
||||
GVariantBuilder metadata_builder;
|
||||
gboolean metadata_builder_initialized = FALSE;
|
||||
gboolean skip_commit = FALSE;
|
||||
gboolean in_transaction = FALSE;
|
||||
GHashTable *mode_adds = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lobj GFile *arg = NULL;
|
||||
ot_lfree char *parent = NULL;
|
||||
ot_lfree char *commit_checksum = NULL;
|
||||
ot_lvariant GVariant *parent_commit = NULL;
|
||||
ot_lvariant GVariant *metadata = NULL;
|
||||
ot_lobj GFile *metadata_f = NULL;
|
||||
ot_lfree char *contents_checksum = NULL;
|
||||
ot_lobj OstreeMutableTree *mtree = NULL;
|
||||
ot_lfree char *tree_type = NULL;
|
||||
ot_lhash GHashTable *mode_adds = NULL;
|
||||
OstreeRepoCommitModifier *modifier = NULL;
|
||||
GMappedFile *metadata_mappedf = NULL;
|
||||
GVariantBuilder metadata_builder;
|
||||
gboolean metadata_builder_initialized = FALSE;
|
||||
|
||||
context = g_option_context_new ("[ARG] - Commit a new revision");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -188,6 +184,7 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
NULL, error);
|
||||
if (!metadata)
|
||||
goto out;
|
||||
g_variant_ref_sink (metadata);
|
||||
}
|
||||
else if (metadata_bin_path)
|
||||
{
|
||||
@ -227,6 +224,7 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
}
|
||||
metadata = g_variant_builder_end (&metadata_builder);
|
||||
metadata_builder_initialized = FALSE;
|
||||
g_variant_ref_sink (metadata);
|
||||
}
|
||||
|
||||
if (statoverride_file)
|
||||
@ -421,21 +419,11 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
}
|
||||
if (metadata_builder_initialized)
|
||||
g_variant_builder_clear (&metadata_builder);
|
||||
g_clear_object (&arg);
|
||||
g_clear_object (&mtree);
|
||||
g_free (contents_checksum);
|
||||
g_free (parent);
|
||||
ot_clear_gvariant(&parent_commit);
|
||||
if (mode_adds)
|
||||
g_hash_table_unref (mode_adds);
|
||||
g_free (tree_type);
|
||||
if (metadata_mappedf)
|
||||
g_mapped_file_unref (metadata_mappedf);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
if (modifier)
|
||||
ostree_repo_commit_modifier_unref (modifier);
|
||||
g_clear_object (&repo);
|
||||
g_free (commit_checksum);
|
||||
return ret;
|
||||
}
|
||||
|
@ -48,12 +48,12 @@ add_branch (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *branchf = NULL;
|
||||
GFile *subdir = NULL;
|
||||
const char *branch_rev;
|
||||
char **components = NULL;
|
||||
const char *branch_name;
|
||||
const char *path;
|
||||
ot_lobj GFile *branchf = NULL;
|
||||
ot_lobj GFile *subdir = NULL;
|
||||
char **components = NULL;
|
||||
|
||||
components = g_strsplit (branch_path, ":", 2);
|
||||
|
||||
@ -86,7 +86,6 @@ add_branch (OstreeRepo *repo,
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_strfreev (components);
|
||||
g_clear_object (&branchf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -95,30 +94,30 @@ ostree_builtin_compose (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
char *parent = NULL;
|
||||
GFile *destf = NULL;
|
||||
GHashTable *seen_branches = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
int i;
|
||||
gboolean skip_commit = FALSE;
|
||||
gboolean in_transaction = FALSE;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lfree char *parent = NULL;
|
||||
ot_lobj GFile *destf = NULL;
|
||||
ot_lhash GHashTable *seen_branches = NULL;
|
||||
ot_lvariant GVariant *parent_commit = NULL;
|
||||
ot_lvariant GVariant *parent_commit_metadata = NULL;
|
||||
ot_lvariant GVariant *parent_commit_compose = NULL;
|
||||
ot_lvariant GVariant *commit_metadata = NULL;
|
||||
ot_lfree char *contents_checksum = NULL;
|
||||
ot_lfree char *commit_checksum = NULL;
|
||||
ot_lobj GFile *metadata_f = NULL;
|
||||
ot_lobj GFile *from_file = NULL;
|
||||
ot_lfree char *from_file_contents = NULL;
|
||||
gboolean compose_metadata_builder_initialized = FALSE;
|
||||
GVariantBuilder compose_metadata_builder;
|
||||
gboolean commit_metadata_builder_initialized = FALSE;
|
||||
GVariantBuilder commit_metadata_builder;
|
||||
GVariant *parent_commit = NULL;
|
||||
GVariant *parent_commit_metadata = NULL;
|
||||
GVariant *parent_commit_compose = NULL;
|
||||
GVariant *commit_metadata = NULL;
|
||||
GVariantIter *parent_commit_compose_iter = NULL;
|
||||
char *contents_checksum = NULL;
|
||||
char *commit_checksum = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
GFile *metadata_f = NULL;
|
||||
GFile *from_file = NULL;
|
||||
char *from_file_contents = NULL;
|
||||
char **from_file_args = NULL;
|
||||
OstreeMutableTree *mtree = NULL;
|
||||
gboolean skip_commit = FALSE;
|
||||
gboolean in_transaction = FALSE;
|
||||
int i;
|
||||
|
||||
context = g_option_context_new ("BRANCH1 BRANCH2 ... - Merge multiple commits into a single commit tree");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -270,30 +269,14 @@ ostree_builtin_compose (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
(void) ostree_repo_abort_transaction (repo, cancellable, NULL);
|
||||
}
|
||||
|
||||
if (compose_metadata_builder_initialized)
|
||||
g_variant_builder_clear (&compose_metadata_builder);
|
||||
if (commit_metadata_builder_initialized)
|
||||
g_variant_builder_clear (&commit_metadata_builder);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_free (parent);
|
||||
g_free (contents_checksum);
|
||||
g_free (commit_checksum);
|
||||
if (seen_branches)
|
||||
g_hash_table_destroy (seen_branches);
|
||||
ot_clear_gvariant (&commit_metadata);
|
||||
ot_clear_gvariant (&parent_commit);
|
||||
ot_clear_gvariant (&parent_commit_metadata);
|
||||
ot_clear_gvariant (&parent_commit_compose);
|
||||
if (parent_commit_compose_iter)
|
||||
g_variant_iter_free (parent_commit_compose_iter);
|
||||
g_clear_object (&repo);
|
||||
g_clear_object (&destf);
|
||||
g_clear_object (&metadata_f);
|
||||
g_clear_object (&mtree);
|
||||
g_clear_object (&from_file);
|
||||
g_free (from_file_contents);
|
||||
g_strfreev (from_file_args);
|
||||
return ret;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ parse_file_or_commit (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *ret_file = NULL;
|
||||
ot_lfree GFile *ret_file = NULL;
|
||||
|
||||
if (g_str_has_prefix (arg, "/")
|
||||
|| g_str_has_prefix (arg, "./")
|
||||
@ -54,10 +54,8 @@ parse_file_or_commit (OstreeRepo *repo,
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
*out_file = ret_file;
|
||||
ret_file = NULL;
|
||||
ot_transfer_out_value (out_file, &ret_file);
|
||||
out:
|
||||
g_clear_object (&ret_file);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -70,8 +68,8 @@ get_file_checksum (GFile *f,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
ot_lfree char *ret_checksum = NULL;
|
||||
GChecksum *tmp_checksum = NULL;
|
||||
char *ret_checksum = NULL;
|
||||
|
||||
if (OSTREE_IS_REPO_FILE (f))
|
||||
{
|
||||
@ -161,8 +159,8 @@ diff_files (GFile *a,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
char *checksum_a = NULL;
|
||||
char *checksum_b = NULL;
|
||||
ot_lfree char *checksum_a = NULL;
|
||||
ot_lfree char *checksum_b = NULL;
|
||||
DiffItem *ret_item = NULL;
|
||||
|
||||
if (!get_file_checksum (a, a_info, &checksum_a, cancellable, error))
|
||||
@ -181,8 +179,6 @@ diff_files (GFile *a,
|
||||
out:
|
||||
if (ret_item)
|
||||
diff_item_unref (ret_item);
|
||||
g_free (checksum_a);
|
||||
g_free (checksum_b);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -193,10 +189,10 @@ diff_add_dir_recurse (GFile *d,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileEnumerator *dir_enum = NULL;
|
||||
GError *temp_error = NULL;
|
||||
GFile *child = NULL;
|
||||
GFileInfo *child_info = NULL;
|
||||
ot_lobj GFileEnumerator *dir_enum = NULL;
|
||||
ot_lobj GFile *child = NULL;
|
||||
ot_lobj GFileInfo *child_info = NULL;
|
||||
|
||||
dir_enum = g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
@ -232,9 +228,6 @@ diff_add_dir_recurse (GFile *d,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&child_info);
|
||||
g_clear_object (&child);
|
||||
g_clear_object (&dir_enum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -248,12 +241,12 @@ diff_dirs (GFile *a,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileEnumerator *dir_enum = NULL;
|
||||
GError *temp_error = NULL;
|
||||
GFile *child_a = NULL;
|
||||
GFile *child_b = NULL;
|
||||
GFileInfo *child_a_info = NULL;
|
||||
GFileInfo *child_b_info = NULL;
|
||||
ot_lobj GFileEnumerator *dir_enum = NULL;
|
||||
ot_lobj GFile *child_a = NULL;
|
||||
ot_lobj GFile *child_b = NULL;
|
||||
ot_lobj GFileInfo *child_a_info = NULL;
|
||||
ot_lobj GFileInfo *child_b_info = NULL;
|
||||
|
||||
dir_enum = g_file_enumerate_children (a, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
@ -384,11 +377,6 @@ diff_dirs (GFile *a,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&dir_enum);
|
||||
g_clear_object (&child_a_info);
|
||||
g_clear_object (&child_b_info);
|
||||
g_clear_object (&child_a);
|
||||
g_clear_object (&child_b);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -398,17 +386,17 @@ ostree_builtin_diff (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
gboolean ret = FALSE;
|
||||
GOptionContext *context;
|
||||
GCancellable *cancellable = NULL;
|
||||
OstreeRepo *repo = NULL;
|
||||
char *src_prev = NULL;
|
||||
int i;
|
||||
const char *src;
|
||||
const char *target;
|
||||
GFile *srcf = NULL;
|
||||
GFile *targetf = NULL;
|
||||
GFile *cwd = NULL;
|
||||
GPtrArray *modified = NULL;
|
||||
GPtrArray *removed = NULL;
|
||||
GPtrArray *added = NULL;
|
||||
int i;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lfree char *src_prev = NULL;
|
||||
ot_lobj GFile *srcf = NULL;
|
||||
ot_lobj GFile *targetf = NULL;
|
||||
ot_lobj GFile *cwd = NULL;
|
||||
ot_lptrarray GPtrArray *modified = NULL;
|
||||
ot_lptrarray GPtrArray *removed = NULL;
|
||||
ot_lptrarray GPtrArray *added = NULL;
|
||||
|
||||
context = g_option_context_new ("REV TARGETDIR - Compare directory TARGETDIR against revision REV");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -481,16 +469,5 @@ ostree_builtin_diff (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (src_prev);
|
||||
g_clear_object (&repo);
|
||||
g_clear_object (&cwd);
|
||||
g_clear_object (&srcf);
|
||||
g_clear_object (&targetf);
|
||||
if (modified)
|
||||
g_ptr_array_free (modified, TRUE);
|
||||
if (removed)
|
||||
g_ptr_array_free (removed, TRUE);
|
||||
if (added)
|
||||
g_ptr_array_free (added, TRUE);
|
||||
return ret;
|
||||
}
|
||||
|
@ -48,18 +48,18 @@ fsck_pack_files (OtFsckData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GPtrArray *pack_indexes = NULL;
|
||||
GVariant *index_variant = NULL;
|
||||
GFile *pack_index_path = NULL;
|
||||
GFile *pack_data_path = NULL;
|
||||
GFileInfo *pack_info = NULL;
|
||||
GInputStream *input = NULL;
|
||||
GChecksum *pack_content_checksum = NULL;
|
||||
GVariantIter *index_content_iter = NULL;
|
||||
guint i;
|
||||
guint32 objtype;
|
||||
guint64 offset;
|
||||
guint64 pack_size;
|
||||
ot_lptrarray GPtrArray *pack_indexes = NULL;
|
||||
ot_lvariant GVariant *index_variant = NULL;
|
||||
ot_lobj GFile *pack_index_path = NULL;
|
||||
ot_lobj GFile *pack_data_path = NULL;
|
||||
ot_lobj GFileInfo *pack_info = NULL;
|
||||
ot_lobj GInputStream *input = NULL;
|
||||
GChecksum *pack_content_checksum = NULL;
|
||||
GVariantIter *index_content_iter = NULL;
|
||||
|
||||
if (!ostree_repo_list_pack_indexes (data->repo, &pack_indexes, cancellable, error))
|
||||
goto out;
|
||||
@ -131,13 +131,7 @@ fsck_pack_files (OtFsckData *data,
|
||||
out:
|
||||
if (index_content_iter)
|
||||
g_variant_iter_free (index_content_iter);
|
||||
if (pack_content_checksum)
|
||||
g_checksum_free (pack_content_checksum);
|
||||
if (pack_indexes)
|
||||
g_ptr_array_unref (pack_indexes);
|
||||
g_clear_object (&pack_info);
|
||||
g_clear_object (&pack_data_path);
|
||||
g_clear_object (&input);
|
||||
ot_clear_checksum (&pack_content_checksum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -148,14 +142,14 @@ fsck_reachable_objects_from_commits (OtFsckData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTable *reachable_objects = NULL;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
GInputStream *input = NULL;
|
||||
GFileInfo *file_info = NULL;
|
||||
GVariant *xattrs = NULL;
|
||||
GVariant *metadata = NULL;
|
||||
GVariant *metadata_wrapped = NULL;
|
||||
ot_lhash GHashTable *reachable_objects = NULL;
|
||||
ot_lobj GInputStream *input = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
ot_lvariant GVariant *xattrs = NULL;
|
||||
ot_lvariant GVariant *metadata = NULL;
|
||||
ot_lvariant GVariant *metadata_wrapped = NULL;
|
||||
GChecksum *computed_checksum = NULL;
|
||||
|
||||
reachable_objects = ostree_traverse_new_reachable ();
|
||||
@ -268,12 +262,6 @@ fsck_reachable_objects_from_commits (OtFsckData *data,
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_checksum (&computed_checksum);
|
||||
g_clear_object (&input);
|
||||
g_clear_object (&file_info);
|
||||
ot_clear_gvariant (&xattrs);
|
||||
ot_clear_gvariant (&metadata);
|
||||
ot_clear_gvariant (&metadata_wrapped);
|
||||
ot_clear_hashtable (&reachable_objects);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -283,12 +271,12 @@ ostree_builtin_fsck (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
GOptionContext *context;
|
||||
OtFsckData data;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
GHashTable *objects = NULL;
|
||||
GHashTable *commits = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lhash GHashTable *objects = NULL;
|
||||
ot_lhash GHashTable *commits = NULL;
|
||||
|
||||
context = g_option_context_new ("- Check the repository for consistency");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -343,8 +331,5 @@ ostree_builtin_fsck (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
out:
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
ot_clear_hashtable (&objects);
|
||||
ot_clear_hashtable (&commits);
|
||||
return ret;
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ ostree_builtin_init (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context = NULL;
|
||||
gboolean ret = FALSE;
|
||||
GFile *child = NULL;
|
||||
GFile *grandchild = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
ot_lobj GFile *child = NULL;
|
||||
ot_lobj GFile *grandchild = NULL;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
GString *config_data = NULL;
|
||||
OstreeRepo *repo = NULL;
|
||||
|
||||
context = g_option_context_new ("- Initialize a new empty repository");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -119,8 +119,5 @@ ostree_builtin_init (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
g_option_context_free (context);
|
||||
if (config_data)
|
||||
g_string_free (config_data, TRUE);
|
||||
g_clear_object (&child);
|
||||
g_clear_object (&grandchild);
|
||||
g_clear_object (&repo);
|
||||
return ret;
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ copy_dir_contents_recurse (GFile *src,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *child_src = NULL;
|
||||
GFile *child_dest = NULL;
|
||||
GFileEnumerator *dir_enum = NULL;
|
||||
GFileInfo *file_info = NULL;
|
||||
GError *temp_error = NULL;
|
||||
ot_lobj GFile *child_src = NULL;
|
||||
ot_lobj GFile *child_dest = NULL;
|
||||
ot_lobj GFileEnumerator *dir_enum = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
|
||||
dir_enum = g_file_enumerate_children (src, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
@ -90,10 +90,6 @@ copy_dir_contents_recurse (GFile *src,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&dir_enum);
|
||||
g_clear_object (&child_src);
|
||||
g_clear_object (&child_dest);
|
||||
g_clear_object (&file_info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -105,13 +101,13 @@ import_loose_object (OtLocalCloneData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *objfile = NULL;
|
||||
GFileInfo *file_info = NULL;
|
||||
GFile *content_path = NULL;
|
||||
GFileInfo *archive_info = NULL;
|
||||
GVariant *archive_metadata = NULL;
|
||||
GVariant *xattrs = NULL;
|
||||
GInputStream *input = NULL;
|
||||
ot_lobj GFile *objfile = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
ot_lobj GFile *content_path = NULL;
|
||||
ot_lobj GFileInfo *archive_info = NULL;
|
||||
ot_lvariant GVariant *archive_metadata = NULL;
|
||||
ot_lvariant GVariant *xattrs = NULL;
|
||||
ot_lobj GInputStream *input = NULL;
|
||||
|
||||
objfile = ostree_repo_get_object_path (data->src_repo, checksum, objtype);
|
||||
file_info = g_file_query_info (objfile, OSTREE_GIO_FAST_QUERYINFO,
|
||||
@ -167,13 +163,6 @@ import_loose_object (OtLocalCloneData *data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&archive_metadata);
|
||||
ot_clear_gvariant (&xattrs);
|
||||
g_clear_object (&archive_info);
|
||||
g_clear_object (&input);
|
||||
g_clear_object (&content_path);
|
||||
g_clear_object (&file_info);
|
||||
g_clear_object (&objfile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -185,10 +174,10 @@ copy_one_ref (GFile *src_repo_dir,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *src_path = NULL;
|
||||
GFile *dest_path = NULL;
|
||||
GFile *dest_parent = NULL;
|
||||
char *refpath = NULL;
|
||||
ot_lobj GFile *src_path = NULL;
|
||||
ot_lobj GFile *dest_path = NULL;
|
||||
ot_lobj GFile *dest_parent = NULL;
|
||||
ot_lfree char *refpath = NULL;
|
||||
|
||||
refpath = g_build_filename ("refs/heads", name, NULL);
|
||||
src_path = g_file_resolve_relative_path (src_repo_dir, refpath);
|
||||
@ -204,10 +193,6 @@ copy_one_ref (GFile *src_repo_dir,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&src_path);
|
||||
g_clear_object (&dest_path);
|
||||
g_clear_object (&dest_parent);
|
||||
g_free (refpath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -216,20 +201,20 @@ ostree_builtin_local_clone (int argc, char **argv, GFile *repo_path, GError **er
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GCancellable *cancellable = NULL;
|
||||
GHashTable *objects = NULL;
|
||||
GOptionContext *context;
|
||||
const char *destination;
|
||||
GFile *dest_f = NULL;
|
||||
OtLocalCloneData data;
|
||||
GFile *src_repo_dir = NULL;
|
||||
GFile *dest_repo_dir = NULL;
|
||||
GFileInfo *src_info = NULL;
|
||||
GFileInfo *dest_info = NULL;
|
||||
GFile *src_dir = NULL;
|
||||
GFile *dest_dir = NULL;
|
||||
int i;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
ot_lhash GHashTable *objects = NULL;
|
||||
ot_lobj GFile *dest_f = NULL;
|
||||
ot_lobj GFile *src_repo_dir = NULL;
|
||||
ot_lobj GFile *dest_repo_dir = NULL;
|
||||
ot_lobj GFileInfo *src_info = NULL;
|
||||
ot_lobj GFileInfo *dest_info = NULL;
|
||||
ot_lobj GFile *src_dir = NULL;
|
||||
ot_lobj GFile *dest_dir = NULL;
|
||||
OtLocalCloneData data;
|
||||
|
||||
context = g_option_context_new ("DEST ... - Create new repository DEST");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -334,16 +319,5 @@ ostree_builtin_local_clone (int argc, char **argv, GFile *repo_path, GError **er
|
||||
out:
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&dest_f);
|
||||
g_clear_object (&src_repo_dir);
|
||||
g_clear_object (&dest_repo_dir);
|
||||
g_clear_object (&src_info);
|
||||
g_clear_object (&dest_info);
|
||||
g_clear_object (&src_dir);
|
||||
g_clear_object (&dest_dir);
|
||||
g_clear_object (&data.src_repo);
|
||||
g_clear_object (&data.dest_repo);
|
||||
if (objects)
|
||||
g_hash_table_unref (objects);
|
||||
return ret;
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ ostree_builtin_log (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
GOutputStream *pager = NULL;
|
||||
const char *rev;
|
||||
GVariant *commit = NULL;
|
||||
char *resolved_rev = NULL;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lobj GOutputStream *pager = NULL;
|
||||
ot_lvariant GVariant *commit = NULL;
|
||||
ot_lfree char *resolved_rev = NULL;
|
||||
|
||||
context = g_option_context_new ("- Show revision log");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -141,10 +141,7 @@ ostree_builtin_log (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (resolved_rev);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
ot_clear_gvariant (&commit);
|
||||
g_clear_object (&repo);
|
||||
return ret;
|
||||
}
|
||||
|
@ -151,9 +151,9 @@ print_directory_recurse (GFile *f,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileEnumerator *dir_enum = NULL;
|
||||
GFile *child = NULL;
|
||||
GFileInfo *child_info = NULL;
|
||||
ot_lobj GFileEnumerator *dir_enum = NULL;
|
||||
ot_lobj GFile *child = NULL;
|
||||
ot_lobj GFileInfo *child_info = NULL;
|
||||
GError *temp_error = NULL;
|
||||
|
||||
dir_enum = g_file_enumerate_children (f, OSTREE_GIO_FAST_QUERYINFO,
|
||||
@ -186,9 +186,6 @@ print_directory_recurse (GFile *f,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&child_info);
|
||||
g_clear_object (&child);
|
||||
g_clear_object (&dir_enum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -197,13 +197,13 @@ compare_index_content (gconstpointer ap,
|
||||
gpointer b = *((gpointer*)bp);
|
||||
GVariant *a_v = a;
|
||||
GVariant *b_v = b;
|
||||
GVariant *a_csum_bytes;
|
||||
GVariant *b_csum_bytes;
|
||||
guint32 a_objtype;
|
||||
guint32 b_objtype;
|
||||
guint64 a_offset;
|
||||
guint64 b_offset;
|
||||
int c;
|
||||
ot_lvariant GVariant *a_csum_bytes = NULL;
|
||||
ot_lvariant GVariant *b_csum_bytes = NULL;
|
||||
|
||||
g_variant_get (a_v, "(u@ayt)", &a_objtype, &a_csum_bytes, &a_offset);
|
||||
g_variant_get (b_v, "(u@ayt)", &b_objtype, &b_csum_bytes, &b_offset);
|
||||
@ -228,11 +228,11 @@ delete_loose_object (OtRepackData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *object_path = NULL;
|
||||
GFile *content_object_path = NULL;
|
||||
GVariant *archive_meta = NULL;
|
||||
GFileInfo *file_info = NULL;
|
||||
GVariant *xattrs = NULL;
|
||||
ot_lobj GFile *object_path = NULL;
|
||||
ot_lobj GFile *content_object_path = NULL;
|
||||
ot_lvariant GVariant *archive_meta = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
ot_lvariant GVariant *xattrs = NULL;
|
||||
|
||||
object_path = ostree_repo_get_object_path (data->repo, checksum, objtype);
|
||||
|
||||
@ -266,11 +266,6 @@ delete_loose_object (OtRepackData *data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&object_path);
|
||||
g_clear_object (&content_object_path);
|
||||
ot_clear_gvariant (&archive_meta);
|
||||
g_clear_object (&file_info);
|
||||
ot_clear_gvariant (&xattrs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -281,29 +276,29 @@ create_pack_file (OtRepackData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *pack_dir = NULL;
|
||||
GFile *index_temppath = NULL;
|
||||
GOutputStream *index_out = NULL;
|
||||
GFile *pack_temppath = NULL;
|
||||
GOutputStream *pack_out = NULL;
|
||||
GFile *object_path = NULL;
|
||||
GFileInfo *object_file_info = NULL;
|
||||
GFileInputStream *object_input = NULL;
|
||||
GConverter *compressor = NULL;
|
||||
GConverterInputStream *compressed_object_input = NULL;
|
||||
guint i;
|
||||
guint64 offset;
|
||||
gsize bytes_written;
|
||||
GPtrArray *index_content_list = NULL;
|
||||
GVariant *pack_header = NULL;
|
||||
GVariant *packed_object = NULL;
|
||||
GVariant *index_content = NULL;
|
||||
ot_lobj GFile *pack_dir = NULL;
|
||||
ot_lobj GFile *index_temppath = NULL;
|
||||
ot_lobj GOutputStream *index_out = NULL;
|
||||
ot_lobj GFile *pack_temppath = NULL;
|
||||
ot_lobj GOutputStream *pack_out = NULL;
|
||||
ot_lobj GFile *object_path = NULL;
|
||||
ot_lobj GFileInfo *object_file_info = NULL;
|
||||
ot_lobj GFileInputStream *object_input = NULL;
|
||||
ot_lobj GConverter *compressor = NULL;
|
||||
ot_lobj GConverterInputStream *compressed_object_input = NULL;
|
||||
ot_lptrarray GPtrArray *index_content_list = NULL;
|
||||
ot_lvariant GVariant *pack_header = NULL;
|
||||
ot_lvariant GVariant *packed_object = NULL;
|
||||
ot_lvariant GVariant *index_content = NULL;
|
||||
ot_lfree char *pack_name = NULL;
|
||||
ot_lobj GFile *pack_file_path = NULL;
|
||||
ot_lobj GFile *pack_index_path = NULL;
|
||||
GMemoryOutputStream *object_data_stream = NULL;
|
||||
GVariantBuilder index_content_builder;
|
||||
GChecksum *pack_checksum = NULL;
|
||||
char *pack_name = NULL;
|
||||
GFile *pack_file_path = NULL;
|
||||
GFile *pack_index_path = NULL;
|
||||
GMemoryOutputStream *object_data_stream = NULL;
|
||||
|
||||
if (g_cancellable_set_error_if_cancelled (cancellable, error))
|
||||
return FALSE;
|
||||
@ -496,26 +491,10 @@ create_pack_file (OtRepackData *data,
|
||||
out:
|
||||
if (index_temppath)
|
||||
(void) unlink (ot_gfile_get_path_cached (index_temppath));
|
||||
g_clear_object (&index_temppath);
|
||||
g_clear_object (&index_out);
|
||||
if (pack_temppath)
|
||||
(void) unlink (ot_gfile_get_path_cached (pack_temppath));
|
||||
g_clear_object (&pack_temppath);
|
||||
g_clear_object (&pack_out);
|
||||
g_clear_object (&object_path);
|
||||
g_clear_object (&object_input);
|
||||
g_clear_object (&compressor);
|
||||
g_clear_object (&compressed_object_input);
|
||||
g_clear_object (&object_file_info);
|
||||
if (pack_checksum)
|
||||
g_checksum_free (pack_checksum);
|
||||
g_clear_object (&pack_dir);
|
||||
ot_clear_gvariant (&index_content);
|
||||
g_free (pack_name);
|
||||
g_clear_object (&pack_file_path);
|
||||
g_clear_object (&pack_index_path);
|
||||
if (index_content_list)
|
||||
g_ptr_array_unref (index_content_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -535,15 +514,15 @@ cluster_objects_stupidly (OtRepackData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GPtrArray *ret_clusters = NULL;
|
||||
GPtrArray *object_list = NULL;
|
||||
guint i;
|
||||
guint64 current_size;
|
||||
guint current_offset;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
GFile *object_path = NULL;
|
||||
GFileInfo *object_info = NULL;
|
||||
ot_lptrarray GPtrArray *ret_clusters = NULL;
|
||||
ot_lptrarray GPtrArray *object_list = NULL;
|
||||
ot_lobj GFile *object_path = NULL;
|
||||
ot_lobj GFileInfo *object_info = NULL;
|
||||
|
||||
object_list = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
|
||||
|
||||
@ -620,8 +599,6 @@ cluster_objects_stupidly (OtRepackData *data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_clusters, &ret_clusters);
|
||||
out:
|
||||
if (object_list)
|
||||
g_ptr_array_unref (object_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -717,7 +694,6 @@ do_stats_gather_loose (OtRepackData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTable *ret_loose = NULL;
|
||||
guint n_loose = 0;
|
||||
guint n_loose_and_packed = 0;
|
||||
guint n_packed = 0;
|
||||
@ -728,6 +704,7 @@ do_stats_gather_loose (OtRepackData *data,
|
||||
guint n_files = 0;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
ot_lhash GHashTable *ret_loose = NULL;
|
||||
|
||||
ret_loose = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,
|
||||
(GDestroyNotify) g_variant_unref,
|
||||
@ -803,8 +780,6 @@ do_stats_gather_loose (OtRepackData *data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_loose, &ret_loose);
|
||||
/* out: */
|
||||
if (ret_loose)
|
||||
g_hash_table_unref (ret_loose);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -814,10 +789,10 @@ do_incremental_pack (OtRepackData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTable *objects = NULL;
|
||||
guint i;
|
||||
GPtrArray *clusters = NULL;
|
||||
GHashTable *loose_objects = NULL;
|
||||
ot_lhash GHashTable *objects = NULL;
|
||||
ot_lptrarray GPtrArray *clusters = NULL;
|
||||
ot_lhash GHashTable *loose_objects = NULL;
|
||||
|
||||
if (!ostree_repo_list_objects (data->repo, OSTREE_REPO_LIST_OBJECTS_ALL, &objects,
|
||||
cancellable, error))
|
||||
@ -850,12 +825,6 @@ do_incremental_pack (OtRepackData *data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (clusters)
|
||||
g_ptr_array_unref (clusters);
|
||||
if (loose_objects)
|
||||
g_hash_table_unref (loose_objects);
|
||||
if (objects)
|
||||
g_hash_table_unref (objects);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -864,9 +833,9 @@ ostree_builtin_pack (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GOptionContext *context;
|
||||
OtRepackData data;
|
||||
OstreeRepo *repo = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
OtRepackData data;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
|
||||
memset (&data, 0, sizeof (data));
|
||||
|
||||
@ -913,6 +882,5 @@ ostree_builtin_pack (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
out:
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
return ret;
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ prune_loose_object (OtPruneData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *key = NULL;
|
||||
GFile *objf = NULL;
|
||||
ot_lvariant GVariant *key = NULL;
|
||||
ot_lobj GFile *objf = NULL;
|
||||
|
||||
key = ostree_object_name_serialize (checksum, objtype);
|
||||
|
||||
@ -102,8 +102,6 @@ prune_loose_object (OtPruneData *data,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&objf);
|
||||
ot_clear_gvariant (&key);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -112,13 +110,13 @@ ostree_builtin_prune (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GOptionContext *context;
|
||||
OtPruneData data;
|
||||
GHashTable *objects = NULL;
|
||||
OstreeRepo *repo = NULL;
|
||||
GHashTable *all_refs = NULL;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
GCancellable *cancellable = NULL;
|
||||
ot_lhash GHashTable *objects = NULL;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lhash GHashTable *all_refs = NULL;
|
||||
OtPruneData data;
|
||||
|
||||
memset (&data, 0, sizeof (data));
|
||||
|
||||
@ -181,14 +179,9 @@ ostree_builtin_prune (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (all_refs)
|
||||
g_hash_table_unref (all_refs);
|
||||
if (data.reachable)
|
||||
g_hash_table_unref (data.reachable);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
if (objects)
|
||||
g_hash_table_unref (objects);
|
||||
return ret;
|
||||
}
|
||||
|
@ -46,11 +46,11 @@ ostree_builtin_remote (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
const char *op;
|
||||
GKeyFile *config = NULL;
|
||||
GPtrArray *branches = NULL;
|
||||
guint i;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lptrarray GPtrArray *branches = NULL;
|
||||
GKeyFile *config = NULL;
|
||||
|
||||
context = g_option_context_new ("OPERATION [args] - Control remote repository configuration");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -104,11 +104,9 @@ ostree_builtin_remote (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_ptrarray (&branches);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
if (config)
|
||||
g_key_file_free (config);
|
||||
g_clear_object (&repo);
|
||||
return ret;
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ ostree_builtin_rev_parse (int argc, char **argv, GFile *repo_path, GError **erro
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
const char *rev = "master";
|
||||
char *resolved_rev = NULL;
|
||||
GVariant *variant = NULL;
|
||||
char *formatted_variant = NULL;
|
||||
int i;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lfree char *resolved_rev = NULL;
|
||||
ot_lvariant GVariant *variant = NULL;
|
||||
ot_lfree char *formatted_variant = NULL;
|
||||
|
||||
context = g_option_context_new ("REV - Output the target of a rev");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -70,11 +70,7 @@ ostree_builtin_rev_parse (int argc, char **argv, GFile *repo_path, GError **erro
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (resolved_rev);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
ot_clear_gvariant (&variant);
|
||||
g_free (formatted_variant);
|
||||
return ret;
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ static GOptionEntry options[] = {
|
||||
static void
|
||||
print_variant (GVariant *variant)
|
||||
{
|
||||
char *formatted_variant = NULL;
|
||||
GVariant *byteswapped = NULL;
|
||||
ot_lfree char *formatted_variant = NULL;
|
||||
ot_lvariant GVariant *byteswapped = NULL;
|
||||
|
||||
if (G_BYTE_ORDER != G_BIG_ENDIAN)
|
||||
{
|
||||
@ -54,9 +54,6 @@ print_variant (GVariant *variant)
|
||||
formatted_variant = g_variant_print (variant, TRUE);
|
||||
}
|
||||
g_print ("%s\n", formatted_variant);
|
||||
|
||||
g_free (formatted_variant);
|
||||
ot_clear_gvariant (&byteswapped);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -65,8 +62,8 @@ do_print_variant_generic (const GVariantType *type,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *f = NULL;
|
||||
GVariant *variant = NULL;
|
||||
ot_lobj GFile *f = NULL;
|
||||
ot_lvariant GVariant *variant = NULL;
|
||||
|
||||
f = ot_gfile_new_for_path (filename);
|
||||
|
||||
@ -77,8 +74,6 @@ do_print_variant_generic (const GVariantType *type,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&variant);
|
||||
g_clear_object (&f);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -89,12 +84,12 @@ show_repo_meta (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *variant = NULL;
|
||||
GFile *object_path = NULL;
|
||||
GInputStream *in = NULL;
|
||||
char buf[8192];
|
||||
gsize bytes_read;
|
||||
OstreeObjectType objtype;
|
||||
ot_lvariant GVariant *variant = NULL;
|
||||
ot_lobj GFile *object_path = NULL;
|
||||
ot_lobj GInputStream *in = NULL;
|
||||
|
||||
for (objtype = OSTREE_OBJECT_TYPE_RAW_FILE; objtype <= OSTREE_OBJECT_TYPE_COMMIT; objtype++)
|
||||
{
|
||||
@ -139,9 +134,6 @@ show_repo_meta (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&variant);
|
||||
g_clear_object (&in);
|
||||
g_clear_object (&object_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -152,13 +144,13 @@ do_print_compose (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *variant = NULL;
|
||||
GVariant *metadata = NULL;
|
||||
GVariant *compose_contents = NULL;
|
||||
GVariantIter *viter = NULL;
|
||||
GHashTable *metadata_hash = NULL;
|
||||
const char *branch;
|
||||
const char *branchrev;
|
||||
ot_lvariant GVariant *variant = NULL;
|
||||
ot_lvariant GVariant *metadata = NULL;
|
||||
ot_lvariant GVariant *compose_contents = NULL;
|
||||
ot_lhash GHashTable *metadata_hash = NULL;
|
||||
GVariantIter *viter = NULL;
|
||||
|
||||
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT,
|
||||
resolved_rev, &variant, error))
|
||||
@ -184,12 +176,8 @@ do_print_compose (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&variant);
|
||||
if (viter)
|
||||
g_variant_iter_free (viter);
|
||||
ot_clear_gvariant (&metadata);
|
||||
if (metadata_hash)
|
||||
g_hash_table_destroy (metadata_hash);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -200,9 +188,9 @@ do_print_metadata_key (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *commit = NULL;
|
||||
GVariant *metadata = NULL;
|
||||
const char *value;
|
||||
ot_lvariant GVariant *commit = NULL;
|
||||
ot_lvariant GVariant *metadata = NULL;
|
||||
|
||||
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT,
|
||||
resolved_rev, &commit, error))
|
||||
@ -218,8 +206,6 @@ do_print_metadata_key (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&metadata);
|
||||
ot_clear_gvariant (&commit);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -228,9 +214,9 @@ ostree_builtin_show (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepo *repo = NULL;
|
||||
const char *rev;
|
||||
char *resolved_rev = NULL;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lfree char *resolved_rev = NULL;
|
||||
|
||||
context = g_option_context_new ("OBJECT - Output a metadata object");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
@ -281,9 +267,7 @@ ostree_builtin_show (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (resolved_rev);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
return ret;
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ gather_packed (OtUnpackData *data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTable *ret_packed = NULL;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
GVariant *pack_array = NULL;
|
||||
GHashTableIter hash_iter;
|
||||
ot_lhash GHashTable *ret_packed = NULL;
|
||||
ot_lvariant GVariant *pack_array = NULL;
|
||||
|
||||
ret_packed = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,
|
||||
(GDestroyNotify) g_variant_unref,
|
||||
@ -86,9 +86,6 @@ gather_packed (OtUnpackData *data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_packed, &ret_packed);
|
||||
/* out: */
|
||||
ot_clear_gvariant (&pack_array);
|
||||
if (ret_packed)
|
||||
g_hash_table_unref (ret_packed);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -100,11 +97,11 @@ unpack_one_object (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GInputStream *input = NULL;
|
||||
GFileInfo *file_info = NULL;
|
||||
GVariant *xattrs = NULL;
|
||||
GVariant *meta = NULL;
|
||||
GVariant *serialized_meta = NULL;
|
||||
ot_lobj GInputStream *input = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
ot_lvariant GVariant *xattrs = NULL;
|
||||
ot_lvariant GVariant *meta = NULL;
|
||||
ot_lvariant GVariant *serialized_meta = NULL;
|
||||
|
||||
g_assert (objtype != OSTREE_OBJECT_TYPE_RAW_FILE);
|
||||
|
||||
@ -141,11 +138,6 @@ unpack_one_object (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&input);
|
||||
g_clear_object (&file_info);
|
||||
ot_clear_gvariant (&xattrs);
|
||||
ot_clear_gvariant (&meta);
|
||||
ot_clear_gvariant (&serialized_meta);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -156,8 +148,8 @@ delete_one_packfile (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *data_path = NULL;
|
||||
GFile *index_path = NULL;
|
||||
ot_lobj GFile *data_path = NULL;
|
||||
ot_lobj GFile *index_path = NULL;
|
||||
|
||||
index_path = ostree_repo_get_pack_index_path (repo, pack_checksum);
|
||||
data_path = ostree_repo_get_pack_data_path (repo, pack_checksum);
|
||||
@ -175,8 +167,6 @@ delete_one_packfile (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&index_path);
|
||||
g_clear_object (&data_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -185,18 +175,18 @@ ostree_builtin_unpack (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GOptionContext *context;
|
||||
GCancellable *cancellable = NULL;
|
||||
gboolean in_transaction = FALSE;
|
||||
OtUnpackData data;
|
||||
OstreeRepo *repo = NULL;
|
||||
GHashTable *objects = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
GPtrArray *clusters = NULL;
|
||||
GHashTable *packed_objects = NULL;
|
||||
GHashTableIter hash_iter;
|
||||
GHashTable *packfiles_to_delete = NULL;
|
||||
gpointer key, value;
|
||||
GFile *objpath = NULL;
|
||||
guint64 unpacked_object_count = 0;
|
||||
GHashTableIter hash_iter;
|
||||
ot_lobj OstreeRepo *repo = NULL;
|
||||
ot_lhash GHashTable *objects = NULL;
|
||||
ot_lptrarray GPtrArray *clusters = NULL;
|
||||
ot_lhash GHashTable *packed_objects = NULL;
|
||||
ot_lhash GHashTable *packfiles_to_delete = NULL;
|
||||
ot_lobj GFile *objpath = NULL;
|
||||
|
||||
memset (&data, 0, sizeof (data));
|
||||
|
||||
@ -289,17 +279,7 @@ ostree_builtin_unpack (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
out:
|
||||
if (in_transaction)
|
||||
(void) ostree_repo_abort_transaction (repo, cancellable, NULL);
|
||||
g_clear_object (&objpath);
|
||||
if (context)
|
||||
g_option_context_free (context);
|
||||
g_clear_object (&repo);
|
||||
if (clusters)
|
||||
g_ptr_array_unref (clusters);
|
||||
if (packfiles_to_delete)
|
||||
g_hash_table_unref (packfiles_to_delete);
|
||||
if (packed_objects)
|
||||
g_hash_table_unref (packed_objects);
|
||||
if (objects)
|
||||
g_hash_table_unref (objects);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user