dir: Use FlatpakRemoteState in flatpak_dir_remote_has_ref

Closes: #1575
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson
2018-04-11 12:43:37 +02:00
committed by Atomic Bot
parent 38df7f823b
commit 76bf02cb74
2 changed files with 8 additions and 19 deletions

View File

@@ -8425,7 +8425,6 @@ flatpak_dir_get_remote_state_for_summary (FlatpakDir *self,
return _flatpak_dir_get_remote_state (self, remote, FALSE, opt_summary, opt_summary_sig, cancellable, error);
}
/* This is an alternative way to get the remote state that doesn't
* error out if the summary or metadata is not available in the p2p
* case. For example, we want to be able to update an app even when
@@ -8441,31 +8440,24 @@ flatpak_dir_get_remote_state_optional (FlatpakDir *self,
return _flatpak_dir_get_remote_state (self, remote, TRUE, NULL, NULL, cancellable, error);
}
gboolean
static gboolean
flatpak_dir_remote_has_ref (FlatpakDir *self,
const char *remote,
const char *ref)
{
g_autoptr(GVariant) summary = NULL;
g_autoptr(GError) local_error = NULL;
g_autofree char *collection_id = NULL;
g_autoptr(FlatpakRemoteState) state = NULL;
g_autofree char *rev = NULL;
summary = fetch_remote_summary_file (self, remote, NULL, NULL, &local_error);
if (summary == NULL)
state = flatpak_dir_get_remote_state (self, remote, NULL, &local_error);
if (state == NULL)
{
g_debug ("Can't get summary for remote %s: %s", remote, local_error->message);
g_debug ("Can't get state for remote %s: %s", remote, local_error->message);
return FALSE;
}
/* Derive the collection ID from the remote we are querying. This will act as
* a sanity check on the summary ref lookup. */
if (!repo_get_remote_collection_id (self->repo, remote, &collection_id, &local_error))
{
g_debug ("Cant get collection ID for remote %s: %s", remote, local_error->message);
return FALSE;
}
return flatpak_summary_lookup_ref (summary, collection_id, ref, NULL, NULL);
rev = flatpak_remote_state_lookup_ref (state, ref, NULL, NULL);
return rev != NULL;
}
/* This duplicates ostree_repo_list_refs so it can use flatpak_dir_remote_fetch_summary

View File

@@ -295,9 +295,6 @@ GFile * flatpak_dir_get_unmaintained_extension_dir_if_exists (FlatpakDir *se
const char *branch,
GCancellable *cancellable);
gboolean flatpak_dir_remote_has_ref (FlatpakDir *self,
const char *remote,
const char *ref);
char ** flatpak_dir_search_for_dependency (FlatpakDir *self,
const char *runtime_ref,
GCancellable *cancellable,