Export ostree_repo_get_remote_option* functions
These are useful for ostree users (like xdg-app) that have custom options for remotes. In particular they are useful when we later make them all respect self->parent_repo. Closes: #236 Approved by: cgwalters
This commit is contained in:
parent
91734a8a18
commit
37382590dc
|
|
@ -321,6 +321,9 @@ global:
|
||||||
ostree_sysroot_deployment_unlock;
|
ostree_sysroot_deployment_unlock;
|
||||||
ostree_deployment_get_unlocked;
|
ostree_deployment_get_unlocked;
|
||||||
ostree_deployment_unlocked_state_to_string;
|
ostree_deployment_unlocked_state_to_string;
|
||||||
|
ostree_repo_get_remote_option;
|
||||||
|
ostree_repo_get_remote_list_option;
|
||||||
|
ostree_repo_get_remote_boolean_option;
|
||||||
} LIBOSTREE_2016.3;
|
} LIBOSTREE_2016.3;
|
||||||
|
|
||||||
/* NOTE NOTE NOTE
|
/* NOTE NOTE NOTE
|
||||||
|
|
|
||||||
|
|
@ -195,29 +195,6 @@ _ostree_repo_commit_modifier_apply (OstreeRepo *self,
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_repo_remote_name_is_file (const char *remote_name);
|
_ostree_repo_remote_name_is_file (const char *remote_name);
|
||||||
|
|
||||||
gboolean
|
|
||||||
_ostree_repo_get_remote_option (OstreeRepo *self,
|
|
||||||
const char *remote_name,
|
|
||||||
const char *option_name,
|
|
||||||
const char *default_value,
|
|
||||||
char **out_value,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_ostree_repo_get_remote_list_option (OstreeRepo *self,
|
|
||||||
const char *remote_name,
|
|
||||||
const char *option_name,
|
|
||||||
char ***out_value,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_ostree_repo_get_remote_boolean_option (OstreeRepo *self,
|
|
||||||
const char *remote_name,
|
|
||||||
const char *option_name,
|
|
||||||
gboolean default_value,
|
|
||||||
gboolean *out_value,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_repo_get_remote_option_inherit (OstreeRepo *self,
|
_ostree_repo_get_remote_option_inherit (OstreeRepo *self,
|
||||||
const char *remote_name,
|
const char *remote_name,
|
||||||
|
|
|
||||||
|
|
@ -2008,9 +2008,9 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||||
requested_refs_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
requested_refs_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||||
commits_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
commits_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_option (self,
|
if (!ostree_repo_get_remote_option (self,
|
||||||
remote_name_or_baseurl, "metalink",
|
remote_name_or_baseurl, "metalink",
|
||||||
NULL, &metalink_url_str, error))
|
NULL, &metalink_url_str, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!metalink_url_str)
|
if (!metalink_url_str)
|
||||||
|
|
@ -2064,9 +2064,9 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||||
summary_bytes, FALSE);
|
summary_bytes, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_list_option (self,
|
if (!ostree_repo_get_remote_list_option (self,
|
||||||
remote_name_or_baseurl, "branches",
|
remote_name_or_baseurl, "branches",
|
||||||
&configured_branches, error))
|
&configured_branches, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (strcmp (soup_uri_get_scheme (pull_data->base_uri), "file") == 0)
|
if (strcmp (soup_uri_get_scheme (pull_data->base_uri), "file") == 0)
|
||||||
|
|
|
||||||
|
|
@ -257,13 +257,29 @@ _ostree_repo_remote_name_is_file (const char *remote_name)
|
||||||
return g_str_has_prefix (remote_name, "file://");
|
return g_str_has_prefix (remote_name, "file://");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_repo_get_remote_option:
|
||||||
|
* @self: A OstreeRepo
|
||||||
|
* @remote_name: Name
|
||||||
|
* @option_name: Option
|
||||||
|
* @default_value: (allow-none): Value returned if @option_name is not present
|
||||||
|
* @out_value: (out): Return location for value
|
||||||
|
* @error: Error
|
||||||
|
*
|
||||||
|
* OSTree remotes are represented by keyfile groups, formatted like:
|
||||||
|
* `[remote "remotename"]`. This function returns a value named @option_name
|
||||||
|
* underneath that group, or @default_value if the remote exists but not the
|
||||||
|
* option name.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE on success, otherwise %FALSE with @error set
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_repo_get_remote_option (OstreeRepo *self,
|
ostree_repo_get_remote_option (OstreeRepo *self,
|
||||||
const char *remote_name,
|
const char *remote_name,
|
||||||
const char *option_name,
|
const char *option_name,
|
||||||
const char *default_value,
|
const char *default_value,
|
||||||
char **out_value,
|
char **out_value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
local_cleanup_remote OstreeRemote *remote = NULL;
|
local_cleanup_remote OstreeRemote *remote = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
@ -289,12 +305,29 @@ _ostree_repo_get_remote_option (OstreeRepo *self,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_repo_get_remote_list_option:
|
||||||
|
* @self: A OstreeRepo
|
||||||
|
* @remote_name: Name
|
||||||
|
* @option_name: Option
|
||||||
|
* @out_value: (out) (array zero-terminated=1): location to store the list
|
||||||
|
* of strings. The list should be freed with
|
||||||
|
* g_strfreev().
|
||||||
|
* @error: Error
|
||||||
|
*
|
||||||
|
* OSTree remotes are represented by keyfile groups, formatted like:
|
||||||
|
* `[remote "remotename"]`. This function returns a value named @option_name
|
||||||
|
* underneath that group, and returns it as an zero terminated array of strings.
|
||||||
|
* If the option is not set, @out_value will be set to %NULL.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE on success, otherwise %FALSE with @error set
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_repo_get_remote_list_option (OstreeRepo *self,
|
ostree_repo_get_remote_list_option (OstreeRepo *self,
|
||||||
const char *remote_name,
|
const char *remote_name,
|
||||||
const char *option_name,
|
const char *option_name,
|
||||||
char ***out_value,
|
char ***out_value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
local_cleanup_remote OstreeRemote *remote = NULL;
|
local_cleanup_remote OstreeRemote *remote = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
@ -331,13 +364,29 @@ _ostree_repo_get_remote_list_option (OstreeRepo *self,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_repo_get_remote_boolean_option:
|
||||||
|
* @self: A OstreeRepo
|
||||||
|
* @remote_name: Name
|
||||||
|
* @option_name: Option
|
||||||
|
* @default_value: (allow-none): Value returned if @option_name is not present
|
||||||
|
* @out_value: (out) : location to store the result.
|
||||||
|
* @error: Error
|
||||||
|
*
|
||||||
|
* OSTree remotes are represented by keyfile groups, formatted like:
|
||||||
|
* `[remote "remotename"]`. This function returns a value named @option_name
|
||||||
|
* underneath that group, and returns it as a boolean.
|
||||||
|
* If the option is not set, @out_value will be set to @default_value.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE on success, otherwise %FALSE with @error set
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_repo_get_remote_boolean_option (OstreeRepo *self,
|
ostree_repo_get_remote_boolean_option (OstreeRepo *self,
|
||||||
const char *remote_name,
|
const char *remote_name,
|
||||||
const char *option_name,
|
const char *option_name,
|
||||||
gboolean default_value,
|
gboolean default_value,
|
||||||
gboolean *out_value,
|
gboolean *out_value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
local_cleanup_remote OstreeRemote *remote = NULL;
|
local_cleanup_remote OstreeRemote *remote = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
@ -374,9 +423,9 @@ _ostree_repo_get_remote_option_inherit (OstreeRepo *self,
|
||||||
g_autofree char *value = NULL;
|
g_autofree char *value = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_option (self,
|
if (!ostree_repo_get_remote_option (self,
|
||||||
remote_name, option_name,
|
remote_name, option_name,
|
||||||
NULL, &value, error))
|
NULL, &value, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (value == NULL && parent != NULL)
|
if (value == NULL && parent != NULL)
|
||||||
|
|
@ -412,9 +461,9 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
|
||||||
g_return_val_if_fail (OSTREE_IS_REPO (self), NULL);
|
g_return_val_if_fail (OSTREE_IS_REPO (self), NULL);
|
||||||
g_return_val_if_fail (remote_name != NULL, NULL);
|
g_return_val_if_fail (remote_name != NULL, NULL);
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_boolean_option (self, remote_name,
|
if (!ostree_repo_get_remote_boolean_option (self, remote_name,
|
||||||
"tls-permissive", FALSE,
|
"tls-permissive", FALSE,
|
||||||
&tls_permissive, error))
|
&tls_permissive, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (tls_permissive)
|
if (tls_permissive)
|
||||||
|
|
@ -426,13 +475,13 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
|
||||||
g_autofree char *tls_client_cert_path = NULL;
|
g_autofree char *tls_client_cert_path = NULL;
|
||||||
g_autofree char *tls_client_key_path = NULL;
|
g_autofree char *tls_client_key_path = NULL;
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_option (self, remote_name,
|
if (!ostree_repo_get_remote_option (self, remote_name,
|
||||||
"tls-client-cert-path", NULL,
|
"tls-client-cert-path", NULL,
|
||||||
&tls_client_cert_path, error))
|
&tls_client_cert_path, error))
|
||||||
goto out;
|
goto out;
|
||||||
if (!_ostree_repo_get_remote_option (self, remote_name,
|
if (!ostree_repo_get_remote_option (self, remote_name,
|
||||||
"tls-client-key-path", NULL,
|
"tls-client-key-path", NULL,
|
||||||
&tls_client_key_path, error))
|
&tls_client_key_path, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if ((tls_client_cert_path != NULL) != (tls_client_key_path != NULL))
|
if ((tls_client_cert_path != NULL) != (tls_client_key_path != NULL))
|
||||||
|
|
@ -462,9 +511,9 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
|
||||||
{
|
{
|
||||||
g_autofree char *tls_ca_path = NULL;
|
g_autofree char *tls_ca_path = NULL;
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_option (self, remote_name,
|
if (!ostree_repo_get_remote_option (self, remote_name,
|
||||||
"tls-ca-path", NULL,
|
"tls-ca-path", NULL,
|
||||||
&tls_ca_path, error))
|
&tls_ca_path, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (tls_ca_path != NULL)
|
if (tls_ca_path != NULL)
|
||||||
|
|
@ -482,9 +531,9 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
|
||||||
{
|
{
|
||||||
g_autofree char *http_proxy = NULL;
|
g_autofree char *http_proxy = NULL;
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_option (self, remote_name,
|
if (!ostree_repo_get_remote_option (self, remote_name,
|
||||||
"proxy", NULL,
|
"proxy", NULL,
|
||||||
&http_proxy, error))
|
&http_proxy, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (http_proxy != NULL)
|
if (http_proxy != NULL)
|
||||||
|
|
@ -1343,8 +1392,8 @@ ostree_repo_remote_get_gpg_verify (OstreeRepo *self,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ostree_repo_get_remote_boolean_option (self, name, "gpg-verify",
|
return ostree_repo_get_remote_boolean_option (self, name, "gpg-verify",
|
||||||
TRUE, out_gpg_verify, error);
|
TRUE, out_gpg_verify, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1366,8 +1415,8 @@ ostree_repo_remote_get_gpg_verify_summary (OstreeRepo *self,
|
||||||
gboolean *out_gpg_verify_summary,
|
gboolean *out_gpg_verify_summary,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return _ostree_repo_get_remote_boolean_option (self, name, "gpg-verify-summary",
|
return ostree_repo_get_remote_boolean_option (self, name, "gpg-verify-summary",
|
||||||
FALSE, out_gpg_verify_summary, error);
|
FALSE, out_gpg_verify_summary, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1889,8 +1938,8 @@ ostree_repo_remote_fetch_summary (OstreeRepo *self,
|
||||||
g_return_val_if_fail (OSTREE_REPO (self), FALSE);
|
g_return_val_if_fail (OSTREE_REPO (self), FALSE);
|
||||||
g_return_val_if_fail (name != NULL, FALSE);
|
g_return_val_if_fail (name != NULL, FALSE);
|
||||||
|
|
||||||
if (!_ostree_repo_get_remote_option (self, name, "metalink", NULL,
|
if (!ostree_repo_get_remote_option (self, name, "metalink", NULL,
|
||||||
&metalink_url_string, error))
|
&metalink_url_string, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!repo_remote_fetch_summary (self,
|
if (!repo_remote_fetch_summary (self,
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,29 @@ gboolean ostree_repo_remote_get_gpg_verify_summary (OstreeRepo *self,
|
||||||
gboolean *out_gpg_verify_summary,
|
gboolean *out_gpg_verify_summary,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
gboolean ostree_repo_get_remote_option (OstreeRepo *self,
|
||||||
|
const char *remote_name,
|
||||||
|
const char *option_name,
|
||||||
|
const char *default_value,
|
||||||
|
char **out_value,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
gboolean ostree_repo_get_remote_list_option (OstreeRepo *self,
|
||||||
|
const char *remote_name,
|
||||||
|
const char *option_name,
|
||||||
|
char ***out_value,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
gboolean ostree_repo_get_remote_boolean_option (OstreeRepo *self,
|
||||||
|
const char *remote_name,
|
||||||
|
const char *option_name,
|
||||||
|
gboolean default_value,
|
||||||
|
gboolean *out_value,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
_OSTREE_PUBLIC
|
_OSTREE_PUBLIC
|
||||||
gboolean ostree_repo_remote_gpg_import (OstreeRepo *self,
|
gboolean ostree_repo_remote_gpg_import (OstreeRepo *self,
|
||||||
const char *name,
|
const char *name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue