summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2018-04-16 16:13:43 +0100
committerRichard Hughes <richard@hughsie.com>2018-04-18 16:13:50 +0100
commitd9e65e88a7df614948d5ae620adb6b258a489efe (patch)
tree3a0f6064cf6c2bb0dcc8d297494cd9b56ffb2185
parent1cf6422c29a65fccbf86ecc0a8056a746c1fa6f9 (diff)
downloadappstream-glib-d9e65e88a7df614948d5ae620adb6b258a489efe.tar.gz
Never add more than one component to the AppStream store when composing
If the app has an AppData file with org.gnome.Gimp.appdata.xml that contains <id>org.gnome.Gimp</id> and also a org.gnome.Gimp.desktop then the second gets added as a new component as the .desktop suffix is optional, but allowed for compatibility. Just rename the .desktop component ID in this case to force the app to be subsumed rather than added.
-rw-r--r--client/as-compose.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/client/as-compose.c b/client/as-compose.c
index 512a7f1..8526c08 100644
--- a/client/as-compose.c
+++ b/client/as-compose.c
@@ -497,6 +497,12 @@ main (int argc, char **argv)
if (g_hash_table_size (as_app_get_comments (app_appdata)) > 0)
g_hash_table_remove_all (as_app_get_comments (app_desktop));
+ /* does the app already exist with a launchable that matches this ID */
+ if (g_strcmp0 (as_app_get_id (app_appdata), as_app_get_id (app_desktop)) != 0) {
+ g_debug ("fixing up ID for desktop merge");
+ as_app_set_id (app_desktop, as_app_get_id (app_appdata));
+ }
+
as_store_add_app (store, app_desktop);
}
}