diff options
-rw-r--r-- | libappstream-builder/asb-plugin-loader.c | 17 | ||||
-rw-r--r-- | libappstream-builder/asb-plugin.h | 1 | ||||
-rw-r--r-- | libappstream-builder/plugins/asb-plugin-appdata.c | 19 |
3 files changed, 31 insertions, 6 deletions
diff --git a/libappstream-builder/asb-plugin-loader.c b/libappstream-builder/asb-plugin-loader.c index 7e070dc..6be613e 100644 --- a/libappstream-builder/asb-plugin-loader.c +++ b/libappstream-builder/asb-plugin-loader.c @@ -169,6 +169,7 @@ asb_plugin_loader_process_app (AsbPluginLoader *plugin_loader, AsbPluginLoaderPrivate *priv = GET_PRIVATE (plugin_loader); AsbPlugin *plugin; AsbPluginProcessAppFunc plugin_func = NULL; + GError *error_local = NULL; gboolean ret; guint i; @@ -184,8 +185,20 @@ asb_plugin_loader_process_app (AsbPluginLoader *plugin_loader, ASB_PACKAGE_LOG_LEVEL_DEBUG, "Running asb_plugin_process_app() from %s", plugin->name); - if (!plugin_func (plugin, pkg, app, tmpdir, error)) - return FALSE; + if (!plugin_func (plugin, pkg, app, tmpdir, &error_local)) { + if (g_error_matches (error_local, + ASB_PLUGIN_ERROR, + ASB_PLUGIN_ERROR_IGNORE)) { + asb_package_log (pkg, + ASB_PACKAGE_LOG_LEVEL_WARNING, + "Ignoring: %s", + error_local->message); + g_clear_error (&error_local); + } else { + g_propagate_error (error, error_local); + return FALSE; + } + } } return TRUE; } diff --git a/libappstream-builder/asb-plugin.h b/libappstream-builder/asb-plugin.h index 0b889fc..f1b7c8e 100644 --- a/libappstream-builder/asb-plugin.h +++ b/libappstream-builder/asb-plugin.h @@ -50,6 +50,7 @@ struct AsbPlugin { typedef enum { ASB_PLUGIN_ERROR_FAILED, ASB_PLUGIN_ERROR_NOT_SUPPORTED, + ASB_PLUGIN_ERROR_IGNORE, ASB_PLUGIN_ERROR_LAST } AsbPluginError; diff --git a/libappstream-builder/plugins/asb-plugin-appdata.c b/libappstream-builder/plugins/asb-plugin-appdata.c index f134fce..0d58cac 100644 --- a/libappstream-builder/plugins/asb-plugin-appdata.c +++ b/libappstream-builder/plugins/asb-plugin-appdata.c @@ -502,6 +502,7 @@ asb_plugin_process_app (AsbPlugin *plugin, const gchar *tmpdir, GError **error) { + GError *error_local = NULL; const gchar *kind_str; const gchar *tmp; _cleanup_free_ gchar *appdata_basename = NULL; @@ -545,10 +546,20 @@ asb_plugin_process_app (AsbPlugin *plugin, /* any installed appdata file */ if (g_file_test (appdata_filename, G_FILE_TEST_EXISTS)) { - return asb_plugin_process_filename (plugin, - app, - appdata_filename, - error); + /* be understanding if upstream gets the AppData file + * wrong -- just fall back to the desktop file data */ + if (!asb_plugin_process_filename (plugin, + app, + appdata_filename, + &error_local)) { + error_local->code = ASB_PLUGIN_ERROR_IGNORE; + g_propagate_error (error, error_local); + g_prefix_error (error, + "AppData file '%s' invalid: ", + appdata_filename); + return FALSE; + } + return TRUE; } /* we're going to require this soon */ |