lib/repo: Change resolve_keyring_for_collection() to return a remote
Instead of returning just the keyring filename, return the entire OstreeRemote, which has the keyring filename as one of its members. This will simplify some upcoming changes, and allows slightly improved debug logging. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1202 Approved by: cgwalters
This commit is contained in:
1 parent
030d2b1525
commit
22c1fdfbd3
4 files changed
+48
-41
No files matched your search
@@ -5498,7 +5498,7 @@ check_remote_matches_collection_id (OstreeRepo *repo,
|
||||
* Find the GPG keyring for the given @collection_id, using the local
|
||||
* configuration from the given #OstreeRepo. This will search the configured
|
||||
* remotes for ones whose `collection-id` key matches @collection_id, and will
|
||||
* return the GPG keyring from the first matching remote.
|
||||
* return the first matching remote.
|
||||
*
|
||||
* If multiple remotes match and have different keyrings, a debug message will
|
||||
* be emitted, and the first result will be returned. It is expected that the
|
||||
@@ -5506,10 +5506,11 @@ check_remote_matches_collection_id (OstreeRepo *repo,
|
||||
*
|
||||
* If no match can be found, a %G_IO_ERROR_NOT_FOUND error will be returned.
|
||||
*
|
||||
* Returns: (transfer full): filename of the GPG keyring for @collection_id
|
||||
* Returns: (transfer full): #OstreeRemote containing the GPG keyring for
|
||||
* @collection_id
|
||||
* Since: 2017.8
|
||||
*/
|
||||
gchar *
|
||||
OstreeRemote *
|
||||
ostree_repo_resolve_keyring_for_collection (OstreeRepo *self,
|
||||
const gchar *collection_id,
|
||||
GCancellable *cancellable,
|
||||
@@ -5517,7 +5518,7 @@ ostree_repo_resolve_keyring_for_collection (OstreeRepo *self,
|
||||
{
|
||||
gsize i;
|
||||
g_auto(GStrv) remotes = NULL;
|
||||
const OstreeRemote *keyring_remote = NULL;
|
||||
OstreeRemote *keyring_remote = NULL;
|
||||
|
||||
g_return_val_if_fail (OSTREE_IS_REPO (self), NULL);
|
||||
g_return_val_if_fail (ostree_validate_collection_id (collection_id, NULL), NULL);
|
||||
@@ -5567,7 +5568,7 @@ ostree_repo_resolve_keyring_for_collection (OstreeRepo *self,
|
||||
}
|
||||
|
||||
if (keyring_remote != NULL)
|
||||
return g_strdup (keyring_remote->keyring);
|
||||
return ostree_remote_ref (keyring_remote);
|
||||
else
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
||||
|
||||
Reference in new issue
Block a user