lib: Add URL override pull option

The "override-url" option allows to use the other URL while still
using some options from the passed remote.

Closes: #271
Approved by: cgwalters
This commit is contained in:
Krzesimir Nowak 2016-04-19 11:32:14 +02:00 committed by Colin Walters (automation)
parent ad019def9a
commit 08d2b8ab7b
2 changed files with 6 additions and 1 deletions

View File

@ -1909,6 +1909,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
gboolean require_static_deltas = FALSE;
gboolean opt_gpg_verify = FALSE;
gboolean opt_gpg_verify_summary = FALSE;
const char *url_override = NULL;
if (options)
{
@ -1926,6 +1927,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
(void) g_variant_lookup (options, "require-static-deltas", "b", &require_static_deltas);
(void) g_variant_lookup (options, "override-commit-ids", "^a&s", &override_commit_ids);
(void) g_variant_lookup (options, "dry-run", "b", &pull_data->dry_run);
(void) g_variant_lookup (options, "override-url", "&s", &url_override);
}
g_return_val_if_fail (pull_data->maxdepth >= -1, FALSE);
@ -2021,7 +2023,9 @@ ostree_repo_pull_with_options (OstreeRepo *self,
{
g_autofree char *baseurl = NULL;
if (!ostree_repo_remote_get_url (self, remote_name_or_baseurl, &baseurl, error))
if (url_override != NULL)
baseurl = g_strdup (url_override);
else if (!ostree_repo_remote_get_url (self, remote_name_or_baseurl, &baseurl, error))
goto out;
pull_data->base_uri = soup_uri_new (baseurl);

View File

@ -4077,6 +4077,7 @@ ostree_repo_pull_one_dir (OstreeRepo *self,
* * require-static-deltas (b): Require static deltas
* * override-commit-ids (as): Array of specific commit IDs to fetch for refs
* * dry-run (b): Only print information on what will be downloaded (requires static deltas)
* * override-url (s): Fetch objects from this URL if remote specifies no metalink in options
*/
gboolean
ostree_repo_pull_with_options (OstreeRepo *self,