diff options
author | Richard Hughes <richard@hughsie.com> | 2016-01-27 19:09:51 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-01-27 19:20:39 +0000 |
commit | 66fb0cb132ea26e4b16de28d782e858816cde68c (patch) | |
tree | 81f44e5b33bcc9c04419b6d1c338010de677b580 | |
parent | 3a849a787659e51f1d0ae5caccef3517d44518c3 (diff) | |
download | appstream-glib-66fb0cb132ea26e4b16de28d782e858816cde68c.tar.gz |
Remove support for Ubuntu app-install data
This is not maintained *at all* and Ubuntu is soon to be shipping AppStream.
-rw-r--r-- | data/tests/Makefile.am | 2 | ||||
-rw-r--r-- | data/tests/usr/share/app-install/desktop/test.desktop | 17 | ||||
-rw-r--r-- | data/tests/usr/share/app-install/icons/test.png | bin | 215 -> 0 bytes | |||
-rw-r--r-- | libappstream-glib/as-self-test.c | 64 | ||||
-rw-r--r-- | libappstream-glib/as-store.c | 172 | ||||
-rw-r--r-- | libappstream-glib/as-store.h | 2 |
6 files changed, 9 insertions, 248 deletions
diff --git a/data/tests/Makefile.am b/data/tests/Makefile.am index 42cd208..426373e 100644 --- a/data/tests/Makefile.am +++ b/data/tests/Makefile.am @@ -40,9 +40,7 @@ test_files = \ test-0.1-1.fc21.noarch.rpm \ translated.appdata.xml \ usr/share/appdata/broken.appdata.xml \ - usr/share/app-install/desktop/test.desktop \ usr/share/app-install/icons/aequorea/iceweasel.png \ - usr/share/app-install/icons/test.png \ usr/share/applications/broken.desktop \ usr/share/applications/test.desktop \ usr/share/icons/hicolor/64x64/apps/test2.png \ diff --git a/data/tests/usr/share/app-install/desktop/test.desktop b/data/tests/usr/share/app-install/desktop/test.desktop deleted file mode 100644 index 8b1b0cd..0000000 --- a/data/tests/usr/share/app-install/desktop/test.desktop +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2014 Richard Hughes <richard@hughsie.com> - -[Desktop Entry] -X-AppInstall-Package=testpkg -X-AppInstall-Popcon=1 -X-AppInstall-Section=cosmos - -Version=1.0 -Name=Test -Comment=A test program -Exec=test -Icon=test -Terminal=false -Type=Application -Categories=Game; - -X-Ubuntu-Gettext-Domain=app-install-data diff --git a/data/tests/usr/share/app-install/icons/test.png b/data/tests/usr/share/app-install/icons/test.png Binary files differdeleted file mode 100644 index 41199a6..0000000 --- a/data/tests/usr/share/app-install/icons/test.png +++ /dev/null diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c index 81ccc81..2fc1ea8 100644 --- a/libappstream-glib/as-self-test.c +++ b/libappstream-glib/as-self-test.c @@ -1808,52 +1808,6 @@ as_test_app_validate_meta_bad_func (void) } static void -as_test_store_local_app_install_func (void) -{ - AsApp *app; - AsIcon *ic; - GError *error = NULL; - gboolean ret; - g_autofree gchar *filename = NULL; - g_autofree gchar *source_file = NULL; - g_autoptr(AsStore) store = NULL; - - /* open test store */ - store = as_store_new (); - filename = as_test_get_filename ("."); - as_store_set_destdir (store, filename); - ret = as_store_load (store, AS_STORE_LOAD_FLAG_APP_INSTALL, NULL, &error); - g_assert_no_error (error); - g_assert (ret); - g_assert_cmpint (as_store_get_size (store), ==, 1); - - /* make sure app is valid */ - app = as_store_get_app_by_id (store, "test.desktop"); - g_assert (app != NULL); - g_assert_cmpstr (as_app_get_name (app, "C"), ==, "Test"); - g_assert_cmpstr (as_app_get_comment (app, "C"), ==, "A test program"); - g_assert_cmpint (as_app_get_source_kind (app), ==, AS_APP_SOURCE_KIND_APPSTREAM); - - /* get the new name too */ - app = as_store_get_app_by_id_with_fallbacks (store, "test.desktop"); - g_assert (app != NULL); - - /* check icons */ - g_assert_cmpint (as_app_get_icons(app)->len, ==, 1); - ic = as_app_get_icon_default (app); - g_assert (ic != NULL); - g_assert_cmpstr (as_icon_get_name (ic), ==, "test"); - g_assert_cmpint (as_icon_get_kind (ic), ==, AS_ICON_KIND_LOCAL); - g_assert_cmpint (as_icon_get_width (ic), ==, 0); - g_assert_cmpint (as_icon_get_height (ic), ==, 0); - - /* ensure we reference the correct file */ - source_file = g_build_filename (filename, "/usr", "share", "app-install", - "desktop", "test.desktop", NULL); - g_assert_cmpstr (as_app_get_source_file (app), ==, source_file); -} - -static void as_test_store_local_appdata_func (void) { AsApp *app; @@ -3887,22 +3841,6 @@ as_test_utils_version_func (void) } static void -as_test_store_app_install_func (void) -{ - GError *error = NULL; - gboolean ret; - g_autoptr(AsStore) store = NULL; - - store = as_store_new (); - ret = as_store_load (store, - AS_STORE_LOAD_FLAG_APP_INSTALL, - NULL, - &error); - g_assert_no_error (error); - g_assert (ret); -} - -static void as_test_store_metadata_func (void) { GError *error = NULL; @@ -4651,14 +4589,12 @@ main (int argc, char **argv) g_test_add_func ("/AppStream/store{addons}", as_test_store_addons_func); g_test_add_func ("/AppStream/store{versions}", as_test_store_versions_func); g_test_add_func ("/AppStream/store{origin}", as_test_store_origin_func); - g_test_add_func ("/AppStream/store{app-install}", as_test_store_app_install_func); g_test_add_func ("/AppStream/store{yaml}", as_test_store_yaml_func); g_test_add_func ("/AppStream/store{metadata}", as_test_store_metadata_func); g_test_add_func ("/AppStream/store{metadata-index}", as_test_store_metadata_index_func); g_test_add_func ("/AppStream/store{validate}", as_test_store_validate_func); g_test_add_func ("/AppStream/store{embedded}", as_test_store_embedded_func); g_test_add_func ("/AppStream/store{provides}", as_test_store_provides_func); - g_test_add_func ("/AppStream/store{local-app-install}", as_test_store_local_app_install_func); g_test_add_func ("/AppStream/store{local-appdata}", as_test_store_local_appdata_func); g_test_add_func ("/AppStream/store{speed-appstream}", as_test_store_speed_appstream_func); g_test_add_func ("/AppStream/store{speed-appdata}", as_test_store_speed_appdata_func); diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c index d7c28ed..f332f1d 100644 --- a/libappstream-glib/as-store.c +++ b/libappstream-glib/as-store.c @@ -1090,12 +1090,6 @@ as_store_remove_by_source_file (AsStore *store, const gchar *filename) as_store_perhaps_emit_changed (store, "remove-by-source-file"); } -static gboolean -as_store_load_app_install_file (AsStore *store, - const gchar *filename, - const gchar *path_icons, - GError **error); - /** * as_store_monitor_changed_cb: */ @@ -1109,20 +1103,14 @@ as_store_monitor_changed_cb (AsMonitor *monitor, /* reload, or emit a signal */ if (priv->watch_flags & AS_STORE_WATCH_FLAG_ADDED) { g_autoptr(GError) error = NULL; + g_autoptr(GFile) file = NULL; _cleanup_uninhibit_ guint32 *tok = NULL; tok = as_store_changed_inhibit (store); as_store_remove_by_source_file (store, filename); g_debug ("rescanning %s", filename); - if (g_str_has_suffix (filename, ".desktop")) { - if (!as_store_load_app_install_file (store, filename, - NULL, &error)) - g_warning ("failed to rescan: %s", error->message); - } else { - g_autoptr(GFile) file = NULL; - file = g_file_new_for_path (filename); - if (!as_store_from_file (store, file, NULL, NULL, &error)) - g_warning ("failed to rescan: %s", error->message); - } + file = g_file_new_for_path (filename); + if (!as_store_from_file (store, file, NULL, NULL, &error)) + g_warning ("failed to rescan: %s", error->message); } as_store_perhaps_emit_changed (store, "file changed"); } @@ -1140,17 +1128,11 @@ as_store_monitor_added_cb (AsMonitor *monitor, /* reload, or emit a signal */ if (priv->watch_flags & AS_STORE_WATCH_FLAG_ADDED) { g_autoptr(GError) error = NULL; + g_autoptr(GFile) file = NULL; g_debug ("scanning %s", filename); - if (g_str_has_suffix (filename, ".desktop")) { - if (!as_store_load_app_install_file (store, filename, - NULL, &error)) - g_warning ("failed to rescan: %s", error->message); - } else { - g_autoptr(GFile) file = NULL; - file = g_file_new_for_path (filename); - if (!as_store_from_file (store, file, NULL, NULL, &error)) - g_warning ("failed to rescan: %s", error->message); - } + file = g_file_new_for_path (filename); + if (!as_store_from_file (store, file, NULL, NULL, &error)) + g_warning ("failed to rescan: %s", error->message); } else { as_store_perhaps_emit_changed (store, "file added"); } @@ -1869,135 +1851,6 @@ as_store_load_app_info (AsStore *store, } /** - * as_store_add_app_install_screenshot: - **/ -static void -as_store_add_app_install_screenshot (AsApp *app) -{ - GPtrArray *pkgnames; - const gchar *pkgname; - g_autofree gchar *url = NULL; - g_autoptr(AsImage) im = NULL; - g_autoptr(AsScreenshot) ss = NULL; - - /* get the default package name */ - pkgnames = as_app_get_pkgnames (app); - if (pkgnames->len == 0) - return; - pkgname = g_ptr_array_index (pkgnames, 0); - url = g_build_filename ("http://screenshots.debian.net/screenshot", - pkgname, NULL); - - /* screenshots.debian.net doesn't specify a size, so this is a guess */ - im = as_image_new (); - as_image_set_url (im, url); - as_image_set_width (im, 800); - as_image_set_height (im, 600); - - /* add screenshot without a caption */ - ss = as_screenshot_new (); - as_screenshot_add_image (ss, im); - as_app_add_screenshot (app, ss); -} - -/** - * as_store_load_app_install_file: - **/ -static gboolean -as_store_load_app_install_file (AsStore *store, - const gchar *filename, - const gchar *path_icons, - GError **error) -{ - AsIcon *icon; - GPtrArray *icons; - guint i; - g_autoptr(GError) error_local = NULL; - g_autoptr(AsApp) app = NULL; - - app = as_app_new (); - as_app_set_icon_path (app, path_icons); - if (!as_app_parse_file (app, - filename, - AS_APP_PARSE_FLAG_USE_HEURISTICS, - &error_local)) { - if (g_error_matches (error_local, - AS_APP_ERROR, - AS_APP_ERROR_INVALID_TYPE)) { - /* Ubuntu include non-apps here too... */ - return TRUE; - } - g_set_error (error, - AS_STORE_ERROR, - AS_STORE_ERROR_FAILED, - "Failed to parse %s: %s", - filename, - error_local->message); - return FALSE; - } - - /* convert all the icons */ - icons = as_app_get_icons (app); - for (i = 0; i < icons->len; i++) { - icon = g_ptr_array_index (icons, i); - if (as_icon_get_kind (icon) == AS_ICON_KIND_UNKNOWN) - as_icon_set_kind (icon, AS_ICON_KIND_CACHED); - } - as_store_add_app_install_screenshot (app); - as_store_add_app (store, app); - - /* this isn't strictly true, but setting it AS_APP_SOURCE_KIND_DESKTOP - * means that it's considered installed by the front-end */ - as_app_set_source_kind (app, AS_APP_SOURCE_KIND_APPSTREAM); - - return TRUE; -} - -/** - * as_store_load_app_install: - **/ -static gboolean -as_store_load_app_install (AsStore *store, - const gchar *path, - GCancellable *cancellable, - GError **error) -{ - const gchar *tmp; - g_autoptr(GDir) dir = NULL; - g_autoptr(GError) error_local = NULL; - g_autofree gchar *path_desktop = NULL; - g_autofree gchar *path_icons = NULL; - - path_desktop = g_build_filename (path, "desktop", NULL); - if (!g_file_test (path_desktop, G_FILE_TEST_EXISTS)) - return TRUE; - dir = g_dir_open (path_desktop, 0, &error_local); - if (dir == NULL) { - g_set_error (error, - AS_STORE_ERROR, - AS_STORE_ERROR_FAILED, - "Failed to open %s: %s", - path_desktop, - error_local->message); - return FALSE; - } - - path_icons = g_build_filename (path, "icons", NULL); - while ((tmp = g_dir_read_name (dir)) != NULL) { - g_autofree gchar *filename = NULL; - if (!g_str_has_suffix (tmp, ".desktop")) - continue; - filename = g_build_filename (path_desktop, tmp, NULL); - if (!as_store_load_app_install_file (store, - filename, - path_icons, - error)) - return FALSE; - } - return TRUE; -} - -/** * as_store_set_app_installed: **/ static void @@ -2316,15 +2169,6 @@ as_store_load (AsStore *store, return FALSE; } - /* ubuntu specific */ - if ((flags & AS_STORE_LOAD_FLAG_APP_INSTALL) > 0) { - g_autofree gchar *dest = NULL; - dest = g_build_filename (priv->destdir ? priv->destdir : "/", - "/usr/share/app-install", NULL); - if (!as_store_load_app_install (store, dest, cancellable, error)) - return FALSE; - } - /* match again, for applications extended from different roots */ as_store_match_addons (store); diff --git a/libappstream-glib/as-store.h b/libappstream-glib/as-store.h index ccfe9d8..8d9caec 100644 --- a/libappstream-glib/as-store.h +++ b/libappstream-glib/as-store.h @@ -56,7 +56,7 @@ struct _AsStoreClass * @AS_STORE_LOAD_FLAG_NONE: No extra flags to use * @AS_STORE_LOAD_FLAG_APP_INFO_SYSTEM: The system app-info AppStream data * @AS_STORE_LOAD_FLAG_APP_INFO_USER: The per-user app-info AppStream data - * @AS_STORE_LOAD_FLAG_APP_INSTALL: The ubuntu-specific app-install data + * @AS_STORE_LOAD_FLAG_APP_INSTALL: The ubuntu-specific app-install data (obsolete) * @AS_STORE_LOAD_FLAG_APPDATA: The installed AppData files * @AS_STORE_LOAD_FLAG_DESKTOP: The installed desktop files * @AS_STORE_LOAD_FLAG_ALLOW_VETO: Add vetoed applications |