repo: Rename ostree_repo_check to ostree_repo_open
As it more clearly describes what the function does: load the repo from disk and initialize it. At the same time, add a cancellable parameter. https://bugzilla.gnome.org/show_bug.cgi?id=707582
This commit is contained in:
parent
57d285f619
commit
02adfc8c03
|
|
@ -54,7 +54,7 @@
|
||||||
*
|
*
|
||||||
* Creating an #OstreeRepo does not invoke any file I/O, and thus needs
|
* Creating an #OstreeRepo does not invoke any file I/O, and thus needs
|
||||||
* to be initialized, either from an existing contents or with a new
|
* to be initialized, either from an existing contents or with a new
|
||||||
* repository. If you have an existing repo, use ostree_repo_check()
|
* repository. If you have an existing repo, use ostree_repo_open()
|
||||||
* to load it from disk and check its validity. To initialize a new
|
* to load it from disk and check its validity. To initialize a new
|
||||||
* repository in the given filepath, use ostree_repo_create() instead.
|
* repository in the given filepath, use ostree_repo_create() instead.
|
||||||
*
|
*
|
||||||
|
|
@ -434,7 +434,7 @@ ostree_repo_create (OstreeRepo *self,
|
||||||
if (!g_file_make_directory (grandchild, cancellable, error))
|
if (!g_file_make_directory (grandchild, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!ostree_repo_check (self, error))
|
if (!ostree_repo_open (self, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
@ -446,7 +446,9 @@ ostree_repo_create (OstreeRepo *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
ostree_repo_check (OstreeRepo *self, GError **error)
|
ostree_repo_open (OstreeRepo *self,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
gboolean is_archive;
|
gboolean is_archive;
|
||||||
|
|
@ -467,7 +469,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gs_file_ensure_directory (self->pending_dir, FALSE, NULL, error))
|
if (!gs_file_ensure_directory (self->pending_dir, FALSE, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
self->config = g_key_file_new ();
|
self->config = g_key_file_new ();
|
||||||
|
|
@ -514,7 +516,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
|
||||||
|
|
||||||
self->parent_repo = ostree_repo_new (parent_repo_f);
|
self->parent_repo = ostree_repo_new (parent_repo_f);
|
||||||
|
|
||||||
if (!ostree_repo_check (self->parent_repo, error))
|
if (!ostree_repo_open (self->parent_repo, cancellable, error))
|
||||||
{
|
{
|
||||||
g_prefix_error (error, "While checking parent repository '%s': ",
|
g_prefix_error (error, "While checking parent repository '%s': ",
|
||||||
gs_file_get_path_cached (parent_repo_f));
|
gs_file_get_path_cached (parent_repo_f));
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,9 @@ OstreeRepo* ostree_repo_new (GFile *path);
|
||||||
|
|
||||||
OstreeRepo* ostree_repo_new_default (void);
|
OstreeRepo* ostree_repo_new_default (void);
|
||||||
|
|
||||||
gboolean ostree_repo_check (OstreeRepo *self, GError **error);
|
gboolean ostree_repo_open (OstreeRepo *self,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
gboolean ostree_repo_create (OstreeRepo *self,
|
gboolean ostree_repo_create (OstreeRepo *self,
|
||||||
OstreeRepoMode mode,
|
OstreeRepoMode mode,
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, GFile *sysroot, GCancellable *c
|
||||||
|
|
||||||
repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
|
repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
|
||||||
repo = ostree_repo_new (repo_path);
|
repo = ostree_repo_new (repo_path);
|
||||||
if (!ostree_repo_check (repo, error))
|
if (!ostree_repo_open (repo, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
origin = ot_deployment_get_origin (merge_deployment);
|
origin = ot_deployment_get_origin (merge_deployment);
|
||||||
|
|
|
||||||
|
|
@ -829,7 +829,7 @@ ot_admin_get_repo (GFile *sysroot,
|
||||||
gs_unref_object GFile *repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
|
gs_unref_object GFile *repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
|
||||||
|
|
||||||
ret_repo = ostree_repo_new (repo_path);
|
ret_repo = ostree_repo_new (repo_path);
|
||||||
if (!ostree_repo_check (ret_repo, error))
|
if (!ostree_repo_open (ret_repo, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeRepo *repo, GCancellable
|
||||||
src_f = g_file_new_for_path (src_repo_path);
|
src_f = g_file_new_for_path (src_repo_path);
|
||||||
|
|
||||||
data->src_repo = ostree_repo_new (src_f);
|
data->src_repo = ostree_repo_new (src_f);
|
||||||
if (!ostree_repo_check (data->src_repo, error))
|
if (!ostree_repo_open (data->src_repo, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
data->threadpool = ot_thread_pool_new_nproc (import_one_object_thread, data);
|
data->threadpool = ot_thread_pool_new_nproc (import_one_object_thread, data);
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ ostree_run (int argc,
|
||||||
{
|
{
|
||||||
GError *temp_error = NULL;
|
GError *temp_error = NULL;
|
||||||
repo = ostree_repo_new_default ();
|
repo = ostree_repo_new_default ();
|
||||||
if (!ostree_repo_check (repo, &temp_error))
|
if (!ostree_repo_open (repo, cancellable, &temp_error))
|
||||||
{
|
{
|
||||||
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||||
{
|
{
|
||||||
|
|
@ -246,7 +246,7 @@ ostree_run (int argc,
|
||||||
repo = ostree_repo_new (repo_file);
|
repo = ostree_repo_new (repo_file);
|
||||||
if (!(command->flags & OSTREE_BUILTIN_FLAG_NO_CHECK))
|
if (!(command->flags & OSTREE_BUILTIN_FLAG_NO_CHECK))
|
||||||
{
|
{
|
||||||
if (!ostree_repo_check (repo, &error))
|
if (!ostree_repo_open (repo, cancellable, &error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue