diff options
author | Richard Hughes <richard@hughsie.com> | 2014-07-29 19:27:50 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-07-29 19:27:50 +0100 |
commit | 869c200d251984ff3ce6fd4955b504a2c66e0715 (patch) | |
tree | 9bd6ba111fa002f06bbd1d7446524b21d49d1f6b | |
parent | da7933b0fdae3d511d79353d3f35775f7318364c (diff) | |
download | appstream-glib-869c200d251984ff3ce6fd4955b504a2c66e0715.tar.gz |
trivial: Only write the <source_pkgname> if different to the <pkgname>
-rw-r--r-- | libappstream-builder/asb-task.c | 17 | ||||
-rw-r--r-- | libappstream-glib/as-app.c | 12 | ||||
-rw-r--r-- | libappstream-glib/as-self-test.c | 2 |
3 files changed, 15 insertions, 16 deletions
diff --git a/libappstream-builder/asb-task.c b/libappstream-builder/asb-task.c index e579781..cc7d654 100644 --- a/libappstream-builder/asb-task.c +++ b/libappstream-builder/asb-task.c @@ -319,6 +319,14 @@ asb_task_process (AsbTask *task, GError **error_not_used) asb_package_get_license (priv->pkg), -1); + /* add the source name so we can suggest these together */ + if (g_strcmp0 (asb_package_get_source_pkgname (priv->pkg), + asb_package_get_name (priv->pkg)) != 0) { + as_app_set_source_pkgname (AS_APP (app), + asb_package_get_source_pkgname (priv->pkg), + -1); + } + /* set all the releases on the app */ array = asb_package_get_releases (priv->pkg); for (i = 0; i < array->len; i++) { @@ -399,15 +407,6 @@ asb_task_process (AsbTask *task, GError **error_not_used) asb_package_log (priv->pkg, ASB_PACKAGE_LOG_LEVEL_NONE, "%s", tmp); g_free (tmp); } - - /* add the source name so we can suggest these together */ - if (nr_added > 1) { - for (l = apps; l != NULL; l = l->next) { - as_app_set_source_pkgname (AS_APP (l->data), - asb_package_get_source_pkgname (priv->pkg), - -1); - } - } skip: /* add a dummy element to the AppStream metadata so that we don't keep * parsing this every time */ diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 546c04d..f323192 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -2606,6 +2606,12 @@ as_app_node_insert (AsApp *app, GNode *parent, gdouble api_version) as_node_insert (node_app, "pkgname", tmp, 0, NULL); } + /* <source_pkgname> */ + if (priv->source_pkgname != NULL && api_version >= 0.8) { + as_node_insert (node_app, "source_pkgname", + priv->source_pkgname, 0, NULL); + } + /* <name> */ as_node_insert_localized (node_app, "name", priv->names, @@ -2715,12 +2721,6 @@ as_app_node_insert (AsApp *app, GNode *parent, gdouble api_version) } } - /* <source_pkgname> */ - if (priv->source_pkgname != NULL && api_version >= 0.8) { - as_node_insert (node_app, "source_pkgname", - priv->source_pkgname, 0, NULL); - } - /* <url> */ as_node_insert_hash (node_app, "url", "type", priv->urls, 0); diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c index afb48a0..dd5c93e 100644 --- a/libappstream-glib/as-self-test.c +++ b/libappstream-glib/as-self-test.c @@ -520,6 +520,7 @@ as_test_app_func (void) "<component priority=\"-4\" type=\"desktop\">" "<id>org.gnome.Software.desktop</id>" "<pkgname>gnome-software</pkgname>" + "<source_pkgname>gnome-software-src</source_pkgname>" "<name>Software</name>" "<name xml:lang=\"pl\">Oprogramowanie</name>" "<summary>Application manager</summary>" @@ -543,7 +544,6 @@ as_test_app_func (void) "<mimetype>application/vnd.oasis.opendocument.spreadsheet</mimetype>" "</mimetypes>" "<project_license>GPLv2+</project_license>" - "<source_pkgname>gnome-software-src</source_pkgname>" "<url type=\"homepage\">https://wiki.gnome.org/Design/Apps/Software</url>" "<project_group>GNOME</project_group>" "<compulsory_for_desktop>GNOME</compulsory_for_desktop>" |