deploy: Remove legacy "current" symbolic links
Per comment, this was a temporary non-atomic hack, and it's time to remove it. https://bugzilla.gnome.org/show_bug.cgi?id=731051
This commit is contained in:
parent
12e3ed83d3
commit
dfeb27eca5
|
|
@ -1390,15 +1390,15 @@ deployment_bootconfigs_equal (OstreeDeployment *a,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TEMPORARY HACK: Add a "current" symbolic link that's easy to
|
/* This used to be a temporary hack to create "current" symbolic link
|
||||||
* follow inside the gnome-ostree build scripts. This isn't atomic,
|
* that's easy to follow inside the gnome-ostree build scripts (now
|
||||||
* but that doesn't matter because it's only used by deployments
|
* gnome-continuous). It wasn't atomic, and nowadays people can use
|
||||||
* done from the host.
|
* the OSTree API to find deployments.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
create_current_symlinks (OstreeSysroot *self,
|
cleanup_legacy_current_symlinks (OstreeSysroot *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
@ -1409,22 +1409,11 @@ create_current_symlinks (OstreeSysroot *self,
|
||||||
{
|
{
|
||||||
OstreeDeployment *deployment = self->deployments->pdata[i];
|
OstreeDeployment *deployment = self->deployments->pdata[i];
|
||||||
const char *osname = ostree_deployment_get_osname (deployment);
|
const char *osname = ostree_deployment_get_osname (deployment);
|
||||||
|
gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (self->path, "ostree/deploy/%s", osname);
|
||||||
|
gs_unref_object GFile *legacy_link = g_file_get_child (osdir, "current");
|
||||||
|
|
||||||
if (!g_hash_table_lookup (created_current_for_osname, osname))
|
if (!ot_gfile_ensure_unlinked (legacy_link, cancellable, error))
|
||||||
{
|
goto out;
|
||||||
gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (self->path, "ostree/deploy/%s", osname);
|
|
||||||
gs_unref_object GFile *os_current_path = g_file_get_child (osdir, "current");
|
|
||||||
gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (self, deployment);
|
|
||||||
gs_free char *target = g_file_get_relative_path (osdir, deployment_path);
|
|
||||||
|
|
||||||
g_assert (target != NULL);
|
|
||||||
|
|
||||||
if (!ot_gfile_atomic_symlink_swap (os_current_path, target,
|
|
||||||
cancellable, error))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
g_hash_table_insert (created_current_for_osname, (char*)osname, GUINT_TO_POINTER (1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
@ -1590,7 +1579,7 @@ ostree_sysroot_write_deployments (OstreeSysroot *self,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!create_current_symlinks (self, cancellable, error))
|
if (!cleanup_legacy_current_symlinks (self, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* And finally, cleanup of any leftover data.
|
/* And finally, cleanup of any leftover data.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue