Skip to content

Commit

Permalink
libpriv/core: allow NULL for treespec
Browse files Browse the repository at this point in the history
Let callers pass `NULL` for the `@spec` argument. This essentially means
that they're not interested in actually doing any installation/commit
operations, but just the semantics that the core uses when setting up
libdnf wrt e.g. install and source root and enabled repos = required,
etc...

Prep for `makecache`.
  • Loading branch information
jlebon committed Oct 5, 2017
1 parent 8713f1f commit 094f923
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/libpriv/rpmostree-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,14 @@ rpmostree_context_setup (RpmOstreeContext *self,
/* This exists (as a canonically empty dir) at least on RHEL7+ */
static const char emptydir_path[] = "/usr/share/empty";

self->spec = g_object_ref (spec);
/* allow NULL for treespec, but canonicalize to an empty keyfile for cleaner queries */
if (!spec)
{
g_autoptr(GKeyFile) kf = g_key_file_new ();
self->spec = rpmostree_treespec_new_from_keyfile (kf, NULL);
}
else
self->spec = g_object_ref (spec);

g_variant_dict_lookup (self->spec->dict, "releasever", "&s", &releasever);

Expand Down

0 comments on commit 094f923

Please sign in to comment.