From 7b4134c8e6dc852d3a37fad7f47f33fce9c84bfd Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Tue, 4 Jul 2017 10:17:01 -0700 Subject: [PATCH] core: make cachebranch finder function public Prep for replacement overrides. Closes: #859 Approved by: cgwalters --- src/libpriv/rpmostree-core.c | 17 +++++++++-------- src/libpriv/rpmostree-core.h | 7 +++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/libpriv/rpmostree-core.c b/src/libpriv/rpmostree-core.c index 537aca10..86d9c872 100644 --- a/src/libpriv/rpmostree-core.c +++ b/src/libpriv/rpmostree-core.c @@ -793,12 +793,12 @@ checkout_pkg_metadata_by_dnfpkg (RpmOstreeContext *self, return checkout_pkg_metadata (self, nevra, header, cancellable, error); } -static gboolean -find_cache_branch_by_nevra (OstreeRepo *pkgcache, - const char *nevra, - char **out_cache_branch, - GCancellable *cancellable, - GError **error) +gboolean +rpmostree_find_cache_branch_by_nevra (OstreeRepo *pkgcache, + const char *nevra, + char **out_cache_branch, + GCancellable *cancellable, + GError **error) { /* there's no safe way to convert a nevra string to its cache branch, so let's @@ -832,7 +832,8 @@ rpmostree_pkgcache_find_pkg_header (OstreeRepo *pkgcache, GError **error) { g_autofree char *cache_branch = NULL; - if (!find_cache_branch_by_nevra (pkgcache, nevra, &cache_branch, cancellable, error)) + if (!rpmostree_find_cache_branch_by_nevra (pkgcache, nevra, &cache_branch, + cancellable, error)) return FALSE; if (expected_sha256 != NULL) @@ -888,7 +889,7 @@ rpmostree_get_nevra_from_pkgcache (OstreeRepo *repo, GError **error) { g_autofree char *ref = NULL; - if (!find_cache_branch_by_nevra (repo, nevra, &ref, cancellable, error)) + if (!rpmostree_find_cache_branch_by_nevra (repo, nevra, &ref, cancellable, error)) return FALSE; g_autofree char *rev = NULL; diff --git a/src/libpriv/rpmostree-core.h b/src/libpriv/rpmostree-core.h index 30f74c02..fafe1b04 100644 --- a/src/libpriv/rpmostree-core.h +++ b/src/libpriv/rpmostree-core.h @@ -81,6 +81,13 @@ char *rpmostree_context_get_state_sha512 (RpmOstreeContext *self); char *rpmostree_get_cache_branch_header (Header hdr); char *rpmostree_get_cache_branch_pkg (DnfPackage *pkg); +gboolean +rpmostree_find_cache_branch_by_nevra (OstreeRepo *pkgcache, + const char *nevra, + char **out_cache_branch, + GCancellable *cancellable, + GError **error); + gboolean rpmostree_pkgcache_find_pkg_header (OstreeRepo *pkgcache, const char *nevra,