Use a dummy install root for unprivileged composes
Sadly, libhif keeps trying to auto-create it. It'll need patching there, and possibly in librpm.
This commit is contained in:
parent
f577279fac
commit
397fdd8d33
@ -110,21 +110,12 @@ roc_context_prepare_for_root (ROContainerContext *rocctx,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
/* We don't point the install root at the existing directory because
|
|
||||||
* libhif tries to inspect it, which is wrong. So basically make up
|
|
||||||
* a fake directory each time.
|
|
||||||
*/
|
|
||||||
g_autofree char *abs_instroot = glnx_fdrel_abspath (rocctx->roots_dfd, target);
|
|
||||||
const char *abs_instroot_tmp = glnx_strjoina (abs_instroot, ".ignore");
|
|
||||||
|
|
||||||
rocctx->ctx = rpmostree_context_new_unprivileged (rocctx->userroot_dfd, NULL, error);
|
rocctx->ctx = rpmostree_context_new_unprivileged (rocctx->userroot_dfd, NULL, error);
|
||||||
if (!rocctx->ctx)
|
if (!rocctx->ctx)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!rpmostree_context_setup (rocctx->ctx, abs_instroot_tmp, treespec, cancellable, error))
|
if (!rpmostree_context_setup (rocctx->ctx, NULL, treespec, cancellable, error))
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (!glnx_shutil_rm_rf_at (AT_FDCWD, abs_instroot_tmp, cancellable, error))
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
@ -48,6 +48,7 @@ struct _RpmOstreeContext {
|
|||||||
RpmOstreeTreespec *spec;
|
RpmOstreeTreespec *spec;
|
||||||
HifContext *hifctx;
|
HifContext *hifctx;
|
||||||
OstreeRepo *ostreerepo;
|
OstreeRepo *ostreerepo;
|
||||||
|
char *dummy_instroot_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (RpmOstreeContext, rpmostree_context, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (RpmOstreeContext, rpmostree_context, G_TYPE_OBJECT)
|
||||||
@ -82,6 +83,11 @@ rpmostree_context_finalize (GObject *object)
|
|||||||
RpmOstreeContext *rctx = RPMOSTREE_CONTEXT (object);
|
RpmOstreeContext *rctx = RPMOSTREE_CONTEXT (object);
|
||||||
|
|
||||||
g_clear_object (&rctx->hifctx);
|
g_clear_object (&rctx->hifctx);
|
||||||
|
if (rctx->dummy_instroot_path)
|
||||||
|
{
|
||||||
|
(void) glnx_shutil_rm_rf_at (AT_FDCWD, rctx->dummy_instroot_path, NULL, NULL);
|
||||||
|
g_free (rctx->dummy_instroot_path);
|
||||||
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (rpmostree_context_parent_class)->finalize (object);
|
G_OBJECT_CLASS (rpmostree_context_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -456,7 +462,17 @@ rpmostree_context_setup (RpmOstreeContext *self,
|
|||||||
char **enabled_repos = NULL;
|
char **enabled_repos = NULL;
|
||||||
char **instlangs = NULL;
|
char **instlangs = NULL;
|
||||||
|
|
||||||
hif_context_set_install_root (self->hifctx, installroot);
|
if (installroot)
|
||||||
|
hif_context_set_install_root (self->hifctx, installroot);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glnx_fd_close int dfd = -1; /* Auto close, we just use the path */
|
||||||
|
if (!rpmostree_mkdtemp ("/tmp/rpmostree-dummy-instroot-XXXXXX",
|
||||||
|
&self->dummy_instroot_path,
|
||||||
|
&dfd, error))
|
||||||
|
goto out;
|
||||||
|
hif_context_set_install_root (self->hifctx, self->dummy_instroot_path);
|
||||||
|
}
|
||||||
|
|
||||||
if (!hif_context_setup (self->hifctx, cancellable, error))
|
if (!hif_context_setup (self->hifctx, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
@ -1346,10 +1362,10 @@ rpmostree_context_assemble_commit (RpmOstreeContext *self,
|
|||||||
set_rpm_macro_define ("_dbpath", "/usr/share/rpm");
|
set_rpm_macro_define ("_dbpath", "/usr/share/rpm");
|
||||||
|
|
||||||
/* Don't verify checksums here (we should have done this on ostree
|
/* Don't verify checksums here (we should have done this on ostree
|
||||||
* import). Also, when we do run the transaction, only update the
|
* import). Also, avoid updating the database or anything by
|
||||||
* rpmdb. Otherwise we unpacked with cpio.
|
* flagging it as a test. We'll do the database next.
|
||||||
*/
|
*/
|
||||||
rpmtsSetVSFlags (ordering_ts, _RPMVSF_NOSIGNATURES | _RPMVSF_NODIGESTS | RPMTRANS_FLAG_JUSTDB);
|
rpmtsSetVSFlags (ordering_ts, _RPMVSF_NOSIGNATURES | _RPMVSF_NODIGESTS | RPMTRANS_FLAG_TEST);
|
||||||
|
|
||||||
/* Tell librpm about each one so it can tsort them. What we really
|
/* Tell librpm about each one so it can tsort them. What we really
|
||||||
* want is to do this from the rpm-md metadata so that we can fully
|
* want is to do this from the rpm-md metadata so that we can fully
|
||||||
|
Loading…
x
Reference in New Issue
Block a user