summaryrefslogtreecommitdiff
path: root/libappstream-builder
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-01-22 13:12:36 +0000
committerRichard Hughes <richard@hughsie.com>2016-01-22 13:57:13 +0000
commit420423afe4320a8e780742a3ae06251e0dc69fad (patch)
treec4abc479012699c3b6fe26f1d2ebaf32489a8c2b /libappstream-builder
parent0c7e133ae291716c030d51630a886313c82410a3 (diff)
downloadappstream-glib-420423afe4320a8e780742a3ae06251e0dc69fad.tar.gz
Remove the GIR and GResource, nm and KDE-specific plugins
Applications have to specify the kudos upstream and relying on these hacky heuristics only worked some of the time for packages, and none of the time for xdg-app and Limba.
Diffstat (limited to 'libappstream-builder')
-rw-r--r--libappstream-builder/asb-self-test.c8
-rw-r--r--libappstream-builder/plugins/Makefile.am32
-rw-r--r--libappstream-builder/plugins/asb-plugin-gir.c133
-rw-r--r--libappstream-builder/plugins/asb-plugin-gresource.c110
-rw-r--r--libappstream-builder/plugins/asb-plugin-kde-notifyrc.c76
-rw-r--r--libappstream-builder/plugins/asb-plugin-kde-services.c112
-rw-r--r--libappstream-builder/plugins/asb-plugin-nm.c129
7 files changed, 3 insertions, 597 deletions
diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c
index 2a68910..6fd09d2 100644
--- a/libappstream-builder/asb-self-test.c
+++ b/libappstream-builder/asb-self-test.c
@@ -291,13 +291,13 @@ asb_test_plugin_loader_func (void)
/* get the list of globs */
globs = asb_plugin_loader_get_globs (loader);\
- g_assert_cmpint (globs->len, >=, 20);
+ g_assert_cmpint (globs->len, >=, 10);
g_assert_cmpstr (asb_glob_value_search (globs, "/usr/share/applications/gimp.desktop"), ==, "");
g_assert_cmpstr (asb_glob_value_search (globs, "/srv/dave.txt"), ==, NULL);
/* get the list of plugins */
plugins = asb_plugin_loader_get_plugins (loader);
- g_assert_cmpint (plugins->len, >=, 13);
+ g_assert_cmpint (plugins->len, >=, 5);
plugin = g_ptr_array_index (plugins, 0);
g_assert (plugin != NULL);
g_assert (plugin->module != NULL);
@@ -519,9 +519,7 @@ asb_test_context_test_func (AsbTestContextMode mode)
"<keyword>Remote</keyword>\n"
"</keywords>\n"
"<kudos>\n"
- "<kudo>AppMenu</kudo>\n"
"<kudo>ModernToolkit</kudo>\n"
- "<kudo>Notifications</kudo>\n"
"<kudo>SearchProvider</kudo>\n"
"<kudo>UserDocs</kudo>\n"
"</kudos>\n"
@@ -643,9 +641,7 @@ asb_test_context_test_func (AsbTestContextMode mode)
"<name>Core</name>\n"
"<summary>Addons for core functionality</summary>\n"
"<kudos>\n"
- "<kudo>AppMenu</kudo>\n"
"<kudo>ModernToolkit</kudo>\n"
- "<kudo>Notifications</kudo>\n"
"<kudo>SearchProvider</kudo>\n"
"<kudo>UserDocs</kudo>\n"
"</kudos>\n"
diff --git a/libappstream-builder/plugins/Makefile.am b/libappstream-builder/plugins/Makefile.am
index 6e0a910..3709321 100644
--- a/libappstream-builder/plugins/Makefile.am
+++ b/libappstream-builder/plugins/Makefile.am
@@ -18,13 +18,8 @@ plugin_LTLIBRARIES = \
libasb_plugin_appdata.la \
libasb_plugin_dbus.la \
libasb_plugin_desktop.la \
- libasb_plugin_gir.la \
- libasb_plugin_gresource.la \
libasb_plugin_gettext.la \
- libasb_plugin_hardcoded.la \
- libasb_plugin_kde_services.la \
- libasb_plugin_kde_notifyrc.la \
- libasb_plugin_nm.la
+ libasb_plugin_hardcoded.la
if HAVE_FONTS
plugin_LTLIBRARIES += \
@@ -41,16 +36,6 @@ libasb_plugin_absorb_la_LIBADD = $(GLIB_LIBS)
libasb_plugin_absorb_la_LDFLAGS = -module -avoid-version
libasb_plugin_absorb_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-libasb_plugin_kde_services_la_SOURCES = asb-plugin-kde-services.c
-libasb_plugin_kde_services_la_LIBADD = $(GLIB_LIBS)
-libasb_plugin_kde_services_la_LDFLAGS = -module -avoid-version
-libasb_plugin_kde_services_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-
-libasb_plugin_kde_notifyrc_la_SOURCES = asb-plugin-kde-notifyrc.c
-libasb_plugin_kde_notifyrc_la_LIBADD = $(GLIB_LIBS)
-libasb_plugin_kde_notifyrc_la_LDFLAGS = -module -avoid-version
-libasb_plugin_kde_notifyrc_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-
libasb_plugin_gettext_la_SOURCES = asb-plugin-gettext.c
libasb_plugin_gettext_la_LIBADD = $(GLIB_LIBS)
libasb_plugin_gettext_la_LDFLAGS = -module -avoid-version
@@ -66,26 +51,11 @@ libasb_plugin_desktop_la_LIBADD = $(GLIB_LIBS) $(GDKPIXBUF_LIBS)
libasb_plugin_desktop_la_LDFLAGS = -module -avoid-version
libasb_plugin_desktop_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-libasb_plugin_gir_la_SOURCES = asb-plugin-gir.c
-libasb_plugin_gir_la_LIBADD = $(GLIB_LIBS) $(GDKPIXBUF_LIBS)
-libasb_plugin_gir_la_LDFLAGS = -module -avoid-version
-libasb_plugin_gir_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-
-libasb_plugin_gresource_la_SOURCES = asb-plugin-gresource.c
-libasb_plugin_gresource_la_LIBADD = $(GLIB_LIBS) $(GDKPIXBUF_LIBS)
-libasb_plugin_gresource_la_LDFLAGS = -module -avoid-version
-libasb_plugin_gresource_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-
libasb_plugin_appdata_la_SOURCES = asb-plugin-appdata.c
libasb_plugin_appdata_la_LIBADD = $(GLIB_LIBS) $(GDKPIXBUF_LIBS)
libasb_plugin_appdata_la_LDFLAGS = -module -avoid-version
libasb_plugin_appdata_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-libasb_plugin_nm_la_SOURCES = asb-plugin-nm.c
-libasb_plugin_nm_la_LIBADD = $(GLIB_LIBS)
-libasb_plugin_nm_la_LDFLAGS = -module -avoid-version
-libasb_plugin_nm_la_CFLAGS = $(GLIB_CFLAGS) $(WARNINGFLAGS_C)
-
if HAVE_FONTS
libasb_plugin_font_la_SOURCES = asb-plugin-font.c
libasb_plugin_font_la_LIBADD = $(GLIB_LIBS) $(FREETYPE_LIBS) $(GDKPIXBUF_LIBS) $(GTK_LIBS)
diff --git a/libappstream-builder/plugins/asb-plugin-gir.c b/libappstream-builder/plugins/asb-plugin-gir.c
deleted file mode 100644
index 5c51704..0000000
--- a/libappstream-builder/plugins/asb-plugin-gir.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2014 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <config.h>
-#include <fnmatch.h>
-
-#include <asb-plugin.h>
-
-/**
- * asb_plugin_get_name:
- */
-const gchar *
-asb_plugin_get_name (void)
-{
- return "gir";
-}
-
-/**
- * asb_plugin_add_globs:
- */
-void
-asb_plugin_add_globs (AsbPlugin *plugin, GPtrArray *globs)
-{
- asb_plugin_add_glob (globs, "/usr/share/*/*.gir");
-}
-
-/**
- * _asb_plugin_check_filename:
- */
-static gboolean
-_asb_plugin_check_filename (const gchar *filename)
-{
- if (asb_plugin_match_glob ("/usr/share/*/*.gir", filename))
- return TRUE;
- return FALSE;
-}
-
-/**
- * asb_plugin_process_gir:
- */
-static gboolean
-asb_plugin_process_gir (AsbApp *app,
- const gchar *tmpdir,
- const gchar *filename,
- GError **error)
-{
- GNode *l;
- GNode *node = NULL;
- const gchar *name;
- const gchar *version;
- gboolean ret = TRUE;
- g_autofree gchar *filename_full = NULL;
- g_autoptr(GFile) file = NULL;
-
- /* load file */
- filename_full = g_build_filename (tmpdir, filename, NULL);
- file = g_file_new_for_path (filename_full);
- node = as_node_from_file (file, AS_NODE_FROM_XML_FLAG_NONE, NULL, error);
- if (node == NULL) {
- ret = FALSE;
- goto out;
- }
-
- /* look for includes */
- l = as_node_find (node, "repository");
- if (l == NULL)
- goto out;
- for (l = l->children; l != NULL; l = l->next) {
- if (g_strcmp0 (as_node_get_name (l), "include") != 0)
- continue;
- name = as_node_get_attribute (l, "name");
- version = as_node_get_attribute (l, "version");
- if (g_strcmp0 (name, "Gtk") == 0 &&
- g_strcmp0 (version, "3.0") == 0) {
- asb_package_log (asb_app_get_package (app),
- ASB_PACKAGE_LOG_LEVEL_DEBUG,
- "Auto-adding kudo ModernToolkit for %s",
- as_app_get_id (AS_APP (app)));
- as_app_add_kudo_kind (AS_APP (app),
- AS_KUDO_KIND_MODERN_TOOLKIT);
- }
- }
-out:
- if (node != NULL)
- as_node_unref (node);
- return ret;
-}
-
-/**
- * asb_plugin_process_app:
- */
-gboolean
-asb_plugin_process_app (AsbPlugin *plugin,
- AsbPackage *pkg,
- AsbApp *app,
- const gchar *tmpdir,
- GError **error)
-{
- gchar **filelist;
- guint i;
-
- /* already set */
- if (as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_MODERN_TOOLKIT))
- return TRUE;
-
- /* look for any GIR files */
- filelist = asb_package_get_filelist (pkg);
- for (i = 0; filelist[i] != NULL; i++) {
- if (!_asb_plugin_check_filename (filelist[i]))
- continue;
- if (!asb_plugin_process_gir (app, tmpdir, filelist[i], error))
- return FALSE;
- }
- return TRUE;
-}
diff --git a/libappstream-builder/plugins/asb-plugin-gresource.c b/libappstream-builder/plugins/asb-plugin-gresource.c
deleted file mode 100644
index c2ab652..0000000
--- a/libappstream-builder/plugins/asb-plugin-gresource.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2014 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <config.h>
-
-#include <asb-plugin.h>
-
-/**
- * asb_plugin_get_name:
- */
-const gchar *
-asb_plugin_get_name (void)
-{
- return "gresource";
-}
-
-/**
- * asb_plugin_add_globs:
- */
-void
-asb_plugin_add_globs (AsbPlugin *plugin, GPtrArray *globs)
-{
- asb_plugin_add_glob (globs, "/usr/bin/*");
-}
-
-static gboolean
-asb_plugin_gresource_app (AsbApp *app, const gchar *filename, GError **error)
-{
- gboolean ret;
- g_autofree gchar *data_err = NULL;
- g_autofree gchar *data_out = NULL;
- const gchar *argv[] = { "/usr/bin/gresource",
- "list",
- filename,
- NULL };
-
- ret = g_spawn_sync (NULL, (gchar **) argv, NULL,
-#if GLIB_CHECK_VERSION(2,40,0)
- G_SPAWN_CLOEXEC_PIPES,
-#else
- G_SPAWN_DEFAULT,
-#endif
- NULL, NULL,
- &data_out,
- &data_err,
- NULL, error);
- if (!ret)
- return FALSE;
- if (g_strstr_len (data_out, -1, "gtk/menus.ui") != NULL) {
- asb_package_log (asb_app_get_package (app),
- ASB_PACKAGE_LOG_LEVEL_DEBUG,
- "Auto-adding kudo AppMenu for %s",
- as_app_get_id (AS_APP (app)));
- as_app_add_kudo_kind (AS_APP (app), AS_KUDO_KIND_APP_MENU);
- }
- return TRUE;
-}
-
-/**
- * asb_plugin_process_app:
- */
-gboolean
-asb_plugin_process_app (AsbPlugin *plugin,
- AsbPackage *pkg,
- AsbApp *app,
- const gchar *tmpdir,
- GError **error)
-{
- gchar **filelist;
- guint i;
-
- filelist = asb_package_get_filelist (pkg);
- for (i = 0; filelist[i] != NULL; i++) {
- GError *error_local = NULL;
- g_autofree gchar *filename = NULL;
-
- if (!asb_plugin_match_glob ("/usr/bin/*", filelist[i]))
- continue;
- if (as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_APP_MENU))
- break;
- filename = g_build_filename (tmpdir, filelist[i], NULL);
- if (!asb_plugin_gresource_app (app, filename, &error_local)) {
- asb_package_log (pkg,
- ASB_PACKAGE_LOG_LEVEL_WARNING,
- "Failed to get resources from %s: %s",
- filename,
- error_local->message);
- g_clear_error (&error_local);
- }
- }
- return TRUE;
-}
diff --git a/libappstream-builder/plugins/asb-plugin-kde-notifyrc.c b/libappstream-builder/plugins/asb-plugin-kde-notifyrc.c
deleted file mode 100644
index b5fd3dd..0000000
--- a/libappstream-builder/plugins/asb-plugin-kde-notifyrc.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2014 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <config.h>
-
-#include <asb-plugin.h>
-#include <fnmatch.h>
-
-/**
- * asb_plugin_get_name:
- */
-const gchar *
-asb_plugin_get_name (void)
-{
- return "kde-notifyrc";
-}
-
-/**
- * asb_plugin_add_globs:
- */
-void
-asb_plugin_add_globs (AsbPlugin *plugin, GPtrArray *globs)
-{
- asb_plugin_add_glob (globs, "/usr/share/kde4/apps/*/*.notifyrc");
-}
-
-/**
- * asb_plugin_process_app:
- */
-gboolean
-asb_plugin_process_app (AsbPlugin *plugin,
- AsbPackage *pkg,
- AsbApp *app,
- const gchar *tmpdir,
- GError **error)
-{
- gchar **filelist;
- guint i;
-
- /* already set */
- if (as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_NOTIFICATIONS))
- return TRUE;
-
- /* look for a shell search provider */
- filelist = asb_package_get_filelist (pkg);
- for (i = 0; filelist[i] != NULL; i++) {
- if (!asb_plugin_match_glob ("/usr/share/kde4/apps/*/*.notifyrc", filelist[i]))
- continue;
- asb_package_log (pkg,
- ASB_PACKAGE_LOG_LEVEL_DEBUG,
- "Auto-adding kudo Notifications for %s",
- as_app_get_id (AS_APP (app)));
- as_app_add_kudo_kind (AS_APP (app), AS_KUDO_KIND_NOTIFICATIONS);
- break;
- }
-
- return TRUE;
-}
diff --git a/libappstream-builder/plugins/asb-plugin-kde-services.c b/libappstream-builder/plugins/asb-plugin-kde-services.c
deleted file mode 100644
index 48e3773..0000000
--- a/libappstream-builder/plugins/asb-plugin-kde-services.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2014 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <config.h>
-
-#include <asb-plugin.h>
-#include <fnmatch.h>
-
-/**
- * asb_plugin_get_name:
- */
-const gchar *
-asb_plugin_get_name (void)
-{
- return "kde-services";
-}
-
-/**
- * asb_plugin_add_globs:
- */
-void
-asb_plugin_add_globs (AsbPlugin *plugin, GPtrArray *globs)
-{
- asb_plugin_add_glob (globs, "/usr/share/kde4/services/*.desktop");
-}
-
-/**
- * asb_plugin_process_filename:
- */
-static gboolean
-asb_plugin_process_filename (const gchar *filename,
- AsbApp *app,
- const gchar *tmpdir,
- GError **error)
-{
- g_autofree gchar *types = NULL;
- g_autoptr(GKeyFile) kf = NULL;
- kf = g_key_file_new ();
- if (!g_key_file_load_from_file (kf, filename, G_KEY_FILE_NONE, error))
- return FALSE;
- types = g_key_file_get_string (kf, G_KEY_FILE_DESKTOP_GROUP,
- "X-KDE-ServiceTypes", NULL);
- if (types == NULL)
- return TRUE;
- if (g_strcmp0 (types, "Plasma/Runner") != 0)
- return TRUE;
- asb_package_log (asb_app_get_package (app),
- ASB_PACKAGE_LOG_LEVEL_DEBUG,
- "Auto-adding kudo SearchProvider for %s",
- as_app_get_id (AS_APP (app)));
- as_app_add_kudo_kind (AS_APP (app), AS_KUDO_KIND_SEARCH_PROVIDER);
- return TRUE;
-}
-
-/**
- * asb_plugin_process_app:
- */
-gboolean
-asb_plugin_process_app (AsbPlugin *plugin,
- AsbPackage *pkg,
- AsbApp *app,
- const gchar *tmpdir,
- GError **error)
-{
- gchar **filelist;
- guint i;
-
- /* already set */
- if (as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_SEARCH_PROVIDER))
- return TRUE;
-
- /* look for a krunner provider */
- filelist = asb_package_get_filelist (pkg);
- for (i = 0; filelist[i] != NULL; i++) {
- g_autoptr(GError) error_local = NULL;
- g_autofree gchar *filename = NULL;
- if (!asb_plugin_match_glob ("/usr/share/kde4/services/*.desktop", filelist[i]))
- continue;
- filename = g_build_filename (tmpdir, filelist[i], NULL);
- if (!asb_plugin_process_filename (filename,
- app,
- tmpdir,
- &error_local)) {
- asb_package_log (pkg,
- ASB_PACKAGE_LOG_LEVEL_INFO,
- "Failed to read KDE service file %s: %s",
- filelist[i],
- error_local->message);
- g_clear_error (&error_local);
- }
- }
-
- return TRUE;
-}
diff --git a/libappstream-builder/plugins/asb-plugin-nm.c b/libappstream-builder/plugins/asb-plugin-nm.c
deleted file mode 100644
index 4f7ce14..0000000
--- a/libappstream-builder/plugins/asb-plugin-nm.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2014 Richard Hughes <richard@hughsie.com>
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <config.h>
-
-#include <asb-plugin.h>
-
-/**
- * asb_plugin_get_name:
- */
-const gchar *
-asb_plugin_get_name (void)
-{
- return "nm";
-}
-
-/**
- * asb_plugin_add_globs:
- */
-void
-asb_plugin_add_globs (AsbPlugin *plugin, GPtrArray *globs)
-{
- asb_plugin_add_glob (globs, "/usr/bin/*");
-}
-
-static gboolean
-asb_plugin_nm_app (AsbApp *app, const gchar *filename, GError **error)
-{
- gboolean ret;
- g_autofree gchar *data_err = NULL;
- g_autofree gchar *data_out = NULL;
- const gchar *argv[] = { "/usr/bin/nm",
- "--dynamic",
- "--no-sort",
- "--undefined-only",
- filename,
- NULL };
-
- ret = g_spawn_sync (NULL, (gchar **) argv, NULL,
-#if GLIB_CHECK_VERSION(2,40,0)
- G_SPAWN_CLOEXEC_PIPES,
-#else
- G_SPAWN_DEFAULT,
-#endif
- NULL, NULL,
- &data_out,
- &data_err,
- NULL, error);
- if (!ret)
- return FALSE;
- if (g_strstr_len (data_out, -1, "gtk_application_new") != NULL) {
- if (!as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_MODERN_TOOLKIT)) {
- asb_package_log (asb_app_get_package (app),
- ASB_PACKAGE_LOG_LEVEL_DEBUG,
- "Auto-adding kudo AppMenu for %s",
- as_app_get_id (AS_APP (app)));
- as_app_add_kudo_kind (AS_APP (app), AS_KUDO_KIND_MODERN_TOOLKIT);
- }
- }
- if (g_strstr_len (data_out, -1, "gtk_application_set_app_menu") != NULL ||
- g_strstr_len (data_out, -1, "gtk_application_get_menu_by_id") != NULL) {
- if (!as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_APP_MENU)) {
- asb_package_log (asb_app_get_package (app),
- ASB_PACKAGE_LOG_LEVEL_DEBUG,
- "Auto-adding kudo AppMenu for %s",
- as_app_get_id (AS_APP (app)));
- as_app_add_kudo_kind (AS_APP (app), AS_KUDO_KIND_APP_MENU);
- }
- }
- return TRUE;
-}
-
-/**
- * asb_plugin_process_app:
- */
-gboolean
-asb_plugin_process_app (AsbPlugin *plugin,
- AsbPackage *pkg,
- AsbApp *app,
- const gchar *tmpdir,
- GError **error)
-{
- gchar **filelist;
- guint i;
-
- /* already set */
- if (as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_APP_MENU) &&
- as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_MODERN_TOOLKIT))
- return TRUE;
-
- filelist = asb_package_get_filelist (pkg);
- for (i = 0; filelist[i] != NULL; i++) {
- GError *error_local = NULL;
- g_autofree gchar *filename = NULL;
-
- if (!asb_plugin_match_glob ("/usr/bin/*", filelist[i]))
- continue;
- if (as_app_has_kudo_kind (AS_APP (app), AS_KUDO_KIND_APP_MENU))
- break;
- filename = g_build_filename (tmpdir, filelist[i], NULL);
- if (!asb_plugin_nm_app (app, filename, &error_local)) {
- asb_package_log (pkg,
- ASB_PACKAGE_LOG_LEVEL_WARNING,
- "Failed to run nm on %s: %s",
- filename,
- error_local->message);
- g_clear_error (&error_local);
- }
- }
- return TRUE;
-}