Add rpmostree.clientlayer metadata to derived commits
In the future we may add more commands that take as input commit IDs. However, we really want to distinguish between server and client generated commits, as some of these operations won't make sense for derived commits. This changes the API to have callers say which type of commit they're generating, which also fixes a FIXME, and helps get us a bit closer to the "unified core". Closes: #520 Approved by: jlebon
This commit is contained in:
parent
78eba17c2e
commit
ae108e08a5
@ -322,7 +322,8 @@ rpmostree_container_builtin_assemble (int argc,
|
||||
goto out;
|
||||
|
||||
if (!rpmostree_context_assemble_commit (rocctx->ctx, tmprootfs_dfd, NULL,
|
||||
NULL, FALSE, &commit, cancellable, error))
|
||||
NULL, RPMOSTREE_ASSEMBLE_TYPE_SERVER_BASE,
|
||||
FALSE, &commit, cancellable, error))
|
||||
goto out;
|
||||
|
||||
glnx_shutil_rm_rf_at (rocctx->userroot_dfd, tmprootfs, cancellable, NULL);
|
||||
@ -534,7 +535,8 @@ rpmostree_container_builtin_upgrade (int argc, char **argv, GCancellable *cancel
|
||||
goto out;
|
||||
|
||||
if (!rpmostree_context_assemble_commit (rocctx->ctx, tmprootfs_dfd, NULL,
|
||||
NULL, TRUE, &new_commit_checksum,
|
||||
NULL, RPMOSTREE_ASSEMBLE_TYPE_SERVER_BASE,
|
||||
TRUE, &new_commit_checksum,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
@ -1064,6 +1064,7 @@ overlay_final_pkgset (RpmOstreeSysrootUpgrader *self,
|
||||
/* --- Overlay and commit --- */
|
||||
if (!rpmostree_context_assemble_commit (ctx, tmprootfs_dfd, devino_cache,
|
||||
base_rev,
|
||||
RPMOSTREE_ASSEMBLE_TYPE_CLIENT_LAYERING,
|
||||
(self->flags & RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGOVERLAY_NOSCRIPTS) > 0,
|
||||
&self->new_revision,
|
||||
cancellable, error))
|
||||
|
@ -1849,6 +1849,7 @@ rpmostree_context_assemble_commit (RpmOstreeContext *self,
|
||||
int tmprootfs_dfd,
|
||||
OstreeRepoDevInoCache *devino_cache,
|
||||
const char *parent,
|
||||
RpmOstreeAssembleType assemble_type,
|
||||
gboolean noscripts,
|
||||
char **out_commit,
|
||||
GCancellable *cancellable,
|
||||
@ -2188,13 +2189,14 @@ rpmostree_context_assemble_commit (RpmOstreeContext *self,
|
||||
|
||||
g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.spec", spec_v);
|
||||
|
||||
/* copy the version tag from the parent if present -- XXX: this behaviour
|
||||
* should probably be adjustable from a new parameter instead */
|
||||
if (parent != NULL)
|
||||
/* copy the version tag */
|
||||
if (assemble_type == RPMOSTREE_ASSEMBLE_TYPE_CLIENT_LAYERING)
|
||||
{
|
||||
g_autoptr(GVariant) commit = NULL;
|
||||
g_autofree char *parent_version = NULL;
|
||||
|
||||
g_assert (parent != NULL);
|
||||
|
||||
if (!ostree_repo_load_commit (self->ostreerepo, parent, &commit, NULL, error))
|
||||
goto out;
|
||||
|
||||
@ -2203,6 +2205,10 @@ rpmostree_context_assemble_commit (RpmOstreeContext *self,
|
||||
if (parent_version)
|
||||
g_variant_builder_add (&metadata_builder, "{sv}", "version",
|
||||
g_variant_new_string (parent_version));
|
||||
|
||||
/* Flag the commit as a client layer */
|
||||
g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.clientlayer",
|
||||
g_variant_new_boolean (TRUE));
|
||||
}
|
||||
|
||||
state_checksum = rpmostree_context_get_state_sha512 (self);
|
||||
|
@ -103,12 +103,18 @@ gboolean rpmostree_context_relabel (RpmOstreeContext *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
typedef enum {
|
||||
RPMOSTREE_ASSEMBLE_TYPE_SERVER_BASE,
|
||||
RPMOSTREE_ASSEMBLE_TYPE_CLIENT_LAYERING
|
||||
} RpmOstreeAssembleType;
|
||||
|
||||
/* NB: tmprootfs_dfd is allowed to have pre-existing data */
|
||||
/* devino_cache can be NULL if no previous cache established */
|
||||
gboolean rpmostree_context_assemble_commit (RpmOstreeContext *self,
|
||||
int tmprootfs_dfd,
|
||||
OstreeRepoDevInoCache *devino_cache,
|
||||
const char *parent,
|
||||
RpmOstreeAssembleType assemble_type,
|
||||
gboolean noscripts,
|
||||
char **out_commit,
|
||||
GCancellable *cancellable,
|
||||
|
Loading…
Reference in New Issue
Block a user