[gnome-software] Match Fedora-style licenses for applications



commit 1655593206d06ef0f92e28f75848d4deaf026c87
Author: Richard Hughes <richard hughsie com>
Date:   Wed Dec 9 11:13:40 2015 +0000

    Match Fedora-style licenses for applications
    
    If this data is coming from the package manager we can't really assume it is in
    SPDX format and we should probably be liberal in what we accept.

 configure.ac                               |    2 +-
 src/plugins/gs-plugin-packagekit-refine.c  |   10 +++++++---
 src/plugins/gs-plugin-packagekit-refresh.c |    4 +++-
 3 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7a414aa..2901fe9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.18.2 gio-unix-2.0)
 PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 1.0.11)
-PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.5.2)
+PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.5.5)
 PKG_CHECK_MODULES(SQLITE, sqlite3)
 PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.51.92)
 PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 3.11.5)
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 24a093c..a6e46df 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -500,9 +500,13 @@ gs_plugin_packagekit_refine_details_app (GsPlugin *plugin,
                                continue;
                        }
                        if (gs_app_get_licence (app) == NULL) {
-                               gs_app_set_licence (app,
-                                                   pk_details_get_license (details),
-                                                   GS_APP_QUALITY_LOWEST);
+                               g_autofree gchar *license_spdx = NULL;
+                               license_spdx = as_utils_license_to_spdx (pk_details_get_license (details));
+                               if (license_spdx != NULL) {
+                                       gs_app_set_licence (app,
+                                                           license_spdx,
+                                                           GS_APP_QUALITY_LOWEST);
+                               }
                        }
                        if (gs_app_get_url (app, AS_URL_KIND_HOMEPAGE) == NULL) {
                                gs_app_set_url (app,
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index f4518eb..2d357c6 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -305,6 +305,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
        ProgressData data;
        g_autoptr (PkResults) results = NULL;
        g_autofree gchar *basename = NULL;
+       g_autofree gchar *license_spdx = NULL;
        g_auto(GStrv) files = NULL;
        g_auto(GStrv) split = NULL;
        g_autoptr(GPtrArray) array = NULL;
@@ -374,7 +375,8 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
                                               pk_details_get_description (item));
        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, pk_details_get_url (item));
        gs_app_set_size (app, pk_details_get_size (item));
-       gs_app_set_licence (app, pk_details_get_license (item), GS_APP_QUALITY_LOWEST);
+       license_spdx = as_utils_license_to_spdx (pk_details_get_license (item));
+       gs_app_set_licence (app, license_spdx, GS_APP_QUALITY_LOWEST);
 
        /* look for a desktop file so we can use a valid application id */
        if (!gs_plugin_packagekit_refresh_guess_app_id (plugin,


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