[gnome-software/wip/hughsie/Flatpak_X-AppInstall-Package] Only add <pkgname> entries when bundles have not already been used
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/Flatpak_X-AppInstall-Package] Only add <pkgname> entries when bundles have not already been used
- Date: Thu, 28 Feb 2019 12:10:39 +0000 (UTC)
commit b02a6c8a5384adf58682674ba05657e7e606b488
Author: Richard Hughes <richard hughsie com>
Date: Thu Feb 28 12:06:48 2019 +0000
Only add <pkgname> entries when bundles have not already been used
The scribus.desktop file has a hardcoded `X-AppInstall-Package=scribus` which
gets processed, merged, and added to the flatpak *AppStream* metadata.
This causes bad things to happen when the appstream helper code helpfully adds
'scribus' as a bundle source, but libflatpak complains it's not a valid ref.
plugins/core/gs-appstream.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index ec137786..d0768ef7 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -644,7 +644,6 @@ gs_appstream_refine_app (GsPlugin *plugin,
g_autoptr(GError) error_local = NULL;
g_autoptr(GPtrArray) bundles = NULL;
g_autoptr(GPtrArray) launchables = NULL;
- g_autoptr(GPtrArray) pkgnames = NULL;
g_autoptr(XbNode) req = NULL;
/* is compatible */
@@ -823,19 +822,6 @@ gs_appstream_refine_app (GsPlugin *plugin,
if (!gs_appstream_copy_metadata (app, component, error))
return FALSE;
- /* add package names */
- pkgnames = xb_node_query (component, "pkgname", 0, NULL);
- if (pkgnames != NULL && gs_app_get_sources(app)->len == 0) {
- for (guint i = 0; i < pkgnames->len; i++) {
- XbNode *pkgname = g_ptr_array_index (pkgnames, i);
- tmp = xb_node_get_text (pkgname);
- if (tmp != NULL && tmp[0] != '\0')
- gs_app_add_source (app, tmp);
- }
- gs_app_set_bundle_kind (app, AS_BUNDLE_KIND_PACKAGE);
- gs_app_set_scope (app, AS_APP_SCOPE_SYSTEM);
- }
-
/* add bundles */
bundles = xb_node_query (component, "bundle", 0, NULL);
if (bundles != NULL && gs_app_get_sources(app)->len == 0) {
@@ -847,6 +833,22 @@ gs_appstream_refine_app (GsPlugin *plugin,
}
}
+ /* add legacy package names */
+ if (gs_app_get_bundle_kind (app) == AS_BUNDLE_KIND_UNKNOWN) {
+ g_autoptr(GPtrArray) pkgnames = NULL;
+ pkgnames = xb_node_query (component, "pkgname", 0, NULL);
+ if (pkgnames != NULL && gs_app_get_sources(app)->len == 0) {
+ for (guint i = 0; i < pkgnames->len; i++) {
+ XbNode *pkgname = g_ptr_array_index (pkgnames, i);
+ tmp = xb_node_get_text (pkgname);
+ if (tmp != NULL && tmp[0] != '\0')
+ gs_app_add_source (app, tmp);
+ }
+ gs_app_set_bundle_kind (app, AS_BUNDLE_KIND_PACKAGE);
+ gs_app_set_scope (app, AS_APP_SCOPE_SYSTEM);
+ }
+ }
+
/* set origin for flatpaks */
if (gs_app_get_origin (app) == NULL &&
gs_app_get_bundle_kind (app) == AS_BUNDLE_KIND_FLATPAK) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]