[ostree] sysroot: Add ostree_sysroot_write_origin_file() API
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] sysroot: Add ostree_sysroot_write_origin_file() API
- Date: Mon, 19 Jan 2015 18:55:43 +0000 (UTC)
commit 886913abdc649bbf340ce8c890a517a2c9bbb6f6
Author: Colin Walters <walters verbum org>
Date: Fri Jan 16 13:04:29 2015 -0500
sysroot: Add ostree_sysroot_write_origin_file() API
We want to allow admins to change the origin file without doing a new
deployment, so this will be part of a future "admin set-origin"
command.
src/libostree/ostree-sysroot-deploy.c | 29 ++++++++++++++++++++++-------
src/libostree/ostree-sysroot.h | 6 ++++++
2 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index d5c6811..b328932 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -949,14 +949,28 @@ merge_configuration (OstreeSysroot *sysroot,
return ret;
}
-static gboolean
-write_origin_file (OstreeSysroot *sysroot,
- OstreeDeployment *deployment,
- GCancellable *cancellable,
- GError **error)
+/**
+ * ostree_sysroot_write_origin_file:
+ * @sysroot: System root
+ * @deployment: Deployment
+ * @new_origin: (allow-none): Origin content
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Immediately replace the origin file of the referenced @deployment
+ * with the contents of @new_origin. If @new_origin is %NULL,
+ * this function will write the current origin of @deployment.
+ */
+gboolean
+ostree_sysroot_write_origin_file (OstreeSysroot *sysroot,
+ OstreeDeployment *deployment,
+ GKeyFile *new_origin,
+ GCancellable *cancellable,
+ GError **error)
{
gboolean ret = FALSE;
- GKeyFile *origin = ostree_deployment_get_origin (deployment);
+ GKeyFile *origin =
+ new_origin ? new_origin : ostree_deployment_get_origin (deployment);
if (origin)
{
@@ -1879,7 +1893,8 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self,
goto out;
}
- if (!write_origin_file (self, new_deployment, cancellable, error))
+ if (!ostree_sysroot_write_origin_file (self, new_deployment, NULL,
+ cancellable, error))
{
g_prefix_error (error, "Writing out origin file: ");
goto out;
diff --git a/src/libostree/ostree-sysroot.h b/src/libostree/ostree-sysroot.h
index 7bfda2c..2044b92 100644
--- a/src/libostree/ostree-sysroot.h
+++ b/src/libostree/ostree-sysroot.h
@@ -61,6 +61,12 @@ gboolean ostree_sysroot_cleanup (OstreeSysroot *self,
GCancellable *cancellable,
GError **error);
+gboolean ostree_sysroot_write_origin_file (OstreeSysroot *sysroot,
+ OstreeDeployment *deployment,
+ GKeyFile *new_origin,
+ GCancellable *cancellable,
+ GError **error);
+
gboolean ostree_sysroot_get_repo (OstreeSysroot *self,
OstreeRepo **out_repo,
GCancellable *cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]