[ostree/wip/anaconda: 3/6] libostree: Fix ostree_deployment_clone() to also clone bootconfig
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree/wip/anaconda: 3/6] libostree: Fix ostree_deployment_clone() to also clone bootconfig
- Date: Wed, 19 Mar 2014 13:50:24 +0000 (UTC)
commit 9fed088d6e4851da182d903c178eecb7b9362092
Author: Colin Walters <walters verbum org>
Date: Mon Mar 17 19:21:39 2014 -0400
libostree: Fix ostree_deployment_clone() to also clone bootconfig
This way one can easily mutate it for a new deployment list.
src/libostree/ostree-deployment.c | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/libostree/ostree-deployment.c b/src/libostree/ostree-deployment.c
index a555e05..4533715 100644
--- a/src/libostree/ostree-deployment.c
+++ b/src/libostree/ostree-deployment.c
@@ -138,11 +138,30 @@ ostree_deployment_set_origin (OstreeDeployment *self, GKeyFile *origin)
OstreeDeployment *
ostree_deployment_clone (OstreeDeployment *self)
{
+ gs_unref_object OstreeBootconfigParser *new_bootconfig = NULL;
+ GKeyFile *new_origin = NULL;
OstreeDeployment *ret = ostree_deployment_new (self->index, self->osname, self->csum,
- self->deployserial,
- self->bootcsum, self->bootserial);
- ostree_deployment_set_bootconfig (ret, self->bootconfig);
- ostree_deployment_set_origin (ret, self->origin);
+ self->deployserial,
+ self->bootcsum, self->bootserial);
+
+ new_bootconfig = ostree_bootconfig_parser_clone (self->bootconfig);
+ ostree_deployment_set_bootconfig (ret, new_bootconfig);
+
+ if (self->origin)
+ {
+ gs_free char *data = NULL;
+ gsize len;
+ gboolean success;
+
+ data = g_key_file_to_data (self->origin, &len, NULL);
+ g_assert (data);
+
+ new_origin = g_key_file_new ();
+ success = g_key_file_load_from_data (new_origin, data, len, 0, NULL);
+ g_assert (success);
+
+ ostree_deployment_set_origin (ret, new_origin);
+ }
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]