diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index 3b185ac0..b9b292c7 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -246,6 +246,7 @@ ostree_repo_remote_get_gpg_verify ostree_repo_remote_get_gpg_verify_summary ostree_repo_remote_gpg_import ostree_repo_remote_fetch_summary +ostree_repo_remote_fetch_summary_with_options ostree_repo_get_remote_boolean_option ostree_repo_get_remote_list_option ostree_repo_get_remote_option diff --git a/src/libostree/libostree.sym b/src/libostree/libostree.sym index 8c0d8389..2aa72512 100644 --- a/src/libostree/libostree.sym +++ b/src/libostree/libostree.sym @@ -337,3 +337,9 @@ global: * Versions above here are released. Only add symbols below this line. * NOTE NOTE NOTE */ + +LIBOSTREE_2016.6 { +global: + ostree_repo_remote_fetch_summary_with_options; + +} LIBOSTREE_2016.5; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 243b7ae6..42813e9c 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -1895,6 +1895,7 @@ static gboolean repo_remote_fetch_summary (OstreeRepo *self, const char *name, const char *metalink_url_string, + GVariant *options, GBytes **out_summary, GBytes **out_signatures, GCancellable *cancellable, @@ -1905,6 +1906,10 @@ repo_remote_fetch_summary (OstreeRepo *self, gboolean ret = FALSE; SoupURI *base_uri = NULL; gboolean from_cache = FALSE; + g_autofree char *url_override = NULL; + + if (options) + (void) g_variant_lookup (options, "override-url", "&s", &url_override); mainctx = g_main_context_new (); g_main_context_push_thread_default (mainctx); @@ -1917,11 +1922,10 @@ repo_remote_fetch_summary (OstreeRepo *self, g_autofree char *url_string = NULL; if (metalink_url_string) url_string = g_strdup (metalink_url_string); - else - { - if (!ostree_repo_remote_get_url (self, name, &url_string, error)) - goto out; - } + else if (url_override) + url_string = g_strdup (url_override); + else if (!ostree_repo_remote_get_url (self, name, &url_string, error)) + goto out; base_uri = soup_uri_new (url_string); if (base_uri == NULL) @@ -2004,8 +2008,8 @@ repo_remote_fetch_summary (OstreeRepo *self, * ostree_repo_remote_fetch_summary: * @self: Self * @name: name of a remote - * @out_summary: (allow-none): return location for raw summary data, or %NULL - * @out_signatures: (allow-none): return location for raw summary signature + * @out_summary: (nullable): return location for raw summary data, or %NULL + * @out_signatures: (nullable): return location for raw summary signature * data, or %NULL * @cancellable: a #GCancellable * @error: a #GError @@ -2030,6 +2034,42 @@ ostree_repo_remote_fetch_summary (OstreeRepo *self, GBytes **out_signatures, GCancellable *cancellable, GError **error) +{ + return ostree_repo_remote_fetch_summary_with_options (self, + name, + NULL, + out_summary, + out_signatures, + cancellable, + error); +} + +/** + * ostree_repo_remote_fetch_summary_with_options: + * @self: Self + * @name: name of a remote + * @options: (nullable): A GVariant a{sv} with an extensible set of flags + * @out_summary: (nullable): return location for raw summary data, or %NULL + * @out_signatures: (nullable): return location for raw summary signature + * data, or %NULL + * @cancellable: a #GCancellable + * @error: a #GError + * + * Like ostree_repo_remote_fetch_summary(), but supports an extensible set of flags. + * The following are currently defined: + * + * - override-url (s): Fetch summary from this URL if remote specifies no metalink in options + * + * Returns: %TRUE on success, %FALSE on failure + */ +gboolean +ostree_repo_remote_fetch_summary_with_options (OstreeRepo *self, + const char *name, + GVariant *options, + GBytes **out_summary, + GBytes **out_signatures, + GCancellable *cancellable, + GError **error) { #ifdef HAVE_LIBSOUP g_autofree char *metalink_url_string = NULL; @@ -2048,6 +2088,7 @@ ostree_repo_remote_fetch_summary (OstreeRepo *self, if (!repo_remote_fetch_summary (self, name, metalink_url_string, + options, &summary, &signatures, cancellable, diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index d9c61ebc..f0fa53a3 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -194,6 +194,15 @@ gboolean ostree_repo_remote_fetch_summary (OstreeRepo *self, GCancellable *cancellable, GError **error); +_OSTREE_PUBLIC +gboolean ostree_repo_remote_fetch_summary_with_options (OstreeRepo *self, + const char *name, + GVariant *options, + GBytes **out_summary, + GBytes **out_signatures, + GCancellable *cancellable, + GError **error); + _OSTREE_PUBLIC OstreeRepo * ostree_repo_get_parent (OstreeRepo *self);