diff options
-rw-r--r-- | client/as-builder.c | 7 | ||||
-rw-r--r-- | libappstream-builder/asb-context.c | 34 | ||||
-rw-r--r-- | libappstream-builder/asb-context.h | 2 | ||||
-rw-r--r-- | libappstream-builder/asb-self-test.c | 85 | ||||
-rw-r--r-- | libappstream-builder/asb-utils.c | 67 | ||||
-rw-r--r-- | libappstream-builder/asb-utils.h | 7 |
6 files changed, 0 insertions, 202 deletions
diff --git a/client/as-builder.c b/client/as-builder.c index 1f3f1cb..a46cf68 100644 --- a/client/as-builder.c +++ b/client/as-builder.c @@ -147,7 +147,6 @@ main (int argc, char **argv) _cleanup_free_ gchar *basename = NULL; _cleanup_free_ gchar *cache_dir = NULL; _cleanup_free_ gchar *extra_appdata = NULL; - _cleanup_free_ gchar *extra_appstream = NULL; _cleanup_free_ gchar *extra_screenshots = NULL; _cleanup_free_ gchar *log_dir = NULL; _cleanup_free_ gchar *icons_dir = NULL; @@ -199,9 +198,6 @@ main (int argc, char **argv) { "temp-dir", '\0', 0, G_OPTION_ARG_FILENAME, &temp_dir, /* TRANSLATORS: command line option */ _("Set the temporary directory"), "DIR" }, - { "extra-appstream-dir", '\0', 0, G_OPTION_ARG_FILENAME, &extra_appstream, - /* TRANSLATORS: command line option */ - _("Use extra appstream data"), "DIR" }, { "extra-appdata-dir", '\0', 0, G_OPTION_ARG_FILENAME, &extra_appdata, /* TRANSLATORS: command line option */ _("Use extra appdata data"), "DIR" }, @@ -293,8 +289,6 @@ main (int argc, char **argv) origin = g_strdup ("example"); if (screenshot_uri == NULL) screenshot_uri = g_strdup ("http://www.example.com/screenshots/"); - if (extra_appstream == NULL) - extra_appstream = g_strdup ("./appstream-extra"); if (extra_appdata == NULL) extra_appdata = g_strdup ("./appdata-extra"); if (extra_screenshots == NULL) @@ -304,7 +298,6 @@ main (int argc, char **argv) ctx = asb_context_new (); asb_context_set_api_version (ctx, api_version); asb_context_set_old_metadata (ctx, old_metadata); - asb_context_set_extra_appstream (ctx, extra_appstream); asb_context_set_extra_appdata (ctx, extra_appdata); asb_context_set_extra_screenshots (ctx, extra_screenshots); asb_context_set_screenshot_uri (ctx, screenshot_uri); diff --git a/libappstream-builder/asb-context.c b/libappstream-builder/asb-context.c index 38ee196..d457a14 100644 --- a/libappstream-builder/asb-context.c +++ b/libappstream-builder/asb-context.c @@ -68,7 +68,6 @@ struct _AsbContextPrivate guint min_icon_size; gdouble api_version; gchar *old_metadata; - gchar *extra_appstream; gchar *extra_appdata; gchar *extra_screenshots; gchar *screenshot_uri; @@ -216,23 +215,6 @@ asb_context_set_old_metadata (AsbContext *ctx, const gchar *old_metadata) } /** - * asb_context_set_extra_appstream: - * @ctx: A #AsbContext - * @extra_appstream: directory name, or %NULL - * - * Sets the location of a directory which is used for supplimental AppStream - * files. - * - * Since: 0.1.0 - **/ -void -asb_context_set_extra_appstream (AsbContext *ctx, const gchar *extra_appstream) -{ - AsbContextPrivate *priv = GET_PRIVATE (ctx); - priv->extra_appstream = asb_context_realpath (extra_appstream); -} - -/** * asb_context_set_extra_appdata: * @ctx: A #AsbContext * @extra_appdata: directory name, or %NULL @@ -794,21 +776,6 @@ asb_context_setup (AsbContext *ctx, GError **error) /* get a cache of the file globs */ priv->file_globs = asb_plugin_loader_get_globs (priv->plugin_loader); - /* add any extra applications and resize screenshots */ - if (priv->extra_appstream != NULL && - g_file_test (priv->extra_appstream, G_FILE_TEST_EXISTS)) { - if (!asb_utils_add_apps_from_dir (&priv->apps, - priv->extra_appstream, - error)) - return FALSE; - for (l = priv->apps; l != NULL; l = l->next) { - app = AS_APP (l->data); - if (!asb_context_load_extra_screenshots (ctx, app, error)) - return FALSE; - } - g_print ("Added extra %i apps\n", g_list_length (priv->apps)); - } - /* add old metadata */ if (priv->old_metadata != NULL) { _cleanup_free_ gchar *builder_id = NULL; @@ -1661,7 +1628,6 @@ asb_context_finalize (GObject *object) g_ptr_array_unref (priv->file_globs); g_mutex_clear (&priv->apps_mutex); g_free (priv->old_metadata); - g_free (priv->extra_appstream); g_free (priv->extra_appdata); g_free (priv->extra_screenshots); g_free (priv->screenshot_uri); diff --git a/libappstream-builder/asb-context.h b/libappstream-builder/asb-context.h index c59dc5c..68ad40d 100644 --- a/libappstream-builder/asb-context.h +++ b/libappstream-builder/asb-context.h @@ -107,8 +107,6 @@ void asb_context_set_min_icon_size (AsbContext *ctx, guint min_icon_size); void asb_context_set_old_metadata (AsbContext *ctx, const gchar *old_metadata); -void asb_context_set_extra_appstream (AsbContext *ctx, - const gchar *extra_appstream); void asb_context_set_extra_appdata (AsbContext *ctx, const gchar *extra_appdata); void asb_context_set_extra_screenshots (AsbContext *ctx, diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c index f4a5cc0..8fdd1e4 100644 --- a/libappstream-builder/asb-self-test.c +++ b/libappstream-builder/asb-self-test.c @@ -841,90 +841,6 @@ asb_test_context_oldcache_func (void) } static void -asb_test_context_extra_appstream_func (void) -{ - GError *error = NULL; - gboolean ret; - AsApp *app; - const gchar *expected_xml; - _cleanup_free_ gchar *extra_appdata = NULL; - _cleanup_object_unref_ AsbContext *ctx = NULL; - _cleanup_object_unref_ AsStore *store = NULL; - _cleanup_object_unref_ GFile *file = NULL; - _cleanup_string_free_ GString *xml = NULL; - - ctx = asb_context_new (); - extra_appdata = asb_test_get_filename ("extra-appdata"); - g_assert (extra_appdata != NULL); - asb_context_set_extra_appstream (ctx, extra_appdata); - asb_context_set_max_threads (ctx, 1); - asb_context_set_api_version (ctx, 0.8); - asb_context_set_flags (ctx, ASB_CONTEXT_FLAG_ADD_CACHE_ID | - ASB_CONTEXT_FLAG_NO_NETWORK | - ASB_CONTEXT_FLAG_BATCH_OUTPUT | - ASB_CONTEXT_FLAG_HIDPI_ICONS); - asb_context_set_basename (ctx, "appstream"); - asb_context_set_origin (ctx, "asb-self-test"); - asb_context_set_cache_dir (ctx, "/tmp/asbuilder/cache"); - asb_context_set_output_dir (ctx, "/tmp/asbuilder/output"); - asb_context_set_temp_dir (ctx, "/tmp/asbuilder/temp"); - asb_context_set_icons_dir (ctx, "/tmp/asbuilder/temp/icons"); - ret = asb_context_setup (ctx, &error); - g_assert_no_error (error); - g_assert (ret); - - /* run the plugins */ - ret = asb_context_process (ctx, &error); - g_assert_no_error (error); - g_assert (ret); - - /* check files created */ - g_assert (g_file_test ("/tmp/asbuilder/output/appstream.xml.gz", G_FILE_TEST_EXISTS)); - - /* load AppStream metadata */ - file = g_file_new_for_path ("/tmp/asbuilder/output/appstream.xml.gz"); - store = as_store_new (); - ret = as_store_from_file (store, file, NULL, NULL, &error); - g_assert_no_error (error); - g_assert (ret); - g_assert_cmpint (as_store_get_size (store), ==, 2); - app = as_store_get_app_by_id (store, "epiphany-test.desktop"); - g_assert (app != NULL); - app = as_store_get_app_by_id (store, "epiphany-local.desktop"); - g_assert (app != NULL); - - /* check it matches what we expect */ - xml = as_store_to_xml (store, AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE); - expected_xml = - "<components version=\"0.8\" builder_id=\"appstream-glib:4\" origin=\"asb-self-test\">\n" - "<component type=\"webapp\">\n" - "<id>epiphany-local.desktop</id>\n" - "<name>Local</name>\n" - "<summary>My local webapp</summary>\n" - "<description><p>This is awesome</p></description>\n" - "<icon type=\"local\">/usr/share/icons/hicolor/256x256/apps/fedora-logo-icon.png</icon>\n" - "<url type=\"homepage\">http://www.hughski.com/</url>\n" - "</component>\n" - "<component type=\"webapp\">\n" - "<id>epiphany-test.desktop</id>\n" - "<name>Test</name>\n" - "<summary>Please use my awesome webapp</summary>\n" - "<description><p>This could be awesome</p></description>\n" - "<icon type=\"remote\">http://www.hughski.com/img/logo.png</icon>\n" - "<url type=\"homepage\">http://www.hughski.com/</url>\n" - "</component>\n" - "</components>\n"; - ret = asb_test_compare_lines (xml->str, expected_xml, &error); - g_assert_no_error (error); - g_assert (ret); - - /* remove temp space */ - ret = asb_utils_rmtree ("/tmp/asbuilder", &error); - g_assert_no_error (error); - g_assert (ret); -} - -static void asb_test_firmware_func (void) { AsApp *app; @@ -1058,7 +974,6 @@ main (int argc, char **argv) g_test_add_func ("/AppStreamBuilder/context{no-cache}", asb_test_context_nocache_func); g_test_add_func ("/AppStreamBuilder/context{cache}", asb_test_context_cache_func); g_test_add_func ("/AppStreamBuilder/context{old-cache}", asb_test_context_oldcache_func); - g_test_add_func ("/AppStreamBuilder/context{extra-appstream}", asb_test_context_extra_appstream_func); #ifdef HAVE_RPM g_test_add_func ("/AppStreamBuilder/package{rpm}", asb_test_package_rpm_func); #endif diff --git a/libappstream-builder/asb-utils.c b/libappstream-builder/asb-utils.c index 5f1871b..ca90e62 100644 --- a/libappstream-builder/asb-utils.c +++ b/libappstream-builder/asb-utils.c @@ -538,73 +538,6 @@ asb_utils_write_archive_dir (const gchar *filename, } /** - * asb_utils_add_apps_from_file: - * @apps: (element-type AsbApp): applications - * @filename: XML file to load - * @error: A #GError or %NULL - * - * Add applications from a file. - * - * Returns: %TRUE for success, %FALSE otherwise - * - * Since: 0.1.0 - **/ -gboolean -asb_utils_add_apps_from_file (GList **apps, const gchar *filename, GError **error) -{ - AsApp *app; - GPtrArray *array; - guint i; - _cleanup_object_unref_ AsStore *store = NULL; - _cleanup_object_unref_ GFile *file = NULL; - - /* parse file */ - store = as_store_new (); - file = g_file_new_for_path (filename); - if (!as_store_from_file (store, file, NULL, NULL, error)) - return FALSE; - - /* copy Asapp's into AsbApp's */ - array = as_store_get_apps (store); - for (i = 0; i < array->len; i++) { - app = g_ptr_array_index (array, i); - as_app_set_source_file (app, filename); - asb_plugin_add_app (apps, app); - } - return TRUE; -} - -/** - * asb_utils_add_apps_from_dir: - * @apps: (element-type AsbApp): applications - * @path: path to read - * @error: A #GError or %NULL - * - * Add applications from a directory. - * - * Returns: %TRUE for success, %FALSE otherwise - * - * Since: 0.1.0 - **/ -gboolean -asb_utils_add_apps_from_dir (GList **apps, const gchar *path, GError **error) -{ - const gchar *tmp; - _cleanup_dir_close_ GDir *dir = NULL; - - dir = g_dir_open (path, 0, error); - if (dir == NULL) - return FALSE; - while ((tmp = g_dir_read_name (dir)) != NULL) { - _cleanup_free_ gchar *filename = NULL; - filename = g_build_filename (path, tmp, NULL); - if (!asb_utils_add_apps_from_file (apps, filename, error)) - return FALSE; - } - return TRUE; -} - -/** * asb_string_replace: * @string: Source string * @search: utf8 string to search for diff --git a/libappstream-builder/asb-utils.h b/libappstream-builder/asb-utils.h index 7c927b6..83020e3 100644 --- a/libappstream-builder/asb-utils.h +++ b/libappstream-builder/asb-utils.h @@ -56,13 +56,6 @@ guint asb_string_replace (GString *string, const gchar *search, const gchar *replace); -gboolean asb_utils_add_apps_from_file (GList **apps, - const gchar *filename, - GError **error); -gboolean asb_utils_add_apps_from_dir (GList **apps, - const gchar *path, - GError **error); - G_END_DECLS #endif /* __ASB_UTILS_H */ |