[gnome-software/gnome-3-18] Fix installing web applications



commit 5fb0e88c2795bc31f1746e93aeed927a52885996
Author: Richard Hughes <richard hughsie com>
Date:   Tue Oct 27 15:08:23 2015 +0000

    Fix installing web applications
    
    We only want the PackageKit plugin to match up installed desktop files with
    package names. If we do this for all components we end up searching for the
    thing that installed /usr/share/app-info/xmls/fedora.xml which is appstream-data,
    which we really don't want to remove.
    
    Luckily, the PackageKit plugin gets confused and just returns an unhelpful
    error in this case.
    
    Fix the problem by only adding the extra metadata for desktop, AppData or
    MetaInfo files.

 src/plugins/gs-plugin-appstream.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index eb430eb..6e5829c 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -493,11 +493,20 @@ gs_plugin_refine_item (GsPlugin *plugin,
                }
        }
 
-       /* give the desktopdb plugin a fighting chance */
-       if (as_app_get_source_file (item) != NULL &&
-           gs_app_get_metadata_item (app, "DataDir::desktop-filename") == NULL) {
-               gs_app_set_metadata (app, "DataDir::desktop-filename",
-                                    as_app_get_source_file (item));
+       /* allow the PackageKit plugin to match up installed local files
+        * with packages when the component isn't in the AppStream XML */
+       switch (as_app_get_source_kind (item)) {
+       case AS_APP_SOURCE_KIND_DESKTOP:
+       case AS_APP_SOURCE_KIND_APPDATA:
+       case AS_APP_SOURCE_KIND_METAINFO:
+               if (as_app_get_source_file (item) != NULL &&
+                   gs_app_get_metadata_item (app, "DataDir::desktop-filename") == NULL) {
+                       gs_app_set_metadata (app, "DataDir::desktop-filename",
+                                            as_app_get_source_file (item));
+               }
+               break;
+       default:
+               break;
        }
 
        /* set id */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]