forked from Mirrors/flatpak-builder
change load summary api
We want to call it before we have added a remote to the config, so pass in the url directly instead of pulling it out of the repo config.tingping/wmclass
parent
02b6300453
commit
2054f0e6f5
|
@ -29,7 +29,7 @@ xdg_app_builtin_repo_contents (int argc, char **argv, GCancellable *cancellable,
|
|||
gboolean ret = FALSE;
|
||||
GOptionContext *context;
|
||||
gs_unref_object XdgAppDir *dir = NULL;
|
||||
gs_unref_object OstreeRepo *repo = NULL;
|
||||
OstreeRepo *repo = NULL;
|
||||
gs_unref_hashtable GHashTable *refs = NULL;
|
||||
gs_free char *title = NULL;
|
||||
GHashTableIter iter;
|
||||
|
@ -39,7 +39,6 @@ xdg_app_builtin_repo_contents (int argc, char **argv, GCancellable *cancellable,
|
|||
int i;
|
||||
const char *repository;
|
||||
gs_free char *url = NULL;
|
||||
gs_free char *summary_url = NULL;
|
||||
gs_unref_bytes GBytes *bytes = NULL;
|
||||
|
||||
context = g_option_context_new (" REPOSITORY - Show available runtimes and applications");
|
||||
|
@ -56,7 +55,10 @@ xdg_app_builtin_repo_contents (int argc, char **argv, GCancellable *cancellable,
|
|||
repository = argv[1];
|
||||
|
||||
repo = xdg_app_dir_get_repo (dir);
|
||||
if (!ostree_repo_load_summary (repo, repository, &refs, &title, cancellable, error))
|
||||
if (!ostree_repo_remote_get_url (repo, repository, &url, error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_repo_load_summary (url, &refs, &title, cancellable, error))
|
||||
goto out;
|
||||
|
||||
names = g_ptr_array_new_with_free_func (g_free);
|
||||
|
|
|
@ -390,24 +390,19 @@ out:
|
|||
}
|
||||
|
||||
gboolean
|
||||
ostree_repo_load_summary (OstreeRepo *repo,
|
||||
const char *repository,
|
||||
ostree_repo_load_summary (const char *repository_url,
|
||||
GHashTable **refs,
|
||||
gchar **title,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_free char *url = NULL;
|
||||
gs_free char *summary_url = NULL;
|
||||
gs_unref_bytes GBytes *bytes = NULL;
|
||||
gs_unref_hashtable GHashTable *local_refs = NULL;
|
||||
gs_free char *local_title = NULL;
|
||||
|
||||
if (!ostree_repo_remote_get_url (repo, repository, &url, error))
|
||||
goto out;
|
||||
|
||||
summary_url = g_build_filename (url, "summary", NULL);
|
||||
summary_url = g_build_filename (repository_url, "summary", NULL);
|
||||
if (load_contents (summary_url, &bytes, cancellable, NULL))
|
||||
{
|
||||
gs_unref_variant GVariant *summary;
|
||||
|
@ -438,13 +433,13 @@ ostree_repo_load_summary (OstreeRepo *repo,
|
|||
goto out;
|
||||
|
||||
checksum = ostree_checksum_from_bytes_v (csum_v);
|
||||
g_debug ("%s summary: %s -> %s", repository, refname, checksum);
|
||||
g_debug ("\t%s -> %s", refname, checksum);
|
||||
g_hash_table_insert (local_refs, g_strdup (refname), checksum);
|
||||
}
|
||||
|
||||
g_variant_dict_init (&dict, extensions);
|
||||
g_variant_dict_lookup (&dict, "xa.title", "s", &local_title);
|
||||
g_debug ("%s summary: title %s", repository, local_title);
|
||||
g_debug ("Summary title: %s", local_title);
|
||||
g_variant_dict_end (&dict);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,7 @@ gboolean xdg_app_remove_dangling_symlinks (GFile *dir,
|
|||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean ostree_repo_load_summary (OstreeRepo *repo,
|
||||
const char *repository,
|
||||
gboolean ostree_repo_load_summary (const char *repository_url,
|
||||
GHashTable **refs,
|
||||
gchar **title,
|
||||
GCancellable *cancellable,
|
||||
|
|
Loading…
Reference in New Issue