Skip to content

Commit

Permalink
compose: Have first-one-wins semantics for rojig parsing
Browse files Browse the repository at this point in the history
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 coreos#1574
  • Loading branch information
cgwalters committed Sep 24, 2018
1 parent 65bdc08 commit 9f56b6e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/app/rpmostree-compose-builtin-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 9f56b6e

Please sign in to comment.