From 57617332180fad65f09520be7e8128b6d552833b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 29 Nov 2012 16:24:49 -0500 Subject: [PATCH] Drop some bits from libotutil that are now merged in libgsystem --- src/libgsystem | 2 +- src/libostree/ostree-core.c | 12 +-- src/libostree/ostree-diff.c | 6 +- src/libostree/ostree-repo-file.c | 12 +-- src/libostree/ostree-repo.c | 58 ++++++------- src/libostree/ostree-sysroot.c | 2 +- src/libotutil/ot-gio-utils.c | 96 +-------------------- src/libotutil/ot-gio-utils.h | 13 --- src/libotutil/ot-variant-utils.c | 2 +- src/ostree/ostree-pull.c | 8 +- src/ostree/ot-admin-builtin-deploy.c | 48 +++++------ src/ostree/ot-admin-builtin-diff.c | 4 +- src/ostree/ot-admin-builtin-init.c | 2 +- src/ostree/ot-admin-builtin-prune.c | 8 +- src/ostree/ot-admin-builtin-pull-deploy.c | 8 +- src/ostree/ot-admin-builtin-update-kernel.c | 14 +-- src/ostree/ot-admin-functions.c | 8 +- src/ostree/ot-builtin-ls.c | 4 +- src/ostree/ot-builtin-prune.c | 2 +- 19 files changed, 104 insertions(+), 205 deletions(-) diff --git a/src/libgsystem b/src/libgsystem index a6f48a97..1332d971 160000 --- a/src/libgsystem +++ b/src/libgsystem @@ -1 +1 @@ -Subproject commit a6f48a9720aa7b01b8abee1fc0eb78230b273485 +Subproject commit 1332d9713365a53fae76570a3c484753f9bcbb30 diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index 8b77a36a..3a8dc733 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -169,7 +169,7 @@ ostree_get_xattrs_for_file (GFile *f, GVariantBuilder builder; gboolean builder_initialized = FALSE; - path = ot_gfile_get_path_cached (f); + path = gs_file_get_path_cached (f); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)")); builder_initialized = TRUE; @@ -769,7 +769,7 @@ ostree_set_xattrs (GFile *f, gboolean ret = FALSE; int i, n; - path = ot_gfile_get_path_cached (f); + path = gs_file_get_path_cached (f); n = g_variant_n_children (xattrs); for (i = 0; i < n; i++) @@ -1146,11 +1146,11 @@ ostree_create_file_from_input (GFile *dest_file, { mode = S_IFREG | 0664; } - dest_path = ot_gfile_get_path_cached (dest_file); + dest_path = gs_file_get_path_cached (dest_file); if (S_ISDIR (mode)) { - if (mkdir (ot_gfile_get_path_cached (dest_file), mode) < 0) + if (mkdir (gs_file_get_path_cached (dest_file), mode) < 0) { ot_util_set_error_from_errno (error, errno); goto out; @@ -1302,7 +1302,7 @@ ostree_create_temp_file_from_input (GFile *dir, ot_lfree guchar *ret_csum = NULL; GString *tmp_name = NULL; - tmp_name = create_tmp_string (ot_gfile_get_path_cached (dir), + tmp_name = create_tmp_string (gs_file_get_path_cached (dir), prefix, suffix); /* 128 attempts seems reasonable... */ @@ -1394,7 +1394,7 @@ ostree_create_temp_dir (GFile *dir, dir = g_file_new_for_path (g_get_tmp_dir ()); template = g_strdup_printf ("%s/%s-XXXXXX", - ot_gfile_get_path_cached (dir), + gs_file_get_path_cached (dir), prefix ? prefix : "tmp"); if (mkdtemp (template) == NULL) diff --git a/src/libostree/ostree-diff.c b/src/libostree/ostree-diff.c index d7649cf3..94083eba 100644 --- a/src/libostree/ostree-diff.c +++ b/src/libostree/ostree-diff.c @@ -378,11 +378,11 @@ ostree_diff_print (GFile *base, for (i = 0; i < modified->len; i++) { OstreeDiffItem *diff = modified->pdata[i]; - g_print ("M %s\n", ot_gfile_get_path_cached (diff->src)); + g_print ("M %s\n", gs_file_get_path_cached (diff->src)); } for (i = 0; i < removed->len; i++) { - g_print ("D %s\n", ot_gfile_get_path_cached (removed->pdata[i])); + g_print ("D %s\n", gs_file_get_path_cached (removed->pdata[i])); } for (i = 0; i < added->len; i++) { @@ -395,6 +395,6 @@ ostree_diff_print (GFile *base, g_free (relpath); } else - g_print ("A %s\n", ot_gfile_get_path_cached (added_f)); + g_print ("A %s\n", gs_file_get_path_cached (added_f)); } } diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c index 516f9f2c..5a95afc8 100644 --- a/src/libostree/ostree-repo-file.c +++ b/src/libostree/ostree-repo-file.c @@ -105,7 +105,7 @@ set_error_noent (GFile *self, GError **error) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "No such file or directory: %s", - ot_gfile_get_path_cached (self)); + gs_file_get_path_cached (self)); return FALSE; } @@ -473,7 +473,7 @@ ostree_repo_file_get_uri (GFile *file) char *uri_path; char *ret; - path = ot_gfile_get_path_cached (file); + path = gs_file_get_path_cached (file); uri_path = g_filename_to_uri (path, NULL, NULL); g_assert (g_str_has_prefix (uri_path, "file://")); ret = g_strconcat ("ostree://", self->commit, uri_path+strlen("file://"), NULL); @@ -565,8 +565,8 @@ ostree_repo_file_prefix_matches (GFile *parent, const char *parent_path; const char *descendant_path; - parent_path = ot_gfile_get_path_cached (parent); - descendant_path = ot_gfile_get_path_cached (descendant); + parent_path = gs_file_get_path_cached (parent); + descendant_path = gs_file_get_path_cached (descendant); remainder = match_prefix (descendant_path, parent_path); if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder)) return TRUE; @@ -581,8 +581,8 @@ ostree_repo_file_get_relative_path (GFile *parent, const char *parent_path; const char *descendant_path; - parent_path = ot_gfile_get_path_cached (parent); - descendant_path = ot_gfile_get_path_cached (descendant); + parent_path = gs_file_get_path_cached (parent); + descendant_path = gs_file_get_path_cached (descendant); remainder = match_prefix (descendant_path, parent_path); if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder)) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index bbd25dbe..f3c26907 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -131,7 +131,7 @@ ostree_repo_set_property(GObject *object, { case PROP_PATH: /* Canonicalize */ - self->repodir = g_file_new_for_path (ot_gfile_get_path_cached (g_value_get_object (value))); + self->repodir = g_file_new_for_path (gs_file_get_path_cached (g_value_get_object (value))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -422,7 +422,7 @@ ostree_repo_resolve_rev (OstreeRepo *self, if (!ot_gfile_load_contents_utf8 (child, &ret_rev, NULL, NULL, &temp_error)) { g_propagate_error (error, temp_error); - g_prefix_error (error, "Couldn't open ref '%s': ", ot_gfile_get_path_cached (child)); + g_prefix_error (error, "Couldn't open ref '%s': ", gs_file_get_path_cached (child)); goto out; } @@ -614,11 +614,11 @@ ostree_repo_check (OstreeRepo *self, GError **error) if (self->inited) return TRUE; - if (!g_file_test (ot_gfile_get_path_cached (self->objects_dir), G_FILE_TEST_IS_DIR)) + if (!g_file_test (gs_file_get_path_cached (self->objects_dir), G_FILE_TEST_IS_DIR)) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Couldn't find objects directory '%s'", - ot_gfile_get_path_cached (self->objects_dir)); + gs_file_get_path_cached (self->objects_dir)); goto out; } @@ -626,7 +626,7 @@ ostree_repo_check (OstreeRepo *self, GError **error) goto out; self->config = g_key_file_new (); - if (!g_key_file_load_from_file (self->config, ot_gfile_get_path_cached (self->config_file), 0, error)) + if (!g_key_file_load_from_file (self->config, gs_file_get_path_cached (self->config_file), 0, error)) { g_prefix_error (error, "Couldn't parse config file: "); goto out; @@ -672,7 +672,7 @@ ostree_repo_check (OstreeRepo *self, GError **error) if (!ostree_repo_check (self->parent_repo, error)) { g_prefix_error (error, "While checking parent repository '%s': ", - ot_gfile_get_path_cached (parent_repo_f)); + gs_file_get_path_cached (parent_repo_f)); goto out; } } @@ -756,7 +756,7 @@ ensure_file_data_synced (GFile *file, gboolean ret = FALSE; int fd = -1; - if (!ot_unix_open_noatime (ot_gfile_get_path_cached (file), &fd, error)) + if (!ot_unix_open_noatime (gs_file_get_path_cached (file), &fd, error)) goto out; if (!ot_unix_fdatasync (fd, error)) @@ -794,13 +794,13 @@ commit_loose_object_impl (OstreeRepo *self, goto out; } - if (rename (ot_gfile_get_path_cached (tempfile_path), ot_gfile_get_path_cached (dest)) < 0) + if (rename (gs_file_get_path_cached (tempfile_path), gs_file_get_path_cached (dest)) < 0) { if (errno != EEXIST) { ot_util_set_error_from_errno (error, errno); g_prefix_error (error, "Storing file '%s': ", - ot_gfile_get_path_cached (dest)); + gs_file_get_path_cached (dest)); goto out; } } @@ -979,7 +979,7 @@ stage_object (OstreeRepo *self, */ target_mode |= (S_IRUSR | S_IRGRP | S_IROTH); - if (chmod (ot_gfile_get_path_cached (raw_temp_file), target_mode) < 0) + if (chmod (gs_file_get_path_cached (raw_temp_file), target_mode) < 0) { ot_util_set_error_from_errno (error, errno); goto out; @@ -1087,9 +1087,9 @@ stage_object (OstreeRepo *self, ot_transfer_out_value(out_csum, &ret_csum); out: if (temp_file) - (void) unlink (ot_gfile_get_path_cached (temp_file)); + (void) unlink (gs_file_get_path_cached (temp_file)); if (raw_temp_file) - (void) unlink (ot_gfile_get_path_cached (raw_temp_file)); + (void) unlink (gs_file_get_path_cached (raw_temp_file)); g_clear_pointer (&checksum, (GDestroyNotify) g_checksum_free); return ret; } @@ -1221,7 +1221,7 @@ scan_loose_devino (OstreeRepo *self, if (!enumerator) goto out; - dirname = ot_gfile_get_basename_cached (objdir); + dirname = gs_file_get_basename_cached (objdir); while ((file_info = g_file_enumerator_next_file (enumerator, cancellable, &temp_error)) != NULL) { @@ -2572,7 +2572,7 @@ ostree_repo_stage_archive_to_mtree (OstreeRepo *self, a = archive_read_new (); archive_read_support_compression_all (a); archive_read_support_format_all (a); - if (archive_read_open_filename (a, ot_gfile_get_path_cached (archive_f), 8192) != ARCHIVE_OK) + if (archive_read_open_filename (a, gs_file_get_path_cached (archive_f), 8192) != ARCHIVE_OK) { propagate_libarchive_error (error, a); goto out; @@ -2662,7 +2662,7 @@ list_loose_object_dir (OstreeRepo *self, ot_lobj GFileInfo *file_info = NULL; GString *checksum = NULL; - dirname = ot_gfile_get_basename_cached (dir); + dirname = gs_file_get_basename_cached (dir); /* We're only querying name */ enumerator = g_file_enumerate_children (dir, "standard::name,standard::type", @@ -2849,7 +2849,7 @@ ostree_repo_load_file (OstreeRepo *self, ret_input = (GInputStream*) gs_file_read_noatime (loose_path, cancellable, error); if (!ret_input) { - g_prefix_error (error, "Error opening loose file object %s: ", ot_gfile_get_path_cached (loose_path)); + g_prefix_error (error, "Error opening loose file object %s: ", gs_file_get_path_cached (loose_path)); goto out; } } @@ -2896,7 +2896,7 @@ repo_find_object (OstreeRepo *self, object_path = ostree_repo_get_object_path (self, checksum, objtype); - if (lstat (ot_gfile_get_path_cached (object_path), &stbuf) == 0) + if (lstat (gs_file_get_path_cached (object_path), &stbuf) == 0) { ret_stored_path = object_path; object_path = NULL; /* Transfer ownership */ @@ -3163,7 +3163,7 @@ checkout_file_from_input (GFile *file, goto out; } - if (rename (ot_gfile_get_path_cached (temp_file), ot_gfile_get_path_cached (file)) < 0) + if (rename (gs_file_get_path_cached (temp_file), gs_file_get_path_cached (file)) < 0) { ot_util_set_error_from_errno (error, errno); goto out; @@ -3204,10 +3204,10 @@ checkout_file_hardlink (OstreeRepo *self, ot_lobj GFile *dir = NULL; if (dirfd != -1 && - linkat (-1, ot_gfile_get_path_cached (source), - dirfd, ot_gfile_get_basename_cached (destination), 0) != -1) + linkat (-1, gs_file_get_path_cached (source), + dirfd, gs_file_get_basename_cached (destination), 0) != -1) ret_was_supported = TRUE; - else if (link (ot_gfile_get_path_cached (source), ot_gfile_get_path_cached (destination)) != -1) + else if (link (gs_file_get_path_cached (source), gs_file_get_path_cached (destination)) != -1) ret_was_supported = TRUE; else if (errno == EMLINK || errno == EXDEV || errno == EPERM) { @@ -3226,8 +3226,8 @@ checkout_file_hardlink (OstreeRepo *self, * * So we can't make this atomic. */ - (void) unlink (ot_gfile_get_path_cached (destination)); - if (link (ot_gfile_get_path_cached (source), ot_gfile_get_path_cached (destination)) < 0) + (void) unlink (gs_file_get_path_cached (destination)); + if (link (gs_file_get_path_cached (source), gs_file_get_path_cached (destination)) < 0) { ot_util_set_error_from_errno (error, errno); goto out; @@ -3284,7 +3284,7 @@ find_loose_for_checkout (OstreeRepo *self, continue; } - if (lstat (ot_gfile_get_path_cached (path), &stbuf) < 0) + if (lstat (gs_file_get_path_cached (path), &stbuf) < 0) { if (errno != ENOENT) { @@ -3403,7 +3403,7 @@ checkout_file_thread (GSimpleAsyncResult *result, if (!ot_gfile_ensure_directory (objdir, TRUE, error)) { g_prefix_error (error, "Creating cache directory %s: ", - ot_gfile_get_path_cached (objdir)); + gs_file_get_path_cached (objdir)); goto out; } @@ -3455,7 +3455,7 @@ checkout_file_thread (GSimpleAsyncResult *result, &hardlink_supported, cancellable, error)) { g_prefix_error (error, "Hardlinking loose object %s to %s: ", checksum, - ot_gfile_get_path_cached (checkout_data->destination)); + gs_file_get_path_cached (checkout_data->destination)); goto out; } } @@ -3474,7 +3474,7 @@ checkout_file_thread (GSimpleAsyncResult *result, input, cancellable, error)) { g_prefix_error (error, "Copying object %s to %s: ", checksum, - ot_gfile_get_path_cached (checkout_data->destination)); + gs_file_get_path_cached (checkout_data->destination)); goto out; } } @@ -3797,7 +3797,7 @@ ostree_repo_checkout_tree_async (OstreeRepo *self, cancellable, error)) goto out; - checkout_data->dir_handle = opendir (ot_gfile_get_path_cached (checkout_data->destination)); + checkout_data->dir_handle = opendir (gs_file_get_path_cached (checkout_data->destination)); if (!checkout_data->dir_handle) { ot_util_set_error_from_errno (error, errno); @@ -3887,7 +3887,7 @@ ostree_repo_checkout_gc (OstreeRepo *self, { ot_lobj GFile *objpath = NULL; objpath = ot_gfile_get_child_build_path (objdir, g_file_info_get_name (file_info), NULL); - if (!ot_gfile_unlink (objpath, cancellable, error)) + if (!gs_file_unlink (objpath, cancellable, error)) goto out; } g_object_unref (file_info); diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 188e4bea..ea13cf71 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -84,7 +84,7 @@ ostree_run_triggers_in_root (GFile *root, g_ptr_array_add (argv, "--mount-bind"); g_ptr_array_add (argv, "/dev"); g_ptr_array_add (argv, "/dev"); - g_ptr_array_add (argv, (char*)ot_gfile_get_path_cached (root)); + g_ptr_array_add (argv, (char*)gs_file_get_path_cached (root)); } g_ptr_array_add (argv, "ostree-run-triggers"); g_ptr_array_add (argv, NULL); diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c index 43e5a6e6..f28693d5 100644 --- a/src/libotutil/ot-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -172,65 +172,6 @@ ot_gfile_get_child_build_path (GFile *parent, return g_file_resolve_relative_path (parent, path); } -/** - * ot_gfile_unlink: - * @path: Path to file - * @cancellable: a #GCancellable - * @error: a #GError - * - * Like g_file_delete(), except this function does not follow Unix - * symbolic links, and will delete a symbolic link even if it's - * pointing to a nonexistent file. In other words, this function - * merely wraps the raw Unix function unlink(). - * - * Returns: %TRUE on success, %FALSE on error - */ -gboolean -ot_gfile_unlink (GFile *path, - GCancellable *cancellable, - GError **error) -{ - if (g_cancellable_set_error_if_cancelled (cancellable, error)) - return FALSE; - - if (unlink (ot_gfile_get_path_cached (path)) < 0) - { - ot_util_set_error_from_errno (error, errno); - return FALSE; - } - return TRUE; -} - -/** - * ot_gfile_rename: - * @from: Current path - * @to: New path - * @cancellable: a #GCancellable - * @error: a #GError - * - * This function wraps the raw Unix function rename(). - * - * Returns: %TRUE on success, %FALSE on error - */ -gboolean -ot_gfile_rename (GFile *from, - GFile *to, - GCancellable *cancellable, - GError **error) -{ - if (g_cancellable_set_error_if_cancelled (cancellable, error)) - return FALSE; - - if (rename (ot_gfile_get_path_cached (from), - ot_gfile_get_path_cached (to)) < 0) - { - ot_util_set_error_from_errno (error, errno); - return FALSE; - } - return TRUE; - -} - gboolean ot_gfile_load_contents_utf8 (GFile *file, char **out_contents, @@ -261,35 +202,6 @@ ot_gfile_load_contents_utf8 (GFile *file, return ret; } -const char * -ot_gfile_get_path_cached (GFile *file) -{ - const char *path; - - path = g_object_get_data ((GObject*)file, "ostree-file-path"); - if (!path) - { - path = g_file_get_path (file); - g_object_set_data_full ((GObject*)file, "ostree-file-path", (char*)path, (GDestroyNotify)g_free); - } - return path; -} - - -const char * -ot_gfile_get_basename_cached (GFile *file) -{ - const char *name; - - name = g_object_get_data ((GObject*)file, "ostree-file-name"); - if (!name) - { - name = g_file_get_basename (file); - g_object_set_data_full ((GObject*)file, "ostree-file-name", (char*)name, (GDestroyNotify)g_free); - } - return name; -} - gboolean ot_gio_write_update_checksum (GOutputStream *out, gconstpointer data, @@ -474,7 +386,7 @@ cp_internal (GFile *src, cancellable, error)) goto out; */ - if (chmod (ot_gfile_get_path_cached (dest_child), + if (chmod (gs_file_get_path_cached (dest_child), g_file_info_get_attribute_uint32 (file_info, "unix::mode")) == -1) { ot_util_set_error_from_errno (error, errno); @@ -487,10 +399,10 @@ cp_internal (GFile *src, else { gboolean did_link = FALSE; - (void) unlink (ot_gfile_get_path_cached (dest_child)); + (void) unlink (gs_file_get_path_cached (dest_child)); if (use_hardlinks) { - if (link (ot_gfile_get_path_cached (src_child), ot_gfile_get_path_cached (dest_child)) == -1) + if (link (gs_file_get_path_cached (src_child), gs_file_get_path_cached (dest_child)) == -1) { if (!(errno == EMLINK || errno == EXDEV)) { @@ -611,7 +523,7 @@ ot_gio_shutil_rm_rf (GFile *path, } else { - if (!ot_gfile_unlink (subpath, cancellable, error)) + if (!gs_file_unlink (subpath, cancellable, error)) goto out; } g_clear_object (&file_info); diff --git a/src/libotutil/ot-gio-utils.h b/src/libotutil/ot-gio-utils.h index 7505c3a2..a7c3b40a 100644 --- a/src/libotutil/ot-gio-utils.h +++ b/src/libotutil/ot-gio-utils.h @@ -42,21 +42,8 @@ GFile *ot_gfile_get_child_strconcat (GFile *parent, const char *first, ...) G_GN GFile *ot_gfile_get_child_build_path (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED; -const char *ot_gfile_get_path_cached (GFile *file); - -const char *ot_gfile_get_basename_cached (GFile *file); - gboolean ot_gfile_ensure_directory (GFile *dir, gboolean with_parents, GError **error); -gboolean ot_gfile_rename (GFile *src, - GFile *dest, - GCancellable *cancellable, - GError **error); - -gboolean ot_gfile_unlink (GFile *path, - GCancellable *cancellable, - GError **error); - gboolean ot_gfile_load_contents_utf8 (GFile *file, char **contents_out, char **etag_out, diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c index 21349aea..caa39ea6 100644 --- a/src/libotutil/ot-variant-utils.c +++ b/src/libotutil/ot-variant-utils.c @@ -114,7 +114,7 @@ ot_util_variant_map (GFile *src, GMappedFile *mfile = NULL; int fd; - path = ot_gfile_get_path_cached (src); + path = gs_file_get_path_cached (src); if (!ot_unix_open_noatime (path, &fd, error)) goto out; mfile = g_mapped_file_new_from_fd (fd, FALSE, error); diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c index 4c0e2ddd..7703ecd6 100644 --- a/src/ostree/ostree-pull.c +++ b/src/ostree/ostree-pull.c @@ -373,7 +373,7 @@ fetch_uri_contents_utf8 (OtPullData *pull_data, ot_transfer_out_value (out_contents, &ret_contents); out: if (tmpf) - (void) unlink (ot_gfile_get_path_cached (tmpf)); + (void) unlink (gs_file_get_path_cached (tmpf)); return ret; } @@ -512,10 +512,10 @@ static void destroy_fetch_one_content_item_data (OtFetchOneContentItemData *data) { if (data->meta_path) - (void) ot_gfile_unlink (data->meta_path, NULL, NULL); + (void) gs_file_unlink (data->meta_path, NULL, NULL); g_clear_object (&data->meta_path); if (data->content_path) - (void) ot_gfile_unlink (data->content_path, NULL, NULL); + (void) gs_file_unlink (data->content_path, NULL, NULL); g_clear_object (&data->content_path); g_free (data->checksum); g_free (data); @@ -749,7 +749,7 @@ on_metadata_staged (GObject *object, g_variant_ref (fetch_data->object)); ot_worker_queue_release (pull_data->metadata_objects_to_scan); - (void) ot_gfile_unlink (fetch_data->temp_path, NULL, NULL); + (void) gs_file_unlink (fetch_data->temp_path, NULL, NULL); g_object_unref (fetch_data->temp_path); g_variant_unref (fetch_data->object); g_free (fetch_data); diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c index f4246943..27b7ce75 100644 --- a/src/ostree/ot-admin-builtin-deploy.c +++ b/src/ostree/ot-admin-builtin-deploy.c @@ -85,17 +85,17 @@ update_current (OtAdminDeploy *self, if (g_file_equal (current_deployment, deploy_target)) { - g_print ("ostadmin: %s already points to %s\n", ot_gfile_get_path_cached (current_path), + g_print ("ostadmin: %s already points to %s\n", gs_file_get_path_cached (current_path), relative_current); return TRUE; } tmp_previous_path = g_file_get_child (self->ostree_dir, "tmp-previous"); - (void) ot_gfile_unlink (tmp_previous_path, NULL, NULL); + (void) gs_file_unlink (tmp_previous_path, NULL, NULL); relative_previous = g_file_get_relative_path (self->ostree_dir, current_deployment); g_assert (relative_previous); - if (symlink (relative_previous, ot_gfile_get_path_cached (tmp_previous_path)) < 0) + if (symlink (relative_previous, gs_file_get_path_cached (tmp_previous_path)) < 0) { ot_util_set_error_from_errno (error, errno); goto out; @@ -103,37 +103,37 @@ update_current (OtAdminDeploy *self, } tmp_current_path = g_file_get_child (self->ostree_dir, "tmp-current"); - (void) ot_gfile_unlink (tmp_current_path, NULL, NULL); + (void) gs_file_unlink (tmp_current_path, NULL, NULL); - if (symlink (relative_current, ot_gfile_get_path_cached (tmp_current_path)) < 0) + if (symlink (relative_current, gs_file_get_path_cached (tmp_current_path)) < 0) { ot_util_set_error_from_errno (error, errno); goto out; } tmp_current_etc_path = g_file_get_child (self->ostree_dir, "tmp-current-etc"); - (void) ot_gfile_unlink (tmp_current_etc_path, NULL, NULL); - if (symlink (relative_current_etc, ot_gfile_get_path_cached (tmp_current_etc_path)) < 0) + (void) gs_file_unlink (tmp_current_etc_path, NULL, NULL); + if (symlink (relative_current_etc, gs_file_get_path_cached (tmp_current_etc_path)) < 0) { ot_util_set_error_from_errno (error, errno); goto out; } - if (!ot_gfile_rename (tmp_current_path, current_path, - cancellable, error)) + if (!gs_file_rename (tmp_current_path, current_path, + cancellable, error)) goto out; - if (!ot_gfile_rename (tmp_current_etc_path, current_etc_path, - cancellable, error)) + if (!gs_file_rename (tmp_current_etc_path, current_etc_path, + cancellable, error)) goto out; if (tmp_previous_path) { - if (!ot_gfile_rename (tmp_previous_path, previous_path, - cancellable, error)) + if (!gs_file_rename (tmp_previous_path, previous_path, + cancellable, error)) goto out; } - g_print ("ostadmin: %s set to %s\n", ot_gfile_get_path_cached (current_path), + g_print ("ostadmin: %s set to %s\n", gs_file_get_path_cached (current_path), relative_current); ret = TRUE; @@ -173,7 +173,7 @@ on_checkout_complete (GObject *object, /** * ensure_unlinked: * - * Like ot_gfile_unlink(), but return successfully if the file doesn't + * Like gs_file_unlink(), but return successfully if the file doesn't * exist. */ static gboolean @@ -184,7 +184,7 @@ ensure_unlinked (GFile *path, gboolean ret = FALSE; GError *temp_error = NULL; - if (!ot_gfile_unlink (path, cancellable, &temp_error)) + if (!gs_file_unlink (path, cancellable, &temp_error)) { if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { @@ -438,7 +438,7 @@ deploy_tree (OtAdminDeploy *self, ot_lfree char *etc_name; ot_lobj GFile *parent; - etc_name = g_strconcat (ot_gfile_get_basename_cached (previous_deployment), "-etc", NULL); + etc_name = g_strconcat (gs_file_get_basename_cached (previous_deployment), "-etc", NULL); parent = g_file_get_parent (previous_deployment); previous_deployment_etc = g_file_get_child (parent, etc_name); @@ -460,7 +460,7 @@ deploy_tree (OtAdminDeploy *self, ProcessOneCheckoutData checkout_data; g_print ("ostadmin: Creating deployment %s\n", - ot_gfile_get_path_cached (deploy_target_path)); + gs_file_get_path_cached (deploy_target_path)); memset (&checkout_data, 0, sizeof (checkout_data)); checkout_data.loop = g_main_loop_new (NULL, TRUE); @@ -489,7 +489,7 @@ deploy_tree (OtAdminDeploy *self, cancellable, error)) goto out; - g_print ("ostadmin: Created %s\n", ot_gfile_get_path_cached (deploy_target_etc_path)); + g_print ("ostadmin: Created %s\n", gs_file_get_path_cached (deploy_target_etc_path)); if (previous_deployment_etc) { @@ -501,8 +501,8 @@ deploy_tree (OtAdminDeploy *self, else g_print ("ostadmin: No previous deployment; therefore, no configuration changes to merge\n"); - if (!ot_gfile_rename (deploy_target_path_tmp, deploy_target_path, - cancellable, error)) + if (!gs_file_rename (deploy_target_path_tmp, deploy_target_path, + cancellable, error)) goto out; } @@ -545,14 +545,14 @@ do_update_kernel (OtAdminDeploy *self, args = g_ptr_array_new (); ot_ptrarray_add_many (args, "ostree", "admin", - "--ostree-dir", ot_gfile_get_path_cached (self->ostree_dir), + "--ostree-dir", gs_file_get_path_cached (self->ostree_dir), "update-kernel", - ot_gfile_get_path_cached (deploy_path), NULL); + gs_file_get_path_cached (deploy_path), NULL); if (opt_no_kernel) g_ptr_array_add (args, "--modules-only"); g_ptr_array_add (args, NULL); - if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (self->ostree_dir), + if (!ot_spawn_sync_checked (gs_file_get_path_cached (self->ostree_dir), (char**)args->pdata, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, error)) goto out; diff --git a/src/ostree/ot-admin-builtin-diff.c b/src/ostree/ot-admin-builtin-diff.c index a5c347dc..7b9eb498 100644 --- a/src/ostree/ot-admin-builtin-diff.c +++ b/src/ostree/ot-admin-builtin-diff.c @@ -62,7 +62,7 @@ ot_admin_builtin_diff (int argc, char **argv, GFile *ostree_dir, GError **error) if (!g_file_query_exists (deployment, NULL)) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Deployment %s doesn't exist", ot_gfile_get_path_cached (deployment)); + "Deployment %s doesn't exist", gs_file_get_path_cached (deployment)); goto out; } } @@ -76,7 +76,7 @@ ot_admin_builtin_diff (int argc, char **argv, GFile *ostree_dir, GError **error) orig_etc_path = g_file_resolve_relative_path (deployment, "etc"); deploy_parent = g_file_get_parent (deployment); new_etc_path = ot_gfile_get_child_strconcat (deploy_parent, - ot_gfile_get_basename_cached (deployment), + gs_file_get_basename_cached (deployment), "-etc", NULL); modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref); diff --git a/src/ostree/ot-admin-builtin-init.c b/src/ostree/ot-admin-builtin-init.c index f4331768..8774fd25 100644 --- a/src/ostree/ot-admin-builtin-init.c +++ b/src/ostree/ot-admin-builtin-init.c @@ -49,7 +49,7 @@ ot_admin_builtin_init (int argc, char **argv, GFile *ostree_dir, GError **error) if (!ot_admin_ensure_initialized (ostree_dir, cancellable, error)) goto out; - g_print ("%s initialized as OSTree root\n", ot_gfile_get_path_cached (ostree_dir)); + g_print ("%s initialized as OSTree root\n", gs_file_get_path_cached (ostree_dir)); ret = TRUE; out: diff --git a/src/ostree/ot-admin-builtin-prune.c b/src/ostree/ot-admin-builtin-prune.c index 5551644a..89a209e8 100644 --- a/src/ostree/ot-admin-builtin-prune.c +++ b/src/ostree/ot-admin-builtin-prune.c @@ -139,10 +139,10 @@ ot_admin_builtin_prune (int argc, char **argv, GFile *ostree_dir, GError **error continue; parent = g_file_get_parent (deployment); - deployment_etc = ot_gfile_get_child_strconcat (parent, ot_gfile_get_basename_cached (deployment), + deployment_etc = ot_gfile_get_child_strconcat (parent, gs_file_get_basename_cached (deployment), "-etc", NULL); - g_print ("Deleting deployment %s\n", ot_gfile_get_path_cached (deployment)); + g_print ("Deleting deployment %s\n", gs_file_get_path_cached (deployment)); if (!ot_gio_shutil_rm_rf (deployment, cancellable, error)) goto out; /* Note - not atomic; we may be leaving the -etc directory around @@ -159,13 +159,13 @@ ot_admin_builtin_prune (int argc, char **argv, GFile *ostree_dir, GError **error ot_lptrarray GPtrArray *prune_argv = NULL; ot_lfree char *repo_arg = NULL; - repo_arg = g_strconcat ("--repo=", ot_gfile_get_path_cached (repo_path), NULL); + repo_arg = g_strconcat ("--repo=", gs_file_get_path_cached (repo_path), NULL); prune_argv = g_ptr_array_new (); ot_ptrarray_add_many (prune_argv, "ostree", repo_arg, "prune", "--refs-only", "--depth=0", NULL); g_ptr_array_add (prune_argv, NULL); - if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (ostree_dir), + if (!ot_spawn_sync_checked (gs_file_get_path_cached (ostree_dir), (char**)prune_argv->pdata, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, error)) goto out; diff --git a/src/ostree/ot-admin-builtin-pull-deploy.c b/src/ostree/ot-admin-builtin-pull-deploy.c index fb7db7d2..10a5d545 100644 --- a/src/ostree/ot-admin-builtin-pull-deploy.c +++ b/src/ostree/ot-admin-builtin-pull-deploy.c @@ -147,12 +147,12 @@ ot_admin_builtin_pull_deploy (int argc, char **argv, GFile *ostree_dir, GError * subproc_args = g_ptr_array_new (); { ot_lfree char *repo_arg = g_strconcat ("--repo=", - ot_gfile_get_path_cached (repo_path), + gs_file_get_path_cached (repo_path), NULL); ot_ptrarray_add_many (subproc_args, "ostree", "pull", repo_arg, remote_name, NULL); g_ptr_array_add (subproc_args, NULL); - if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (ostree_dir), + if (!ot_spawn_sync_checked (gs_file_get_path_cached (ostree_dir), (char**)subproc_args->pdata, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, error)) goto out; @@ -163,13 +163,13 @@ ot_admin_builtin_pull_deploy (int argc, char **argv, GFile *ostree_dir, GError * subproc_args = g_ptr_array_new (); { ot_lfree char *opt_ostree_dir_arg = g_strconcat ("--ostree-dir=", - ot_gfile_get_path_cached (ostree_dir), + gs_file_get_path_cached (ostree_dir), NULL); ot_ptrarray_add_many (subproc_args, "ostree", "admin", opt_ostree_dir_arg, "deploy", deploy_name, NULL); g_ptr_array_add (subproc_args, NULL); - if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (ostree_dir), + if (!ot_spawn_sync_checked (gs_file_get_path_cached (ostree_dir), (char**)subproc_args->pdata, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, error)) goto out; diff --git a/src/ostree/ot-admin-builtin-update-kernel.c b/src/ostree/ot-admin-builtin-update-kernel.c index 699456c5..0629bfeb 100644 --- a/src/ostree/ot-admin-builtin-update-kernel.c +++ b/src/ostree/ot-admin-builtin-update-kernel.c @@ -120,9 +120,9 @@ update_initramfs (OtAdminUpdateKernel *self, "--mount-readonly", "/", "--mount-proc", "/proc", "--mount-bind", "/dev", "/dev", - "--mount-bind", ot_gfile_get_path_cached (ostree_vardir), "/var", - "--mount-bind", ot_gfile_get_path_cached (tmpdir), "/tmp", - "--mount-bind", ot_gfile_get_path_cached (ostree_moduledir), "/lib/modules", + "--mount-bind", gs_file_get_path_cached (ostree_vardir), "/var", + "--mount-bind", gs_file_get_path_cached (tmpdir), "/tmp", + "--mount-bind", gs_file_get_path_cached (ostree_moduledir), "/lib/modules", deploy_path, "dracut", "-f", "/tmp/initramfs-ostree.img", release, NULL); @@ -151,10 +151,10 @@ update_initramfs (OtAdminUpdateKernel *self, if (!g_file_copy (initramfs_tmp_file, initramfs_file, 0, cancellable, NULL, NULL, error)) goto out; - g_print ("Created: %s\n", ot_gfile_get_path_cached (initramfs_file)); + g_print ("Created: %s\n", gs_file_get_path_cached (initramfs_file)); - (void) ot_gfile_unlink (initramfs_tmp_file, NULL, NULL); - (void) rmdir (ot_gfile_get_path_cached (tmpdir)); + (void) gs_file_unlink (initramfs_tmp_file, NULL, NULL); + (void) rmdir (gs_file_get_path_cached (tmpdir)); } ret = TRUE; @@ -259,7 +259,7 @@ update_grub (OtAdminUpdateKernel *self, } grubby_args = g_ptr_array_new (); - add_kernel_arg = g_strconcat ("--add-kernel=", ot_gfile_get_path_cached (kernel_path), NULL); + add_kernel_arg = g_strconcat ("--add-kernel=", gs_file_get_path_cached (kernel_path), NULL); initramfs_arg = g_strconcat ("--initrd=", "/boot/initramfs-ostree-", release, ".img", NULL); ot_ptrarray_add_many (grubby_args, "grubby", "--grub", add_kernel_arg, initramfs_arg, "--copy-default", "--title=OSTree", NULL); diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c index 63c8266c..6ddb7681 100644 --- a/src/ostree/ot-admin-functions.c +++ b/src/ostree/ot-admin-functions.c @@ -54,7 +54,7 @@ ot_admin_ensure_initialized (GFile *ostree_dir, if (!g_file_query_exists (dir, NULL)) { ot_lfree char *opt_repo_arg = g_strdup_printf ("--repo=%s/repo", - ot_gfile_get_path_cached (ostree_dir)); + gs_file_get_path_cached (ostree_dir)); const char *child_argv[] = { "ostree", opt_repo_arg, "init", NULL }; if (!ot_spawn_sync_checked (NULL, (char**)child_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, @@ -77,7 +77,7 @@ ot_admin_ensure_initialized (GFile *ostree_dir, dir = ot_gfile_get_child_build_path (ostree_dir, "var", "tmp", NULL); if (!ot_gfile_ensure_directory (dir, TRUE, error)) goto out; - if (chmod (ot_gfile_get_path_cached (dir), 01777) < 0) + if (chmod (gs_file_get_path_cached (dir), 01777) < 0) { ot_util_set_error_from_errno (error, errno); goto out; @@ -90,9 +90,9 @@ ot_admin_ensure_initialized (GFile *ostree_dir, g_clear_object (&dir); dir = ot_gfile_get_child_build_path (ostree_dir, "var", "run", NULL); - if (!g_file_test (ot_gfile_get_path_cached (dir), G_FILE_TEST_IS_SYMLINK)) + if (!g_file_test (gs_file_get_path_cached (dir), G_FILE_TEST_IS_SYMLINK)) { - if (symlink ("../run", ot_gfile_get_path_cached (dir)) < 0) + if (symlink ("../run", gs_file_get_path_cached (dir)) < 0) { ot_util_set_error_from_errno (error, errno); goto out; diff --git a/src/ostree/ot-builtin-ls.c b/src/ostree/ot-builtin-ls.c index 6bbd3244..73589ee9 100644 --- a/src/ostree/ot-builtin-ls.c +++ b/src/ostree/ot-builtin-ls.c @@ -111,7 +111,7 @@ print_one_file_text (GFile *f, g_variant_unref (xattrs); } - g_string_append (buf, ot_gfile_get_path_cached (f)); + g_string_append (buf, gs_file_get_path_cached (f)); if (type == G_FILE_TYPE_SYMBOLIC_LINK) g_string_append_printf (buf, " -> %s", g_file_info_get_attribute_byte_string (file_info, "standard::symlink-target")); @@ -130,7 +130,7 @@ print_one_file_binary (GFile *f, if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile*)f, NULL)) g_assert_not_reached (); - path = ot_gfile_get_path_cached (f); + path = gs_file_get_path_cached (f); fwrite (path, 1, strlen (path), stdout); fwrite ("\0", 1, 1, stdout); diff --git a/src/ostree/ot-builtin-prune.c b/src/ostree/ot-builtin-prune.c index 713e7b89..c72f9517 100644 --- a/src/ostree/ot-builtin-prune.c +++ b/src/ostree/ot-builtin-prune.c @@ -75,7 +75,7 @@ maybe_prune_loose_object (OtPruneData *data, cancellable, error)) == NULL) goto out; - if (!ot_gfile_unlink (objf, cancellable, error)) + if (!gs_file_unlink (objf, cancellable, error)) goto out; data->freed_bytes += g_file_info_get_size (info);