Drop some bits from libotutil that are now merged in libgsystem
This commit is contained in:
parent
d1ddfc973c
commit
5761733218
|
|
@ -1 +1 @@
|
||||||
Subproject commit a6f48a9720aa7b01b8abee1fc0eb78230b273485
|
Subproject commit 1332d9713365a53fae76570a3c484753f9bcbb30
|
||||||
|
|
@ -169,7 +169,7 @@ ostree_get_xattrs_for_file (GFile *f,
|
||||||
GVariantBuilder builder;
|
GVariantBuilder builder;
|
||||||
gboolean builder_initialized = FALSE;
|
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)"));
|
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)"));
|
||||||
builder_initialized = TRUE;
|
builder_initialized = TRUE;
|
||||||
|
|
@ -769,7 +769,7 @@ ostree_set_xattrs (GFile *f,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
path = ot_gfile_get_path_cached (f);
|
path = gs_file_get_path_cached (f);
|
||||||
|
|
||||||
n = g_variant_n_children (xattrs);
|
n = g_variant_n_children (xattrs);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
|
|
@ -1146,11 +1146,11 @@ ostree_create_file_from_input (GFile *dest_file,
|
||||||
{
|
{
|
||||||
mode = S_IFREG | 0664;
|
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 (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);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -1302,7 +1302,7 @@ ostree_create_temp_file_from_input (GFile *dir,
|
||||||
ot_lfree guchar *ret_csum = NULL;
|
ot_lfree guchar *ret_csum = NULL;
|
||||||
GString *tmp_name = 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);
|
prefix, suffix);
|
||||||
|
|
||||||
/* 128 attempts seems reasonable... */
|
/* 128 attempts seems reasonable... */
|
||||||
|
|
@ -1394,7 +1394,7 @@ ostree_create_temp_dir (GFile *dir,
|
||||||
dir = g_file_new_for_path (g_get_tmp_dir ());
|
dir = g_file_new_for_path (g_get_tmp_dir ());
|
||||||
|
|
||||||
template = g_strdup_printf ("%s/%s-XXXXXX",
|
template = g_strdup_printf ("%s/%s-XXXXXX",
|
||||||
ot_gfile_get_path_cached (dir),
|
gs_file_get_path_cached (dir),
|
||||||
prefix ? prefix : "tmp");
|
prefix ? prefix : "tmp");
|
||||||
|
|
||||||
if (mkdtemp (template) == NULL)
|
if (mkdtemp (template) == NULL)
|
||||||
|
|
|
||||||
|
|
@ -378,11 +378,11 @@ ostree_diff_print (GFile *base,
|
||||||
for (i = 0; i < modified->len; i++)
|
for (i = 0; i < modified->len; i++)
|
||||||
{
|
{
|
||||||
OstreeDiffItem *diff = modified->pdata[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++)
|
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++)
|
for (i = 0; i < added->len; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -395,6 +395,6 @@ ostree_diff_print (GFile *base,
|
||||||
g_free (relpath);
|
g_free (relpath);
|
||||||
}
|
}
|
||||||
else
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ set_error_noent (GFile *self, GError **error)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
||||||
"No such file or directory: %s",
|
"No such file or directory: %s",
|
||||||
ot_gfile_get_path_cached (self));
|
gs_file_get_path_cached (self));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -473,7 +473,7 @@ ostree_repo_file_get_uri (GFile *file)
|
||||||
char *uri_path;
|
char *uri_path;
|
||||||
char *ret;
|
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);
|
uri_path = g_filename_to_uri (path, NULL, NULL);
|
||||||
g_assert (g_str_has_prefix (uri_path, "file://"));
|
g_assert (g_str_has_prefix (uri_path, "file://"));
|
||||||
ret = g_strconcat ("ostree://", self->commit, uri_path+strlen("file://"), NULL);
|
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 *parent_path;
|
||||||
const char *descendant_path;
|
const char *descendant_path;
|
||||||
|
|
||||||
parent_path = ot_gfile_get_path_cached (parent);
|
parent_path = gs_file_get_path_cached (parent);
|
||||||
descendant_path = ot_gfile_get_path_cached (descendant);
|
descendant_path = gs_file_get_path_cached (descendant);
|
||||||
remainder = match_prefix (descendant_path, parent_path);
|
remainder = match_prefix (descendant_path, parent_path);
|
||||||
if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder))
|
if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -581,8 +581,8 @@ ostree_repo_file_get_relative_path (GFile *parent,
|
||||||
const char *parent_path;
|
const char *parent_path;
|
||||||
const char *descendant_path;
|
const char *descendant_path;
|
||||||
|
|
||||||
parent_path = ot_gfile_get_path_cached (parent);
|
parent_path = gs_file_get_path_cached (parent);
|
||||||
descendant_path = ot_gfile_get_path_cached (descendant);
|
descendant_path = gs_file_get_path_cached (descendant);
|
||||||
remainder = match_prefix (descendant_path, parent_path);
|
remainder = match_prefix (descendant_path, parent_path);
|
||||||
|
|
||||||
if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder))
|
if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder))
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ ostree_repo_set_property(GObject *object,
|
||||||
{
|
{
|
||||||
case PROP_PATH:
|
case PROP_PATH:
|
||||||
/* Canonicalize */
|
/* 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;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
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))
|
if (!ot_gfile_load_contents_utf8 (child, &ret_rev, NULL, NULL, &temp_error))
|
||||||
{
|
{
|
||||||
g_propagate_error (error, 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;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -614,11 +614,11 @@ ostree_repo_check (OstreeRepo *self, GError **error)
|
||||||
if (self->inited)
|
if (self->inited)
|
||||||
return TRUE;
|
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,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"Couldn't find objects directory '%s'",
|
"Couldn't find objects directory '%s'",
|
||||||
ot_gfile_get_path_cached (self->objects_dir));
|
gs_file_get_path_cached (self->objects_dir));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -626,7 +626,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
self->config = g_key_file_new ();
|
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: ");
|
g_prefix_error (error, "Couldn't parse config file: ");
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -672,7 +672,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
|
||||||
if (!ostree_repo_check (self->parent_repo, error))
|
if (!ostree_repo_check (self->parent_repo, error))
|
||||||
{
|
{
|
||||||
g_prefix_error (error, "While checking parent repository '%s': ",
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -756,7 +756,7 @@ ensure_file_data_synced (GFile *file,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
int fd = -1;
|
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;
|
goto out;
|
||||||
|
|
||||||
if (!ot_unix_fdatasync (fd, error))
|
if (!ot_unix_fdatasync (fd, error))
|
||||||
|
|
@ -794,13 +794,13 @@ commit_loose_object_impl (OstreeRepo *self,
|
||||||
goto out;
|
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)
|
if (errno != EEXIST)
|
||||||
{
|
{
|
||||||
ot_util_set_error_from_errno (error, errno);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
g_prefix_error (error, "Storing file '%s': ",
|
g_prefix_error (error, "Storing file '%s': ",
|
||||||
ot_gfile_get_path_cached (dest));
|
gs_file_get_path_cached (dest));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -979,7 +979,7 @@ stage_object (OstreeRepo *self,
|
||||||
*/
|
*/
|
||||||
target_mode |= (S_IRUSR | S_IRGRP | S_IROTH);
|
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);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -1087,9 +1087,9 @@ stage_object (OstreeRepo *self,
|
||||||
ot_transfer_out_value(out_csum, &ret_csum);
|
ot_transfer_out_value(out_csum, &ret_csum);
|
||||||
out:
|
out:
|
||||||
if (temp_file)
|
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)
|
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);
|
g_clear_pointer (&checksum, (GDestroyNotify) g_checksum_free);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -1221,7 +1221,7 @@ scan_loose_devino (OstreeRepo *self,
|
||||||
if (!enumerator)
|
if (!enumerator)
|
||||||
goto out;
|
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)
|
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 ();
|
a = archive_read_new ();
|
||||||
archive_read_support_compression_all (a);
|
archive_read_support_compression_all (a);
|
||||||
archive_read_support_format_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);
|
propagate_libarchive_error (error, a);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -2662,7 +2662,7 @@ list_loose_object_dir (OstreeRepo *self,
|
||||||
ot_lobj GFileInfo *file_info = NULL;
|
ot_lobj GFileInfo *file_info = NULL;
|
||||||
GString *checksum = NULL;
|
GString *checksum = NULL;
|
||||||
|
|
||||||
dirname = ot_gfile_get_basename_cached (dir);
|
dirname = gs_file_get_basename_cached (dir);
|
||||||
|
|
||||||
/* We're only querying name */
|
/* We're only querying name */
|
||||||
enumerator = g_file_enumerate_children (dir, "standard::name,standard::type",
|
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);
|
ret_input = (GInputStream*) gs_file_read_noatime (loose_path, cancellable, error);
|
||||||
if (!ret_input)
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2896,7 +2896,7 @@ repo_find_object (OstreeRepo *self,
|
||||||
|
|
||||||
object_path = ostree_repo_get_object_path (self, checksum, objtype);
|
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;
|
ret_stored_path = object_path;
|
||||||
object_path = NULL; /* Transfer ownership */
|
object_path = NULL; /* Transfer ownership */
|
||||||
|
|
@ -3163,7 +3163,7 @@ checkout_file_from_input (GFile *file,
|
||||||
goto out;
|
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);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -3204,10 +3204,10 @@ checkout_file_hardlink (OstreeRepo *self,
|
||||||
ot_lobj GFile *dir = NULL;
|
ot_lobj GFile *dir = NULL;
|
||||||
|
|
||||||
if (dirfd != -1 &&
|
if (dirfd != -1 &&
|
||||||
linkat (-1, ot_gfile_get_path_cached (source),
|
linkat (-1, gs_file_get_path_cached (source),
|
||||||
dirfd, ot_gfile_get_basename_cached (destination), 0) != -1)
|
dirfd, gs_file_get_basename_cached (destination), 0) != -1)
|
||||||
ret_was_supported = TRUE;
|
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;
|
ret_was_supported = TRUE;
|
||||||
else if (errno == EMLINK || errno == EXDEV || errno == EPERM)
|
else if (errno == EMLINK || errno == EXDEV || errno == EPERM)
|
||||||
{
|
{
|
||||||
|
|
@ -3226,8 +3226,8 @@ checkout_file_hardlink (OstreeRepo *self,
|
||||||
*
|
*
|
||||||
* So we can't make this atomic.
|
* So we can't make this atomic.
|
||||||
*/
|
*/
|
||||||
(void) unlink (ot_gfile_get_path_cached (destination));
|
(void) unlink (gs_file_get_path_cached (destination));
|
||||||
if (link (ot_gfile_get_path_cached (source), ot_gfile_get_path_cached (destination)) < 0)
|
if (link (gs_file_get_path_cached (source), gs_file_get_path_cached (destination)) < 0)
|
||||||
{
|
{
|
||||||
ot_util_set_error_from_errno (error, errno);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -3284,7 +3284,7 @@ find_loose_for_checkout (OstreeRepo *self,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lstat (ot_gfile_get_path_cached (path), &stbuf) < 0)
|
if (lstat (gs_file_get_path_cached (path), &stbuf) < 0)
|
||||||
{
|
{
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
{
|
{
|
||||||
|
|
@ -3403,7 +3403,7 @@ checkout_file_thread (GSimpleAsyncResult *result,
|
||||||
if (!ot_gfile_ensure_directory (objdir, TRUE, error))
|
if (!ot_gfile_ensure_directory (objdir, TRUE, error))
|
||||||
{
|
{
|
||||||
g_prefix_error (error, "Creating cache directory %s: ",
|
g_prefix_error (error, "Creating cache directory %s: ",
|
||||||
ot_gfile_get_path_cached (objdir));
|
gs_file_get_path_cached (objdir));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3455,7 +3455,7 @@ checkout_file_thread (GSimpleAsyncResult *result,
|
||||||
&hardlink_supported, cancellable, error))
|
&hardlink_supported, cancellable, error))
|
||||||
{
|
{
|
||||||
g_prefix_error (error, "Hardlinking loose object %s to %s: ", checksum,
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3474,7 +3474,7 @@ checkout_file_thread (GSimpleAsyncResult *result,
|
||||||
input, cancellable, error))
|
input, cancellable, error))
|
||||||
{
|
{
|
||||||
g_prefix_error (error, "Copying object %s to %s: ", checksum,
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3797,7 +3797,7 @@ ostree_repo_checkout_tree_async (OstreeRepo *self,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
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)
|
if (!checkout_data->dir_handle)
|
||||||
{
|
{
|
||||||
ot_util_set_error_from_errno (error, errno);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
|
|
@ -3887,7 +3887,7 @@ ostree_repo_checkout_gc (OstreeRepo *self,
|
||||||
{
|
{
|
||||||
ot_lobj GFile *objpath = NULL;
|
ot_lobj GFile *objpath = NULL;
|
||||||
objpath = ot_gfile_get_child_build_path (objdir, g_file_info_get_name (file_info), 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;
|
goto out;
|
||||||
}
|
}
|
||||||
g_object_unref (file_info);
|
g_object_unref (file_info);
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ ostree_run_triggers_in_root (GFile *root,
|
||||||
g_ptr_array_add (argv, "--mount-bind");
|
g_ptr_array_add (argv, "--mount-bind");
|
||||||
g_ptr_array_add (argv, "/dev");
|
g_ptr_array_add (argv, "/dev");
|
||||||
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, "ostree-run-triggers");
|
||||||
g_ptr_array_add (argv, NULL);
|
g_ptr_array_add (argv, NULL);
|
||||||
|
|
|
||||||
|
|
@ -172,65 +172,6 @@ ot_gfile_get_child_build_path (GFile *parent,
|
||||||
return g_file_resolve_relative_path (parent, path);
|
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
|
gboolean
|
||||||
ot_gfile_load_contents_utf8 (GFile *file,
|
ot_gfile_load_contents_utf8 (GFile *file,
|
||||||
char **out_contents,
|
char **out_contents,
|
||||||
|
|
@ -261,35 +202,6 @@ ot_gfile_load_contents_utf8 (GFile *file,
|
||||||
return ret;
|
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
|
gboolean
|
||||||
ot_gio_write_update_checksum (GOutputStream *out,
|
ot_gio_write_update_checksum (GOutputStream *out,
|
||||||
gconstpointer data,
|
gconstpointer data,
|
||||||
|
|
@ -474,7 +386,7 @@ cp_internal (GFile *src,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
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)
|
g_file_info_get_attribute_uint32 (file_info, "unix::mode")) == -1)
|
||||||
{
|
{
|
||||||
ot_util_set_error_from_errno (error, errno);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
|
|
@ -487,10 +399,10 @@ cp_internal (GFile *src,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gboolean did_link = FALSE;
|
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 (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))
|
if (!(errno == EMLINK || errno == EXDEV))
|
||||||
{
|
{
|
||||||
|
|
@ -611,7 +523,7 @@ ot_gio_shutil_rm_rf (GFile *path,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!ot_gfile_unlink (subpath, cancellable, error))
|
if (!gs_file_unlink (subpath, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
g_clear_object (&file_info);
|
g_clear_object (&file_info);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
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_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,
|
gboolean ot_gfile_load_contents_utf8 (GFile *file,
|
||||||
char **contents_out,
|
char **contents_out,
|
||||||
char **etag_out,
|
char **etag_out,
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ ot_util_variant_map (GFile *src,
|
||||||
GMappedFile *mfile = NULL;
|
GMappedFile *mfile = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
path = ot_gfile_get_path_cached (src);
|
path = gs_file_get_path_cached (src);
|
||||||
if (!ot_unix_open_noatime (path, &fd, error))
|
if (!ot_unix_open_noatime (path, &fd, error))
|
||||||
goto out;
|
goto out;
|
||||||
mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
|
mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ fetch_uri_contents_utf8 (OtPullData *pull_data,
|
||||||
ot_transfer_out_value (out_contents, &ret_contents);
|
ot_transfer_out_value (out_contents, &ret_contents);
|
||||||
out:
|
out:
|
||||||
if (tmpf)
|
if (tmpf)
|
||||||
(void) unlink (ot_gfile_get_path_cached (tmpf));
|
(void) unlink (gs_file_get_path_cached (tmpf));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,10 +512,10 @@ static void
|
||||||
destroy_fetch_one_content_item_data (OtFetchOneContentItemData *data)
|
destroy_fetch_one_content_item_data (OtFetchOneContentItemData *data)
|
||||||
{
|
{
|
||||||
if (data->meta_path)
|
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);
|
g_clear_object (&data->meta_path);
|
||||||
if (data->content_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_clear_object (&data->content_path);
|
||||||
g_free (data->checksum);
|
g_free (data->checksum);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
|
@ -749,7 +749,7 @@ on_metadata_staged (GObject *object,
|
||||||
g_variant_ref (fetch_data->object));
|
g_variant_ref (fetch_data->object));
|
||||||
ot_worker_queue_release (pull_data->metadata_objects_to_scan);
|
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_object_unref (fetch_data->temp_path);
|
||||||
g_variant_unref (fetch_data->object);
|
g_variant_unref (fetch_data->object);
|
||||||
g_free (fetch_data);
|
g_free (fetch_data);
|
||||||
|
|
|
||||||
|
|
@ -85,17 +85,17 @@ update_current (OtAdminDeploy *self,
|
||||||
|
|
||||||
if (g_file_equal (current_deployment, deploy_target))
|
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);
|
relative_current);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_previous_path = g_file_get_child (self->ostree_dir, "tmp-previous");
|
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);
|
relative_previous = g_file_get_relative_path (self->ostree_dir, current_deployment);
|
||||||
g_assert (relative_previous);
|
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);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -103,37 +103,37 @@ update_current (OtAdminDeploy *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_current_path = g_file_get_child (self->ostree_dir, "tmp-current");
|
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);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_current_etc_path = g_file_get_child (self->ostree_dir, "tmp-current-etc");
|
tmp_current_etc_path = g_file_get_child (self->ostree_dir, "tmp-current-etc");
|
||||||
(void) ot_gfile_unlink (tmp_current_etc_path, NULL, NULL);
|
(void) gs_file_unlink (tmp_current_etc_path, NULL, NULL);
|
||||||
if (symlink (relative_current_etc, ot_gfile_get_path_cached (tmp_current_etc_path)) < 0)
|
if (symlink (relative_current_etc, gs_file_get_path_cached (tmp_current_etc_path)) < 0)
|
||||||
{
|
{
|
||||||
ot_util_set_error_from_errno (error, errno);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ot_gfile_rename (tmp_current_path, current_path,
|
if (!gs_file_rename (tmp_current_path, current_path,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
if (!ot_gfile_rename (tmp_current_etc_path, current_etc_path,
|
if (!gs_file_rename (tmp_current_etc_path, current_etc_path,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (tmp_previous_path)
|
if (tmp_previous_path)
|
||||||
{
|
{
|
||||||
if (!ot_gfile_rename (tmp_previous_path, previous_path,
|
if (!gs_file_rename (tmp_previous_path, previous_path,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
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);
|
relative_current);
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
@ -173,7 +173,7 @@ on_checkout_complete (GObject *object,
|
||||||
/**
|
/**
|
||||||
* ensure_unlinked:
|
* 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.
|
* exist.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
@ -184,7 +184,7 @@ ensure_unlinked (GFile *path,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GError *temp_error = NULL;
|
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))
|
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_lfree char *etc_name;
|
||||||
ot_lobj GFile *parent;
|
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);
|
parent = g_file_get_parent (previous_deployment);
|
||||||
|
|
||||||
previous_deployment_etc = g_file_get_child (parent, etc_name);
|
previous_deployment_etc = g_file_get_child (parent, etc_name);
|
||||||
|
|
@ -460,7 +460,7 @@ deploy_tree (OtAdminDeploy *self,
|
||||||
ProcessOneCheckoutData checkout_data;
|
ProcessOneCheckoutData checkout_data;
|
||||||
|
|
||||||
g_print ("ostadmin: Creating deployment %s\n",
|
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));
|
memset (&checkout_data, 0, sizeof (checkout_data));
|
||||||
checkout_data.loop = g_main_loop_new (NULL, TRUE);
|
checkout_data.loop = g_main_loop_new (NULL, TRUE);
|
||||||
|
|
@ -489,7 +489,7 @@ deploy_tree (OtAdminDeploy *self,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
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)
|
if (previous_deployment_etc)
|
||||||
{
|
{
|
||||||
|
|
@ -501,7 +501,7 @@ deploy_tree (OtAdminDeploy *self,
|
||||||
else
|
else
|
||||||
g_print ("ostadmin: No previous deployment; therefore, no configuration changes to merge\n");
|
g_print ("ostadmin: No previous deployment; therefore, no configuration changes to merge\n");
|
||||||
|
|
||||||
if (!ot_gfile_rename (deploy_target_path_tmp, deploy_target_path,
|
if (!gs_file_rename (deploy_target_path_tmp, deploy_target_path,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -545,14 +545,14 @@ do_update_kernel (OtAdminDeploy *self,
|
||||||
|
|
||||||
args = g_ptr_array_new ();
|
args = g_ptr_array_new ();
|
||||||
ot_ptrarray_add_many (args, "ostree", "admin",
|
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",
|
"update-kernel",
|
||||||
ot_gfile_get_path_cached (deploy_path), NULL);
|
gs_file_get_path_cached (deploy_path), NULL);
|
||||||
if (opt_no_kernel)
|
if (opt_no_kernel)
|
||||||
g_ptr_array_add (args, "--modules-only");
|
g_ptr_array_add (args, "--modules-only");
|
||||||
g_ptr_array_add (args, NULL);
|
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,
|
(char**)args->pdata, NULL, G_SPAWN_SEARCH_PATH,
|
||||||
NULL, NULL, NULL, NULL, error))
|
NULL, NULL, NULL, NULL, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ ot_admin_builtin_diff (int argc, char **argv, GFile *ostree_dir, GError **error)
|
||||||
if (!g_file_query_exists (deployment, NULL))
|
if (!g_file_query_exists (deployment, NULL))
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
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;
|
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");
|
orig_etc_path = g_file_resolve_relative_path (deployment, "etc");
|
||||||
deploy_parent = g_file_get_parent (deployment);
|
deploy_parent = g_file_get_parent (deployment);
|
||||||
new_etc_path = ot_gfile_get_child_strconcat (deploy_parent,
|
new_etc_path = ot_gfile_get_child_strconcat (deploy_parent,
|
||||||
ot_gfile_get_basename_cached (deployment),
|
gs_file_get_basename_cached (deployment),
|
||||||
"-etc", NULL);
|
"-etc", NULL);
|
||||||
|
|
||||||
modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref);
|
modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref);
|
||||||
|
|
|
||||||
|
|
@ -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))
|
if (!ot_admin_ensure_initialized (ostree_dir, cancellable, error))
|
||||||
goto out;
|
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;
|
ret = TRUE;
|
||||||
out:
|
out:
|
||||||
|
|
|
||||||
|
|
@ -139,10 +139,10 @@ ot_admin_builtin_prune (int argc, char **argv, GFile *ostree_dir, GError **error
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
parent = g_file_get_parent (deployment);
|
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);
|
"-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))
|
if (!ot_gio_shutil_rm_rf (deployment, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
/* Note - not atomic; we may be leaving the -etc directory around
|
/* 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_lptrarray GPtrArray *prune_argv = NULL;
|
||||||
ot_lfree char *repo_arg = 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 ();
|
prune_argv = g_ptr_array_new ();
|
||||||
ot_ptrarray_add_many (prune_argv, "ostree", repo_arg, "prune", "--refs-only", "--depth=0", NULL);
|
ot_ptrarray_add_many (prune_argv, "ostree", repo_arg, "prune", "--refs-only", "--depth=0", NULL);
|
||||||
g_ptr_array_add (prune_argv, 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,
|
(char**)prune_argv->pdata, NULL, G_SPAWN_SEARCH_PATH,
|
||||||
NULL, NULL, NULL, NULL, error))
|
NULL, NULL, NULL, NULL, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -147,12 +147,12 @@ ot_admin_builtin_pull_deploy (int argc, char **argv, GFile *ostree_dir, GError *
|
||||||
subproc_args = g_ptr_array_new ();
|
subproc_args = g_ptr_array_new ();
|
||||||
{
|
{
|
||||||
ot_lfree char *repo_arg = g_strconcat ("--repo=",
|
ot_lfree char *repo_arg = g_strconcat ("--repo=",
|
||||||
ot_gfile_get_path_cached (repo_path),
|
gs_file_get_path_cached (repo_path),
|
||||||
NULL);
|
NULL);
|
||||||
ot_ptrarray_add_many (subproc_args, "ostree", "pull", repo_arg, remote_name, NULL);
|
ot_ptrarray_add_many (subproc_args, "ostree", "pull", repo_arg, remote_name, NULL);
|
||||||
g_ptr_array_add (subproc_args, 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,
|
(char**)subproc_args->pdata, NULL, G_SPAWN_SEARCH_PATH,
|
||||||
NULL, NULL, NULL, NULL, error))
|
NULL, NULL, NULL, NULL, error))
|
||||||
goto out;
|
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 ();
|
subproc_args = g_ptr_array_new ();
|
||||||
{
|
{
|
||||||
ot_lfree char *opt_ostree_dir_arg = g_strconcat ("--ostree-dir=",
|
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);
|
NULL);
|
||||||
ot_ptrarray_add_many (subproc_args, "ostree", "admin", opt_ostree_dir_arg, "deploy",
|
ot_ptrarray_add_many (subproc_args, "ostree", "admin", opt_ostree_dir_arg, "deploy",
|
||||||
deploy_name, NULL);
|
deploy_name, NULL);
|
||||||
g_ptr_array_add (subproc_args, 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,
|
(char**)subproc_args->pdata, NULL, G_SPAWN_SEARCH_PATH,
|
||||||
NULL, NULL, NULL, NULL, error))
|
NULL, NULL, NULL, NULL, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,9 @@ update_initramfs (OtAdminUpdateKernel *self,
|
||||||
"--mount-readonly", "/",
|
"--mount-readonly", "/",
|
||||||
"--mount-proc", "/proc",
|
"--mount-proc", "/proc",
|
||||||
"--mount-bind", "/dev", "/dev",
|
"--mount-bind", "/dev", "/dev",
|
||||||
"--mount-bind", ot_gfile_get_path_cached (ostree_vardir), "/var",
|
"--mount-bind", gs_file_get_path_cached (ostree_vardir), "/var",
|
||||||
"--mount-bind", ot_gfile_get_path_cached (tmpdir), "/tmp",
|
"--mount-bind", gs_file_get_path_cached (tmpdir), "/tmp",
|
||||||
"--mount-bind", ot_gfile_get_path_cached (ostree_moduledir), "/lib/modules",
|
"--mount-bind", gs_file_get_path_cached (ostree_moduledir), "/lib/modules",
|
||||||
deploy_path,
|
deploy_path,
|
||||||
"dracut", "-f", "/tmp/initramfs-ostree.img", release,
|
"dracut", "-f", "/tmp/initramfs-ostree.img", release,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -151,10 +151,10 @@ update_initramfs (OtAdminUpdateKernel *self,
|
||||||
if (!g_file_copy (initramfs_tmp_file, initramfs_file, 0, cancellable, NULL, NULL, error))
|
if (!g_file_copy (initramfs_tmp_file, initramfs_file, 0, cancellable, NULL, NULL, error))
|
||||||
goto out;
|
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) gs_file_unlink (initramfs_tmp_file, NULL, NULL);
|
||||||
(void) rmdir (ot_gfile_get_path_cached (tmpdir));
|
(void) rmdir (gs_file_get_path_cached (tmpdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
@ -259,7 +259,7 @@ update_grub (OtAdminUpdateKernel *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
grubby_args = g_ptr_array_new ();
|
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);
|
initramfs_arg = g_strconcat ("--initrd=", "/boot/initramfs-ostree-", release, ".img", NULL);
|
||||||
ot_ptrarray_add_many (grubby_args, "grubby", "--grub", add_kernel_arg, initramfs_arg,
|
ot_ptrarray_add_many (grubby_args, "grubby", "--grub", add_kernel_arg, initramfs_arg,
|
||||||
"--copy-default", "--title=OSTree", NULL);
|
"--copy-default", "--title=OSTree", NULL);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ ot_admin_ensure_initialized (GFile *ostree_dir,
|
||||||
if (!g_file_query_exists (dir, NULL))
|
if (!g_file_query_exists (dir, NULL))
|
||||||
{
|
{
|
||||||
ot_lfree char *opt_repo_arg = g_strdup_printf ("--repo=%s/repo",
|
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 };
|
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,
|
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);
|
dir = ot_gfile_get_child_build_path (ostree_dir, "var", "tmp", NULL);
|
||||||
if (!ot_gfile_ensure_directory (dir, TRUE, error))
|
if (!ot_gfile_ensure_directory (dir, TRUE, error))
|
||||||
goto out;
|
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);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -90,9 +90,9 @@ ot_admin_ensure_initialized (GFile *ostree_dir,
|
||||||
|
|
||||||
g_clear_object (&dir);
|
g_clear_object (&dir);
|
||||||
dir = ot_gfile_get_child_build_path (ostree_dir, "var", "run", NULL);
|
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);
|
ot_util_set_error_from_errno (error, errno);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ print_one_file_text (GFile *f,
|
||||||
g_variant_unref (xattrs);
|
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)
|
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"));
|
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))
|
if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile*)f, NULL))
|
||||||
g_assert_not_reached ();
|
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 (path, 1, strlen (path), stdout);
|
||||||
fwrite ("\0", 1, 1, stdout);
|
fwrite ("\0", 1, 1, stdout);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ maybe_prune_loose_object (OtPruneData *data,
|
||||||
cancellable, error)) == NULL)
|
cancellable, error)) == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!ot_gfile_unlink (objf, cancellable, error))
|
if (!gs_file_unlink (objf, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
data->freed_bytes += g_file_info_get_size (info);
|
data->freed_bytes += g_file_info_get_size (info);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue