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 18:25:46 +0100
commit412a99d2c6ec377d98b3ceb9009ce62fc1d17f5d (patch)
tree92ccd3dd9459b2e7b504b1216b4677b09af2d2c9
parentf4bd5f611645eb394ac0419d848aba7fda91ccee (diff)
downloadappstream-glib-412a99d2c6ec377d98b3ceb9009ce62fc1d17f5d.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);
}
}