summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2014-05-31 13:53:10 -0400
committerColin Walters <walters@verbum.org>2014-09-13 10:44:29 -0400
commitdfeb27eca55d923c57735e491e438ae54f8cc201 (patch)
treef12ee5c61de38cc468d5da70c71de6a7844f93d3
parent12e3ed83d3ab7dc8077872f1319a4d7deb0ae81f (diff)
downloadostree-dfeb27eca55d923c57735e491e438ae54f8cc201.tar.gz
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
-rw-r--r--src/libostree/ostree-sysroot-deploy.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index 15eb9007..ca12a3a9 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -1390,15 +1390,15 @@ deployment_bootconfigs_equal (OstreeDeployment *a,
return TRUE;
}
-/* TEMPORARY HACK: Add a "current" symbolic link that's easy to
- * follow inside the gnome-ostree build scripts. This isn't atomic,
- * but that doesn't matter because it's only used by deployments
- * done from the host.
+/* This used to be a temporary hack to create "current" symbolic link
+ * that's easy to follow inside the gnome-ostree build scripts (now
+ * gnome-continuous). It wasn't atomic, and nowadays people can use
+ * the OSTree API to find deployments.
*/
static gboolean
-create_current_symlinks (OstreeSysroot *self,
- GCancellable *cancellable,
- GError **error)
+cleanup_legacy_current_symlinks (OstreeSysroot *self,
+ GCancellable *cancellable,
+ GError **error)
{
gboolean ret = FALSE;
guint i;
@@ -1409,22 +1409,11 @@ create_current_symlinks (OstreeSysroot *self,
{
OstreeDeployment *deployment = self->deployments->pdata[i];
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))
- {
- 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));
- }
+ if (!ot_gfile_ensure_unlinked (legacy_link, cancellable, error))
+ goto out;
}
ret = TRUE;
@@ -1590,7 +1579,7 @@ ostree_sysroot_write_deployments (OstreeSysroot *self,
goto out;
}
- if (!create_current_symlinks (self, cancellable, error))
+ if (!cleanup_legacy_current_symlinks (self, cancellable, error))
goto out;
/* And finally, cleanup of any leftover data.