compose: Pass treefile directly to core

A lot of history here.  Long before the YAML treefiles, I was
dissatisfied with the JSON treefile syntax, and also wanted
to create a format that could be used by the (still experimental)
`container` builtin, and chose to use GKeyFile.

I don't think that really worked out; the Rust YAML is just way
better.

In the future we probably want to more cleanly split off the
"compose only" aspects of the treefile.  But for now, it's rather
tedious to pass down flags from the treefile into the keyfile/gvariant.
Let's just give direct access to the treefile to the core.

Prep for sysusers.

Closes: #1764
Approved by: jlebon
This commit is contained in:
Colin Walters 2019-02-25 01:02:59 +00:00 committed by Atomic Bot
parent d1eedbbd96
commit 07d621bac9
4 changed files with 18 additions and 0 deletions

View File

@ -249,6 +249,9 @@ rpmostree_composeutil_get_treespec (RpmOstreeContext *ctx,
g_autoptr(GHashTable) varsubsts = rpmostree_dnfcontext_get_varsubsts (rpmostree_context_get_dnf (ctx));
g_autoptr(GKeyFile) treespec = g_key_file_new ();
// TODO: Rework things so we always use this data going forward
rpmostree_context_set_treefile (ctx, treefile_rs);
if (!treespec_bind_array (treedata, treespec, "packages", NULL, TRUE, error))
return FALSE;
if (!treespec_bind_array (treedata, treespec, "repos", NULL, TRUE, error))

View File

@ -30,6 +30,7 @@ struct _RpmOstreeContext {
/* Whether we were created with new_system() */
gboolean is_system;
RpmOstreeTreespec *spec;
RORTreefile *treefile_rs; /* For composes for now */
gboolean empty;
/* rojig-mode data */

View File

@ -520,6 +520,17 @@ rpmostree_context_configure_from_deployment (RpmOstreeContext *self,
self->passwd_dir = g_build_filename (cfg_deployment_root, "etc", NULL);
}
/* By default, we use a "treespec" however, reflecting everything from
* treefile -> treespec is annoying. Long term we want to unify those. This
* is a temporary escape hatch.
*/
void
rpmostree_context_set_treefile (RpmOstreeContext *self, RORTreefile *treefile_rs)
{
self->treefile_rs = treefile_rs;
}
/* Use this if no packages will be installed, and we just want a "dummy" run.
*/
void

View File

@ -24,6 +24,7 @@
#include <libdnf/libdnf.h>
#include <ostree.h>
#include "rpmostree-rust.h"
#include "libglnx.h"
#define RPMOSTREE_CORE_CACHEDIR "/var/cache/rpm-ostree/"
@ -114,6 +115,8 @@ rpmostree_context_configure_from_deployment (RpmOstreeContext *self,
OstreeSysroot *sysroot,
OstreeDeployment *cfg_deployment);
void rpmostree_context_set_treefile (RpmOstreeContext *self, RORTreefile *treefile_rs);
void rpmostree_context_set_is_empty (RpmOstreeContext *self);
void rpmostree_context_set_repos (RpmOstreeContext *self,