diff --git a/src/daemon/rpmostree-sysroot-core.c b/src/daemon/rpmostree-sysroot-core.c index c9a85b4a..6bdf15e1 100644 --- a/src/daemon/rpmostree-sysroot-core.c +++ b/src/daemon/rpmostree-sysroot-core.c @@ -142,6 +142,31 @@ add_package_refs_to_set (RpmOstreeRefSack *rsack, return TRUE; } +/* The pkgcache is in extensions/; see also + * https://github.com/projectatomic/rpm-ostree/pull/1055 + */ +gboolean +rpmostree_syscore_get_pkgcache_repo (OstreeRepo *parent, + OstreeRepo **out_pkgcache, + GCancellable *cancellable, + GError **error) +{ + if (!glnx_shutil_mkdir_p_at (ostree_repo_get_dfd (parent), + "extensions/rpmostree", 0755, + cancellable, error)) + return FALSE; + g_autoptr(OstreeRepo) pkgcache = + ostree_repo_create_at (ostree_repo_get_dfd (parent), + "extensions/rpmostree/pkgcache", + OSTREE_REPO_MODE_BARE, NULL, + cancellable, error); + if (!pkgcache) + return FALSE; + + *out_pkgcache = g_steal_pointer (&pkgcache); + return TRUE; +} + /* Loop over all deployments, gathering all referenced NEVRAs for * layered packages. Then delete any cached pkg refs that aren't in * that set. @@ -157,7 +182,7 @@ clean_pkgcache_orphans (OstreeSysroot *sysroot, g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); g_autoptr(OstreeRepo) pkgcache_repo = NULL; - if (!rpmostree_get_pkgcache_repo (repo, &pkgcache_repo, cancellable, error)) + if (!rpmostree_syscore_get_pkgcache_repo (repo, &pkgcache_repo, cancellable, error)) return FALSE; g_autoptr(GPtrArray) deployments = ostree_sysroot_get_deployments (sysroot); diff --git a/src/daemon/rpmostree-sysroot-core.h b/src/daemon/rpmostree-sysroot-core.h index 9c4ceb51..c136175f 100644 --- a/src/daemon/rpmostree-sysroot-core.h +++ b/src/daemon/rpmostree-sysroot-core.h @@ -41,7 +41,11 @@ OstreeDeployment *rpmostree_syscore_get_origin_merge_deployment (OstreeSysroot * gboolean rpmostree_syscore_bump_mtime (OstreeSysroot *self, GError **error); - +gboolean +rpmostree_syscore_get_pkgcache_repo (OstreeRepo *parent, + OstreeRepo **out_pkgcache, + GCancellable *cancellable, + GError **error); #define RPMOSTREE_LIVE_INPROGRESS_XATTR "user.rpmostree-live-inprogress" #define RPMOSTREE_LIVE_REPLACED_XATTR "user.rpmostree-live-replaced" diff --git a/src/daemon/rpmostree-sysroot-upgrader.c b/src/daemon/rpmostree-sysroot-upgrader.c index 42e289ac..70ad6bcf 100644 --- a/src/daemon/rpmostree-sysroot-upgrader.c +++ b/src/daemon/rpmostree-sysroot-upgrader.c @@ -614,7 +614,7 @@ finalize_replacement_overrides (RpmOstreeSysrootUpgrader *self, g_autoptr(GPtrArray) inactive_replacements = g_ptr_array_new (); g_autoptr(OstreeRepo) pkgcache_repo = NULL; - if (!rpmostree_get_pkgcache_repo (self->repo, &pkgcache_repo, cancellable, error)) + if (!rpmostree_syscore_get_pkgcache_repo (self->repo, &pkgcache_repo, cancellable, error)) return FALSE; GLNX_HASH_TABLE_FOREACH_KV (local_replacements, const char*, nevra, const char*, sha256) @@ -689,7 +689,7 @@ finalize_overlays (RpmOstreeSysrootUpgrader *self, return FALSE; g_autoptr(OstreeRepo) pkgcache_repo = NULL; - if (!rpmostree_get_pkgcache_repo (self->repo, &pkgcache_repo, cancellable, error)) + if (!rpmostree_syscore_get_pkgcache_repo (self->repo, &pkgcache_repo, cancellable, error)) return FALSE; GLNX_HASH_TABLE_FOREACH_KV (local_pkgs, const char*, nevra, const char*, sha256) @@ -823,7 +823,7 @@ prep_local_assembly (RpmOstreeSysrootUpgrader *self, return FALSE; g_autoptr(OstreeRepo) pkgcache_repo = NULL; - if (!rpmostree_get_pkgcache_repo (self->repo, &pkgcache_repo, cancellable, error)) + if (!rpmostree_syscore_get_pkgcache_repo (self->repo, &pkgcache_repo, cancellable, error)) return FALSE; rpmostree_context_set_repos (self->ctx, self->repo, pkgcache_repo); diff --git a/src/daemon/rpmostreed-transaction-types.c b/src/daemon/rpmostreed-transaction-types.c index e7fa2081..a53bc56f 100644 --- a/src/daemon/rpmostreed-transaction-types.c +++ b/src/daemon/rpmostreed-transaction-types.c @@ -482,7 +482,7 @@ import_local_rpm (OstreeRepo *parent, * need relabeling and that's OK. * */ - if (!rpmostree_get_pkgcache_repo (parent, &pkgcache_repo, cancellable, error)) + if (!rpmostree_syscore_get_pkgcache_repo (parent, &pkgcache_repo, cancellable, error)) return FALSE; /* let's just use the current sepolicy -- we'll just relabel it if the new diff --git a/src/libpriv/rpmostree-util.c b/src/libpriv/rpmostree-util.c index 117005fa..52fd4128 100644 --- a/src/libpriv/rpmostree-util.c +++ b/src/libpriv/rpmostree-util.c @@ -517,28 +517,6 @@ rpmostree_deployment_get_layered_info (OstreeRepo *repo, return TRUE; } -gboolean -rpmostree_get_pkgcache_repo (OstreeRepo *parent, - OstreeRepo **out_pkgcache, - GCancellable *cancellable, - GError **error) -{ - if (!glnx_shutil_mkdir_p_at (ostree_repo_get_dfd (parent), - "extensions/rpmostree", 0755, - cancellable, error)) - return FALSE; - g_autoptr(OstreeRepo) pkgcache = - ostree_repo_create_at (ostree_repo_get_dfd (parent), - "extensions/rpmostree/pkgcache", - OSTREE_REPO_MODE_BARE, NULL, - cancellable, error); - if (!pkgcache) - return FALSE; - - *out_pkgcache = g_steal_pointer (&pkgcache); - return TRUE; -} - gboolean rpmostree_decompose_sha256_nevra (const char **nevra, /* gets incremented */ char **out_sha256, diff --git a/src/libpriv/rpmostree-util.h b/src/libpriv/rpmostree-util.h index 1b8e8d26..a16d6b45 100644 --- a/src/libpriv/rpmostree-util.h +++ b/src/libpriv/rpmostree-util.h @@ -112,12 +112,6 @@ rpmostree_deployment_get_layered_info (OstreeRepo *repo, GVariant **out_replaced_base_pkgs, GError **error); -gboolean -rpmostree_get_pkgcache_repo (OstreeRepo *parent, - OstreeRepo **out_pkgcache, - GCancellable *cancellable, - GError **error); - gboolean rpmostree_decompose_sha256_nevra (const char **nevra, char **sha256,