[gnome-software] Fix installing web applications



commit 1608818ff2477418621de45ae1d021641fd722e9
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 |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 11b3f63..7bf49b9 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -515,12 +515,20 @@ gs_plugin_refine_item (GsPlugin *plugin,
                }
        }
 
-       /* give the desktopdb plugin a fighting chance */
-       if (as_app_get_source_file (item) != NULL &&
-           as_app_get_source_kind (item) == AS_APP_SOURCE_KIND_DESKTOP &&
-           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]