[gnome-software/wip/mak/libas: 2/3] Fix tests for AppStream transition
- From: Matthias Klumpp <mak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/mak/libas: 2/3] Fix tests for AppStream transition
- Date: Fri, 8 Jan 2021 02:48:21 +0000 (UTC)
commit 7bc5f56ac2844be0de68801fa5ab993144995d52
Author: Matthias Klumpp <matthias tenstral net>
Date: Fri Jan 8 03:47:15 2021 +0100
Fix tests for AppStream transition
Most notably, AppStream's data-id is one part shorter than
appstream-glib's unique-id, so we have to account for that.
lib/gs-app.c | 15 ++++---
lib/gs-app.h | 3 +-
lib/gs-self-test.c | 54 +++++++++++------------
plugins/core/gs-self-test.c | 2 +-
plugins/dummy/gs-plugin-dummy.c | 2 +-
plugins/flatpak/gs-self-test.c | 52 +++++++++++-----------
plugins/packagekit/gs-plugin-packagekit-offline.c | 2 +-
plugins/snap/gs-plugin-snap.c | 17 +------
8 files changed, 68 insertions(+), 79 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index 8c383092b..0f5589d02 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -4729,15 +4729,18 @@ gs_app_new (const gchar *id)
* Since: 3.26
**/
void
-gs_app_set_from_unique_id (GsApp *app, const gchar *unique_id)
+gs_app_set_from_unique_id (GsApp *app, const gchar *unique_id, AsComponentKind kind)
{
g_auto(GStrv) split = NULL;
g_return_if_fail (GS_IS_APP (app));
g_return_if_fail (unique_id != NULL);
+ if (kind != AS_COMPONENT_KIND_UNKNOWN)
+ gs_app_set_kind (app, kind);
+
split = g_strsplit (unique_id, "/", -1);
- if (g_strv_length (split) != 6)
+ if (g_strv_length (split) != 5)
return;
if (g_strcmp0 (split[0], "*") != 0)
gs_app_set_scope (app, as_component_scope_from_string (split[0]));
@@ -4746,11 +4749,9 @@ gs_app_set_from_unique_id (GsApp *app, const gchar *unique_id)
if (g_strcmp0 (split[2], "*") != 0)
gs_app_set_origin (app, split[2]);
if (g_strcmp0 (split[3], "*") != 0)
- gs_app_set_kind (app, as_component_kind_from_string (split[3]));
+ gs_app_set_id (app, split[3]);
if (g_strcmp0 (split[4], "*") != 0)
- gs_app_set_id (app, split[4]);
- if (g_strcmp0 (split[5], "*") != 0)
- gs_app_set_branch (app, split[5]);
+ gs_app_set_branch (app, split[4]);
}
/**
@@ -4774,7 +4775,7 @@ gs_app_new_from_unique_id (const gchar *unique_id)
GsApp *app;
g_return_val_if_fail (unique_id != NULL, NULL);
app = gs_app_new (NULL);
- gs_app_set_from_unique_id (app, unique_id);
+ gs_app_set_from_unique_id (app, unique_id, AS_COMPONENT_KIND_UNKNOWN);
return app;
}
diff --git a/lib/gs-app.h b/lib/gs-app.h
index 6ecd75924..e624200e6 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -229,7 +229,8 @@ GsApp *gs_app_new (const gchar *id);
G_DEPRECATED_FOR(gs_app_set_from_unique_id)
GsApp *gs_app_new_from_unique_id (const gchar *unique_id);
void gs_app_set_from_unique_id (GsApp *app,
- const gchar *unique_id);
+ const gchar *unique_id,
+ AsComponentKind kind);
gchar *gs_app_to_string (GsApp *app);
void gs_app_to_string_append (GsApp *app,
GString *str);
diff --git a/lib/gs-self-test.c b/lib/gs-self-test.c
index 2e0d0b792..5f951fdb4 100644
--- a/lib/gs-self-test.c
+++ b/lib/gs-self-test.c
@@ -151,7 +151,7 @@ gs_utils_error_func (void)
g_assert_cmpstr (error->message, ==, "failed");
gs_utils_error_add_app_id (&error, app);
gs_utils_error_add_origin_id (&error, origin);
- g_assert_cmpstr (error->message, ==, "[*/*/*/*/gimp-repo/*] {*/*/*/*/gimp.desktop/*} failed");
+ g_assert_cmpstr (error->message, ==, "[*/*/*/gimp-repo/*] {*/*/*/gimp.desktop/*} failed");
/* find and strip any unique IDs from the error message */
for (guint i = 0; i < 2; i++) {
@@ -161,8 +161,8 @@ gs_utils_error_func (void)
origin_id = gs_utils_error_strip_origin_id (error);
}
- g_assert_cmpstr (app_id, ==, "*/*/*/*/gimp.desktop/*");
- g_assert_cmpstr (origin_id, ==, "*/*/*/*/gimp-repo/*");
+ g_assert_cmpstr (app_id, ==, "*/*/*/gimp.desktop/*");
+ g_assert_cmpstr (origin_id, ==, "*/*/*/gimp-repo/*");
g_assert_cmpstr (error->message, ==, "failed");
}
@@ -373,24 +373,24 @@ gs_plugin_func (void)
/* respect priority when deduplicating */
list = gs_app_list_new ();
app = gs_app_new ("e");
- gs_app_set_unique_id (app, "user/foo/*/*/e/*");
+ gs_app_set_unique_id (app, "user/foo/*/e/*");
gs_app_list_add (list, app);
gs_app_set_priority (app, 0);
g_object_unref (app);
app = gs_app_new ("e");
- gs_app_set_unique_id (app, "user/bar/*/*/e/*");
+ gs_app_set_unique_id (app, "user/bar/*/e/*");
gs_app_list_add (list, app);
gs_app_set_priority (app, 99);
g_object_unref (app);
app = gs_app_new ("e");
- gs_app_set_unique_id (app, "user/baz/*/*/e/*");
+ gs_app_set_unique_id (app, "user/baz/*/e/*");
gs_app_list_add (list, app);
gs_app_set_priority (app, 50);
g_object_unref (app);
g_assert_cmpint (gs_app_list_length (list), ==, 3);
gs_app_list_filter_duplicates (list, GS_APP_LIST_FILTER_FLAG_KEY_ID);
g_assert_cmpint (gs_app_list_length (list), ==, 1);
- g_assert_cmpstr (gs_app_get_unique_id (gs_app_list_index (list, 0)), ==, "user/bar/*/*/e/*");
+ g_assert_cmpstr (gs_app_get_unique_id (gs_app_list_index (list, 0)), ==, "user/bar/*/e/*");
g_object_unref (list);
/* respect priority (using name and version) when deduplicating */
@@ -398,21 +398,21 @@ gs_plugin_func (void)
app = gs_app_new ("e");
gs_app_add_source (app, "foo");
gs_app_set_version (app, "1.2.3");
- gs_app_set_unique_id (app, "user/foo/repo/*/*/*");
+ gs_app_set_unique_id (app, "user/foo/repo/*/*");
gs_app_list_add (list, app);
gs_app_set_priority (app, 0);
g_object_unref (app);
app = gs_app_new ("e");
gs_app_add_source (app, "foo");
gs_app_set_version (app, "1.2.3");
- gs_app_set_unique_id (app, "user/foo/repo-security/*/*/*");
+ gs_app_set_unique_id (app, "user/foo/repo-security/*/*");
gs_app_list_add (list, app);
gs_app_set_priority (app, 99);
g_object_unref (app);
app = gs_app_new ("e");
gs_app_add_source (app, "foo");
gs_app_set_version (app, "1.2.3");
- gs_app_set_unique_id (app, "user/foo/repo-universe/*/*/*");
+ gs_app_set_unique_id (app, "user/foo/repo-universe/*/*");
gs_app_list_add (list, app);
gs_app_set_priority (app, 50);
g_object_unref (app);
@@ -421,20 +421,20 @@ gs_plugin_func (void)
GS_APP_LIST_FILTER_FLAG_KEY_SOURCE |
GS_APP_LIST_FILTER_FLAG_KEY_VERSION);
g_assert_cmpint (gs_app_list_length (list), ==, 1);
- g_assert_cmpstr (gs_app_get_unique_id (gs_app_list_index (list, 0)), ==,
"user/foo/repo-security/*/*/*");
+ g_assert_cmpstr (gs_app_get_unique_id (gs_app_list_index (list, 0)), ==,
"user/foo/repo-security/*/*");
g_object_unref (list);
/* prefer installed applications */
list = gs_app_list_new ();
app = gs_app_new ("e");
gs_app_set_state (app, GS_APP_STATE_INSTALLED);
- gs_app_set_unique_id (app, "user/foo/*/*/e/*");
+ gs_app_set_unique_id (app, "user/foo/*/e/*");
gs_app_set_priority (app, 0);
gs_app_list_add (list, app);
g_object_unref (app);
app = gs_app_new ("e");
gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
- gs_app_set_unique_id (app, "user/bar/*/*/e/*");
+ gs_app_set_unique_id (app, "user/bar/*/e/*");
gs_app_set_priority (app, 100);
gs_app_list_add (list, app);
g_object_unref (app);
@@ -442,13 +442,13 @@ gs_plugin_func (void)
GS_APP_LIST_FILTER_FLAG_KEY_ID |
GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED);
g_assert_cmpint (gs_app_list_length (list), ==, 1);
- g_assert_cmpstr (gs_app_get_unique_id (gs_app_list_index (list, 0)), ==, "user/foo/*/*/e/*");
+ g_assert_cmpstr (gs_app_get_unique_id (gs_app_list_index (list, 0)), ==, "user/foo/*/e/*");
g_object_unref (list);
/* use the provides ID to dedupe */
list = gs_app_list_new ();
app = gs_app_new ("gimp.desktop");
- gs_app_set_unique_id (app, "user/fedora/*/*/gimp.desktop/*");
+ gs_app_set_unique_id (app, "user/fedora/*/gimp.desktop/*");
gs_app_set_priority (app, 0);
gs_app_list_add (list, app);
g_object_unref (app);
@@ -456,24 +456,24 @@ gs_plugin_func (void)
gs_app_add_provided_item (app,
AS_PROVIDED_KIND_ID,
"gimp.desktop");
- gs_app_set_unique_id (app, "user/flathub/*/*/org.gimp.GIMP/*");
+ gs_app_set_unique_id (app, "user/flathub/*/org.gimp.GIMP/*");
gs_app_set_priority (app, 100);
gs_app_list_add (list, app);
g_object_unref (app);
gs_app_list_filter_duplicates (list, GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES);
g_assert_cmpint (gs_app_list_length (list), ==, 1);
g_assert_cmpstr (gs_app_get_unique_id (gs_app_list_index (list, 0)), ==,
- "user/flathub/*/*/org.gimp.GIMP/*");
+ "user/flathub/*/org.gimp.GIMP/*");
g_object_unref (list);
/* use globs when adding */
list = gs_app_list_new ();
app = gs_app_new ("b");
- gs_app_set_unique_id (app, "a/b/c/d/e/f");
+ gs_app_set_unique_id (app, "a/b/c/d/e");
gs_app_list_add (list, app);
g_object_unref (app);
app = gs_app_new ("b");
- gs_app_set_unique_id (app, "a/b/c/*/e/f");
+ gs_app_set_unique_id (app, "a/b/c/*/e");
gs_app_list_add (list, app);
g_object_unref (app);
g_assert_cmpint (gs_app_list_length (list), ==, 1);
@@ -483,13 +483,13 @@ gs_plugin_func (void)
/* lookup with a wildcard */
list = gs_app_list_new ();
app = gs_app_new ("b");
- gs_app_set_unique_id (app, "a/b/c/d/e/f");
+ gs_app_set_unique_id (app, "a/b/c/d/e");
gs_app_list_add (list, app);
g_object_unref (app);
- g_assert (gs_app_list_lookup (list, "a/b/c/d/e/f") != NULL);
- g_assert (gs_app_list_lookup (list, "a/b/c/d/e/*") != NULL);
- g_assert (gs_app_list_lookup (list, "*/b/c/d/e/f") != NULL);
- g_assert (gs_app_list_lookup (list, "x/x/x/x/x/x") == NULL);
+ g_assert (gs_app_list_lookup (list, "a/b/c/d/e") != NULL);
+ g_assert (gs_app_list_lookup (list, "a/b/c/d/*") != NULL);
+ g_assert (gs_app_list_lookup (list, "*/b/c/d/e") != NULL);
+ g_assert (gs_app_list_lookup (list, "x/x/x/x/x") == NULL);
g_object_unref (list);
/* allow duplicating a wildcard */
@@ -499,7 +499,7 @@ gs_plugin_func (void)
gs_app_list_add (list, app);
g_object_unref (app);
app = gs_app_new ("gimp.desktop");
- gs_app_set_unique_id (app, "system/flatpak/*/*/gimp.desktop/stable");
+ gs_app_set_unique_id (app, "system/flatpak/*/gimp.desktop/stable");
gs_app_list_add (list, app);
g_object_unref (app);
g_assert_cmpint (gs_app_list_length (list), ==, 2);
@@ -604,8 +604,8 @@ gs_app_unique_id_func (void)
g_autoptr(GsApp) app = gs_app_new (NULL);
const gchar *unique_id;
- unique_id = "system/flatpak/gnome/desktop/org.gnome.Software.desktop/master";
- gs_app_set_from_unique_id (app, unique_id);
+ unique_id = "system/flatpak/gnome/org.gnome.Software.desktop/master";
+ gs_app_set_from_unique_id (app, unique_id, AS_COMPONENT_KIND_DESKTOP_APP);
g_assert (GS_IS_APP (app));
g_assert_cmpint (gs_app_get_scope (app), ==, AS_COMPONENT_SCOPE_SYSTEM);
g_assert_cmpint (gs_app_get_bundle_kind (app), ==, AS_BUNDLE_KIND_FLATPAK);
diff --git a/plugins/core/gs-self-test.c b/plugins/core/gs-self-test.c
index 90bf7b4f5..53be465a9 100644
--- a/plugins/core/gs-self-test.c
+++ b/plugins/core/gs-self-test.c
@@ -29,7 +29,7 @@ gs_plugins_core_search_repo_name_func (GsPluginLoader *plugin_loader)
gs_plugin_loader_setup_again (plugin_loader);
/* force this app to be installed */
- app_tmp = gs_plugin_loader_app_create (plugin_loader, "*/*/yellow/desktop/arachne.desktop/*");
+ app_tmp = gs_plugin_loader_app_create (plugin_loader, "*/*/yellow/arachne.desktop/*");
gs_app_set_state (app_tmp, GS_APP_STATE_INSTALLED);
/* get search result based on addon keyword */
diff --git a/plugins/dummy/gs-plugin-dummy.c b/plugins/dummy/gs-plugin-dummy.c
index c8176e9ae..3a1ad44df 100644
--- a/plugins/dummy/gs-plugin-dummy.c
+++ b/plugins/dummy/gs-plugin-dummy.c
@@ -785,7 +785,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
as_icon_set_name (ic, "application-x-addon");
/* get existing item from the cache */
- app = gs_plugin_cache_lookup (plugin,
"user/*/*/os-upgrade/org.fedoraproject.release-rawhide.upgrade/*");
+ app = gs_plugin_cache_lookup (plugin,
"user/*/os-upgrade/org.fedoraproject.release-rawhide.upgrade/*");
if (app != NULL) {
gs_app_list_add (list, app);
return TRUE;
diff --git a/plugins/flatpak/gs-self-test.c b/plugins/flatpak/gs-self-test.c
index 99e879dc0..476d9883c 100644
--- a/plugins/flatpak/gs-self-test.c
+++ b/plugins/flatpak/gs-self-test.c
@@ -95,7 +95,7 @@ gs_plugins_flatpak_repo_non_ascii_func (GsPluginLoader *plugin_loader)
gs_test_flush_main_context ();
g_assert_no_error (error);
g_assert_true (app != NULL);
- g_assert_cmpstr (gs_app_get_unique_id (app), ==, "*/*/*/source/example__1____/master");
+ g_assert_cmpstr (gs_app_get_unique_id (app), ==, "*/*/*/example__1____/master");
}
static void
@@ -366,7 +366,7 @@ gs_plugins_flatpak_app_with_runtime_func (GsPluginLoader *plugin_loader)
/* check runtime */
runtime = gs_app_get_runtime (app);
g_assert_true (runtime != NULL);
- g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime/master");
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==, "user/flatpak/test/org.test.Runtime/master");
g_assert_cmpint (gs_app_get_state (runtime), ==, GS_APP_STATE_AVAILABLE);
/* install, also installing runtime */
@@ -704,12 +704,12 @@ gs_plugins_flatpak_runtime_repo_func (GsPluginLoader *plugin_loader)
g_assert_cmpint (gs_app_get_state (app), ==, GS_APP_STATE_AVAILABLE_LOCAL);
g_assert_cmpstr (gs_app_get_id (app), ==, "org.test.Chiron");
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app),
- "user/flatpak/*/desktop/org.test.Chiron/master"));
+ "user/flatpak/*/org.test.Chiron/master"));
g_assert_true (gs_app_get_local_file (app) != NULL);
/* get runtime */
runtime = gs_app_get_runtime (app);
- g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/*/runtime/org.test.Runtime/master");
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==, "user/flatpak/*/org.test.Runtime/master");
g_assert_cmpint (gs_app_get_state (runtime), ==, GS_APP_STATE_AVAILABLE_LOCAL);
/* check the number of sources */
@@ -768,7 +768,7 @@ gs_plugins_flatpak_runtime_repo_func (GsPluginLoader *plugin_loader)
/* remove the remote */
app_source = gs_app_list_index (sources2, 0);
g_assert_true (app_source != NULL);
- g_assert_cmpstr (gs_app_get_unique_id (app_source), ==, "user/flatpak/*/source/test/*");
+ g_assert_cmpstr (gs_app_get_unique_id (app_source), ==, "user/flatpak/*/test/*");
g_object_unref (plugin_job);
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
"app", app_source,
@@ -828,7 +828,7 @@ gs_plugins_flatpak_runtime_repo_redundant_func (GsPluginLoader *plugin_loader)
g_assert_cmpint (gs_app_get_kind (app_src), ==, AS_COMPONENT_KIND_REPOSITORY);
g_assert_cmpint (gs_app_get_state (app_src), ==, GS_APP_STATE_AVAILABLE_LOCAL);
g_assert_cmpstr (gs_app_get_id (app_src), ==, "test");
- g_assert_cmpstr (gs_app_get_unique_id (app_src), ==, "*/*/*/source/test/master");
+ g_assert_cmpstr (gs_app_get_unique_id (app_src), ==, "*/*/*/test/master");
g_assert_true (gs_app_get_local_file (app_src) != NULL);
/* install the source manually */
@@ -867,12 +867,12 @@ gs_plugins_flatpak_runtime_repo_redundant_func (GsPluginLoader *plugin_loader)
g_assert_cmpint (gs_app_get_state (app), ==, GS_APP_STATE_AVAILABLE_LOCAL);
g_assert_cmpstr (gs_app_get_id (app), ==, "org.test.Chiron");
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app),
- "user/flatpak/*/desktop/org.test.Chiron/master"));
+ "user/flatpak/*/org.test.Chiron/master"));
g_assert_true (gs_app_get_local_file (app) != NULL);
/* get runtime */
runtime = gs_app_get_runtime (app);
- g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime/master");
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==, "user/flatpak/test/org.test.Runtime/master");
g_assert_cmpint (gs_app_get_state (runtime), ==, GS_APP_STATE_AVAILABLE);
/* check the number of sources */
@@ -929,7 +929,7 @@ gs_plugins_flatpak_runtime_repo_redundant_func (GsPluginLoader *plugin_loader)
/* remove the remote */
app_source = gs_app_list_index (sources2, 0);
g_assert_true (app_source != NULL);
- g_assert_cmpstr (gs_app_get_unique_id (app_source), ==, "user/flatpak/*/source/test/*");
+ g_assert_cmpstr (gs_app_get_unique_id (app_source), ==, "user/flatpak/*/test/*");
g_object_unref (plugin_job);
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
"app", app_source,
@@ -1013,10 +1013,10 @@ gs_plugins_flatpak_broken_remote_func (GsPluginLoader *plugin_loader)
g_assert_cmpstr (gs_app_get_id (app), ==, "org.test.Chiron");
#if FLATPAK_CHECK_VERSION(1,1,2)
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app),
- "user/flatpak/chiron-origin/desktop/org.test.Chiron/master"));
+ "user/flatpak/chiron-origin/org.test.Chiron/master"));
#else
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app),
- "user/flatpak/org.test.Chiron-origin/desktop/org.test.Chiron/master"));
+ "user/flatpak/org.test.Chiron-origin/org.test.Chiron/master"));
#endif
g_assert_cmpstr (gs_app_get_url (app, AS_URL_KIND_HOMEPAGE), ==, "http://127.0.0.1/");
g_assert_cmpstr (gs_app_get_name (app), ==, "Chiron");
@@ -1106,7 +1106,7 @@ flatpak_bundle_or_ref_helper (GsPluginLoader *plugin_loader,
g_assert_cmpint (gs_app_list_length (list), ==, 1);
runtime = gs_app_list_index (list, 0);
g_assert_cmpstr (gs_app_get_id (runtime), ==, "org.test.Runtime");
- g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime/master");
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==, "user/flatpak/test/org.test.Runtime/master");
g_assert_cmpint (gs_app_get_state (runtime), ==, GS_APP_STATE_AVAILABLE);
/* install the runtime ahead of time */
@@ -1176,15 +1176,15 @@ flatpak_bundle_or_ref_helper (GsPluginLoader *plugin_loader,
* won't be created until the app is installed.
*/
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app),
- "user/flatpak/flatpak/desktop/org.test.Chiron/master"));
+ "user/flatpak/flatpak/org.test.Chiron/master"));
g_assert_true (gs_flatpak_app_get_file_kind (app) == GS_FLATPAK_APP_FILE_KIND_BUNDLE);
} else {
#if FLATPAK_CHECK_VERSION(1,1,2)
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app),
- "user/flatpak/chiron-origin/desktop/org.test.Chiron/master"));
+ "user/flatpak/chiron-origin/org.test.Chiron/master"));
#else
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app),
- "user/flatpak/org.test.Chiron-origin/desktop/org.test.Chiron/master"));
+ "user/flatpak/org.test.Chiron-origin/org.test.Chiron/master"));
#endif
g_assert_true (gs_flatpak_app_get_file_kind (app) == GS_FLATPAK_APP_FILE_KIND_REF);
g_assert_cmpstr (gs_app_get_url (app, AS_URL_KIND_HOMEPAGE), ==, "http://127.0.0.1/");
@@ -1193,7 +1193,7 @@ flatpak_bundle_or_ref_helper (GsPluginLoader *plugin_loader,
/* get runtime */
runtime = gs_app_get_runtime (app);
- g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime/master");
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==, "user/flatpak/test/org.test.Runtime/master");
g_assert_cmpint (gs_app_get_state (runtime), ==, GS_APP_STATE_INSTALLED);
/* install */
@@ -1237,17 +1237,17 @@ flatpak_bundle_or_ref_helper (GsPluginLoader *plugin_loader,
if (is_bundle) {
#if FLATPAK_CHECK_VERSION(1,1,2)
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app2),
- "user/flatpak/chiron-origin/desktop/org.test.Chiron/master"));
+ "user/flatpak/chiron-origin/org.test.Chiron/master"));
#else
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app2),
- "user/flatpak/org.test.Chiron-origin/desktop/org.test.Chiron/master"));
+ "user/flatpak/org.test.Chiron-origin/org.test.Chiron/master"));
#endif
} else {
/* Note: the origin is now test-1 because that remote was created from the
* RuntimeRepo= setting
*/
g_assert_true (as_utils_data_id_equal (gs_app_get_unique_id (app2),
- "user/flatpak/test-1/desktop/org.test.Chiron/master"));
+ "user/flatpak/test-1/org.test.Chiron/master"));
}
/* remove app */
@@ -1476,7 +1476,7 @@ gs_plugins_flatpak_app_update_func (GsPluginLoader *plugin_loader)
}
/* check they are the same GObject */
- app_tmp = gs_app_list_lookup (list_updates, "*/flatpak/test/*/org.test.Chiron/*");
+ app_tmp = gs_app_list_lookup (list_updates, "*/flatpak/test/org.test.Chiron/*");
g_assert_true (app_tmp == app);
g_assert_cmpint (gs_app_get_state (app), ==, GS_APP_STATE_UPDATABLE_LIVE);
g_assert_cmpstr (gs_app_get_update_details (app), ==, "Version 1.2.4:\nThis is best.\n\nVersion
1.2.3:\nThis is better.");
@@ -1530,7 +1530,7 @@ gs_plugins_flatpak_app_update_func (GsPluginLoader *plugin_loader)
/* check that the app's runtime has changed */
runtime = gs_app_get_runtime (app);
g_assert_true (runtime != NULL);
- g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime/new_master");
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==, "user/flatpak/test/org.test.Runtime/new_master");
g_assert_true (old_runtime != runtime);
g_assert_cmpstr (gs_app_get_branch (runtime), ==, "new_master");
g_assert_true (gs_app_get_state (runtime) == GS_APP_STATE_INSTALLED);
@@ -1551,7 +1551,7 @@ gs_plugins_flatpak_app_update_func (GsPluginLoader *plugin_loader)
g_assert_true (ret);
/* remove the old_runtime */
- g_assert_cmpstr (gs_app_get_unique_id (old_runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime/master");
+ g_assert_cmpstr (gs_app_get_unique_id (old_runtime), ==, "user/flatpak/test/org.test.Runtime/master");
g_object_unref (plugin_job);
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
"app", old_runtime,
@@ -1562,7 +1562,7 @@ gs_plugins_flatpak_app_update_func (GsPluginLoader *plugin_loader)
g_assert_true (ret);
/* remove the runtime */
- g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime/new_master");
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==, "user/flatpak/test/org.test.Runtime/new_master");
g_object_unref (plugin_job);
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
"app", runtime,
@@ -1693,7 +1693,7 @@ gs_plugins_flatpak_runtime_extension_func (GsPluginLoader *plugin_loader)
/* check if the extension was installed */
extension = gs_plugin_loader_app_create (plugin_loader,
- "user/flatpak/*/runtime/org.test.Chiron.Extension/master");
+ "user/flatpak/*/org.test.Chiron.Extension/master");
g_assert_nonnull (extension);
g_assert_cmpint (gs_app_get_state (extension), ==, GS_APP_STATE_INSTALLED);
@@ -1728,11 +1728,11 @@ gs_plugins_flatpak_runtime_extension_func (GsPluginLoader *plugin_loader)
}
/* check that the extension has no update */
- app_tmp = gs_app_list_lookup (list_updates, "*/flatpak/test/*/org.test.Chiron.Extension/*");
+ app_tmp = gs_app_list_lookup (list_updates, "*/flatpak/test/org.test.Chiron.Extension/*");
g_assert_null (app_tmp);
/* check that the app has an update (it's affected by the extension's update) */
- app_tmp = gs_app_list_lookup (list_updates, "*/flatpak/test/*/org.test.Chiron/*");
+ app_tmp = gs_app_list_lookup (list_updates, "*/flatpak/test/org.test.Chiron/*");
g_assert_true (app_tmp == app);
g_assert_cmpint (gs_app_get_state (app), ==, GS_APP_STATE_UPDATABLE_LIVE);
diff --git a/plugins/packagekit/gs-plugin-packagekit-offline.c
b/plugins/packagekit/gs-plugin-packagekit-offline.c
index 7d70796af..3a9dda5af 100644
--- a/plugins/packagekit/gs-plugin-packagekit-offline.c
+++ b/plugins/packagekit/gs-plugin-packagekit-offline.c
@@ -139,7 +139,7 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
g_autoptr(GsApp) app = NULL;
app = gs_app_new (NULL);
- gs_app_set_from_unique_id (app, "*/*/*/*/system/*");
+ gs_app_set_from_unique_id (app, "*/*/*/system/*", AS_COMPONENT_KIND_GENERIC);
gs_app_set_management_plugin (app, "packagekit");
gs_app_add_quirk (app, GS_APP_QUIRK_IS_WILDCARD);
gs_app_set_state (app, GS_APP_STATE_UNKNOWN);
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 5a4718b5e..0259469be 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -318,25 +318,12 @@ snap_to_app (GsPlugin *plugin, SnapdSnap *snap)
g_autoptr(GsApp) app = NULL;
appstream_id = get_appstream_id (snap);
- switch (snapd_snap_get_snap_type (snap)) {
- case SNAPD_SNAP_TYPE_APP:
- unique_id = g_strdup_printf ("system/snap/*/desktop/%s/*", appstream_id);
- break;
- case SNAPD_SNAP_TYPE_KERNEL:
- case SNAPD_SNAP_TYPE_GADGET:
- case SNAPD_SNAP_TYPE_OS:
- unique_id = g_strdup_printf ("system/snap/*/runtime/%s/*", appstream_id);
- break;
- default:
- case SNAPD_SNAP_TYPE_UNKNOWN:
- unique_id = g_strdup_printf ("system/snap/*/*/%s/*", appstream_id);
- break;
- }
+ unique_id = g_strdup_printf ("system/snap/*/%s/*", appstream_id);
app = gs_plugin_cache_lookup (plugin, unique_id);
if (app == NULL) {
app = gs_app_new (appstream_id);
- gs_app_set_from_unique_id (app, unique_id);
+ gs_app_set_from_unique_id (app, unique_id, AS_COMPONENT_KIND_UNKNOWN);
gs_app_set_bundle_kind (app, AS_BUNDLE_KIND_SNAP);
gs_app_set_metadata (app, "snap::name", snapd_snap_get_name (snap));
gs_plugin_cache_add (plugin, unique_id, app);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]