libpriv/util: add function to get deployment root

Prep for auto-updates.

Closes: #1212
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-01-17 20:48:34 +00:00 committed by Atomic Bot
parent 688f28c072
commit 812daf3902
4 changed files with 18 additions and 10 deletions

View File

@ -1401,11 +1401,8 @@ refresh_md_transaction_execute (RpmostreedTransaction *transaction,
rpmostree_syscore_get_origin_merge_deployment (sysroot, self->osname);
/* but set the source root to be the origin merge deployment's so we pick up releasever */
const char *sysroot_path = gs_file_get_path_cached (ostree_sysroot_get_path (sysroot));
g_autofree char *origin_deployment_dirpath =
ostree_sysroot_get_deployment_dirpath (sysroot, origin_merge_deployment);
g_autofree char *origin_deployment_root =
g_build_filename (sysroot_path, origin_deployment_dirpath, NULL);
rpmostree_get_deployment_root (sysroot, origin_merge_deployment);
OstreeRepo *repo = ostree_sysroot_repo (sysroot);
g_autoptr(RpmOstreeContext) ctx = rpmostree_context_new_system (repo, cancellable, error);

View File

@ -485,13 +485,10 @@ rpmostree_context_configure_from_deployment (RpmOstreeContext *self,
OstreeSysroot *sysroot,
OstreeDeployment *cfg_deployment)
{
const char *sysroot_path = gs_file_get_path_cached (ostree_sysroot_get_path (sysroot));
g_autofree char *cfg_deployment_dirpath =
ostree_sysroot_get_deployment_dirpath (sysroot, cfg_deployment);
g_autofree char *cfg_deployment_root =
g_build_filename (sysroot_path, cfg_deployment_dirpath, NULL);
g_autofree char *reposdir = g_build_filename (cfg_deployment_root, "etc/yum.repos.d", NULL);
rpmostree_get_deployment_root (sysroot, cfg_deployment);
g_autofree char *reposdir =
g_build_filename (cfg_deployment_root, "etc/yum.repos.d", NULL);
/* point libhif to the yum.repos.d and os-release of the merge deployment */
dnf_context_set_repo_dir (self->dnfctx, reposdir);

View File

@ -636,6 +636,16 @@ rpmostree_migrate_pkgcache_repo (OstreeRepo *repo,
return TRUE;
}
char*
rpmostree_get_deployment_root (OstreeSysroot *sysroot,
OstreeDeployment *deployment)
{
const char *sysroot_path = gs_file_get_path_cached (ostree_sysroot_get_path (sysroot));
g_autofree char *deployment_dirpath =
ostree_sysroot_get_deployment_dirpath (sysroot, deployment);
return g_build_filename (sysroot_path, deployment_dirpath, NULL);
}
gboolean
rpmostree_decompose_sha256_nevra (const char **nevra, /* gets incremented */
char **out_sha256,

View File

@ -138,6 +138,10 @@ rpmostree_decompose_sha256_nevra (const char **nevra,
char **sha256,
GError **error);
char*
rpmostree_get_deployment_root (OstreeSysroot *sysroot,
OstreeDeployment *deployment);
char *
rpmostree_cache_branch_to_nevra (const char *cachebranch);