From 2e567840ca4dd1c5f28392b3f9c077bcdbaebd3f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 23 Sep 2018 18:37:37 +0000 Subject: [PATCH] compose: Have first-one-wins semantics for rojig parsing The core bug here is that previously if we had multiple YAML files in include, we ended up overwriting self->treefile_rs for the last one. Handling inheritance worked, but it broke rojig since we generate the specfile Rust side. Let's have first-one-wins semantics for now. I have a bigger fix incoming in https://github.com/projectatomic/rpm-ostree/pull/1574 Closes: #1576 Approved by: jlebon --- src/app/rpmostree-compose-builtin-tree.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/rpmostree-compose-builtin-tree.c b/src/app/rpmostree-compose-builtin-tree.c index 33b6845b..c2e2c0f9 100644 --- a/src/app/rpmostree-compose-builtin-tree.c +++ b/src/app/rpmostree-compose-builtin-tree.c @@ -519,19 +519,25 @@ parse_treefile_to_json (RpmOstreeTreeComposeContext *self, g_str_has_suffix (treefile_path, ".yml")) { const char *arch = self ? dnf_context_get_base_arch (rpmostree_context_get_dnf (self->corectx)) : NULL; - self->treefile_rs = ror_treefile_new (treefile_path, arch, - self->workdir_dfd, - error); - if (!self->treefile_rs) + g_autoptr(RORTreefile) tf = ror_treefile_new (treefile_path, arch, + self->workdir_dfd, + error); + if (!tf) return glnx_prefix_error (error, "Failed to load YAML treefile"); - glnx_fd_close int json_fd = ror_treefile_to_json (self->treefile_rs, error); + glnx_fd_close int json_fd = ror_treefile_to_json (tf, error); if (json_fd < 0) return FALSE; g_autoptr(GInputStream) json_s = g_unix_input_stream_new (json_fd, FALSE); if (!json_parser_load_from_stream (parser, json_s, NULL, error)) return FALSE; + + /* We have first-one-wins semantics for this until we move all of the + * parsing into Rust. + */ + if (!self->treefile_rs) + self->treefile_rs = g_steal_pointer (&tf); } else {