[gnome-software] Refine the size and license when using rpm-ostree



commit f86b5fb0829e82ca0f81009248efef2ac8e3dd15
Author: Richard Hughes <richard hughsie com>
Date:   Sat Mar 26 16:11:31 2016 +0000

    Refine the size and license when using rpm-ostree

 src/plugins/gs-plugin-rpm.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-rpm.c b/src/plugins/gs-plugin-rpm.c
index 602bdc2..7966ac5 100644
--- a/src/plugins/gs-plugin-rpm.c
+++ b/src/plugins/gs-plugin-rpm.c
@@ -127,6 +127,8 @@ gs_plugin_refine_app (GsPlugin *plugin,
 
        /* required */
        if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION) == 0 &&
+           (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SIZE) == 0 &&
+           (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENCE) == 0 &&
            (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION) == 0)
                return TRUE;
 
@@ -159,7 +161,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
                const gchar *version;
                const gchar *arch;
                const gchar *release;
-               g_autofree gchar *tmp = NULL;
+               const gchar *license;
 
                /* add default source */
                name = headerGetString (h, RPMTAG_NAME);
@@ -168,6 +170,21 @@ gs_plugin_refine_app (GsPlugin *plugin,
                        gs_app_add_source (app, name);
                }
 
+               /* set size */
+               if (gs_app_get_size (app) == 0) {
+                       guint64 tmp;
+                       tmp = headerGetNumber (h, RPMTAG_SIZE);
+                       gs_app_set_size (app, tmp);
+               }
+
+               /* set license */
+               license = headerGetString (h, RPMTAG_LICENSE);
+               if (gs_app_get_license (app) == NULL && license != NULL) {
+                       g_autofree gchar *tmp = NULL;
+                       tmp = as_utils_license_to_spdx (license);
+                       gs_app_set_license (app, GS_APP_QUALITY_NORMAL, tmp);
+               }
+
                /* add version */
                version = headerGetString (h, RPMTAG_VERSION);
                if (gs_app_get_version (app) == NULL) {
@@ -177,6 +194,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
 
                /* add source-id */
                if (gs_app_get_source_id_default (app) == NULL) {
+                       g_autofree gchar *tmp = NULL;
                        release = headerGetString (h, RPMTAG_RELEASE);
                        arch = headerGetString (h, RPMTAG_ARCH);
                        epoch = headerGetNumber (h, RPMTAG_EPOCH);


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