diff options
-rw-r--r-- | data/tests/Makefile.am | 1 | ||||
-rw-r--r-- | data/tests/app-1-1.fc21.x86_64.rpm | bin | 13420 -> 13440 bytes | |||
-rw-r--r-- | data/tests/app-console-1-1.fc21.noarch.rpm | bin | 6748 -> 6764 bytes | |||
-rw-r--r-- | data/tests/app-extra-1-1.fc21.noarch.rpm | bin | 6636 -> 6652 bytes | |||
-rw-r--r-- | data/tests/app.spec | 6 | ||||
-rw-r--r-- | libappstream-builder/asb-context.c | 11 | ||||
-rw-r--r-- | libappstream-builder/asb-self-test.c | 43 |
7 files changed, 57 insertions, 4 deletions
diff --git a/data/tests/Makefile.am b/data/tests/Makefile.am index ff6a4db..a83f9e2 100644 --- a/data/tests/Makefile.am +++ b/data/tests/Makefile.am @@ -4,6 +4,7 @@ test_files = \ alpha-internal1.png \ alpha-internal2.png \ alpha-vert.png \ + app-1-1.fc21.i686.rpm \ app-1-1.fc21.x86_64.rpm \ app-console-1-1.fc21.noarch.rpm \ app-extra-1-1.fc21.noarch.rpm \ diff --git a/data/tests/app-1-1.fc21.x86_64.rpm b/data/tests/app-1-1.fc21.x86_64.rpm Binary files differindex 4abbeee..60011fb 100644 --- a/data/tests/app-1-1.fc21.x86_64.rpm +++ b/data/tests/app-1-1.fc21.x86_64.rpm diff --git a/data/tests/app-console-1-1.fc21.noarch.rpm b/data/tests/app-console-1-1.fc21.noarch.rpm Binary files differindex 96d942e..640d753 100644 --- a/data/tests/app-console-1-1.fc21.noarch.rpm +++ b/data/tests/app-console-1-1.fc21.noarch.rpm diff --git a/data/tests/app-extra-1-1.fc21.noarch.rpm b/data/tests/app-extra-1-1.fc21.noarch.rpm Binary files differindex fb55c28..6e03922 100644 --- a/data/tests/app-extra-1-1.fc21.noarch.rpm +++ b/data/tests/app-extra-1-1.fc21.noarch.rpm diff --git a/data/tests/app.spec b/data/tests/app.spec index 8f13478..349027c 100644 --- a/data/tests/app.spec +++ b/data/tests/app.spec @@ -64,8 +64,10 @@ install -Dp %{SOURCE16} $RPM_BUILD_ROOT/%{_datadir}/applications/console2.deskto %defattr(-,root,root) %doc %{_datadir}/%{name}-%{version}/README %{_bindir}/app.bin -%{_datadir}/appdata/app.*.xml -%{_datadir}/applications/*.desktop +%{_datadir}/appdata/app.appdata.xml +%{_datadir}/appdata/app.metainfo.xml +%{_datadir}/applications/app-demo.desktop +%{_datadir}/applications/app.desktop %{_datadir}/dbus-1/services/app.service %{_datadir}/gir-1.0/app.gir %{_datadir}/gnome-shell/search-providers/search-provider.ini diff --git a/libappstream-builder/asb-context.c b/libappstream-builder/asb-context.c index 80bee91..8789677 100644 --- a/libappstream-builder/asb-context.c +++ b/libappstream-builder/asb-context.c @@ -813,6 +813,17 @@ asb_context_write_xml (AsbContext *ctx, continue; as_store_add_app (store, app); as_store_remove_app (priv->store_failed, app); + + /* remove from the ignore list if the application was useful */ + if (ASB_IS_APP (app)) { + AsbPackage *pkg = asb_app_get_package (ASB_APP (app)); + _cleanup_free_ gchar *name_arch = NULL; + name_arch = g_strdup_printf ("%s.%s", + asb_package_get_name (pkg), + asb_package_get_arch (pkg)); + as_store_remove_app_by_id (priv->store_ignore, name_arch); + } + } filename = g_strdup_printf ("%s/%s.xml.gz", output_dir, basename); file = g_file_new_for_path (filename); diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c index 1e2e6aa..a6bd555 100644 --- a/libappstream-builder/asb-self-test.c +++ b/libappstream-builder/asb-self-test.c @@ -226,6 +226,7 @@ asb_test_context_test_func (AsbTestContextMode mode) _cleanup_free_ gchar *filename2 = NULL; _cleanup_free_ gchar *filename3 = NULL; _cleanup_free_ gchar *filename4 = NULL; + _cleanup_free_ gchar *filename5 = NULL; _cleanup_object_unref_ AsbContext *ctx = NULL; _cleanup_object_unref_ AsStore *store_failed = NULL; _cleanup_object_unref_ AsStore *store_ignore = NULL; @@ -235,6 +236,7 @@ asb_test_context_test_func (AsbTestContextMode mode) _cleanup_object_unref_ GFile *file = NULL; _cleanup_string_free_ GString *xml = NULL; _cleanup_string_free_ GString *xml_failed = NULL; + _cleanup_string_free_ GString *xml_ignore = NULL; /* set up the context */ ctx = asb_context_new (); @@ -295,11 +297,18 @@ asb_test_context_test_func (AsbTestContextMode mode) g_assert_no_error (error); g_assert (ret); + /* the same GUI application in the different architecture */ + filename5 = asb_test_get_filename ("app-1-1.fc21.i686.rpm"); + g_assert (filename5 != NULL); + ret = asb_context_add_filename (ctx, filename5, &error); + g_assert_no_error (error); + g_assert (ret); + /* verify queue size */ switch (mode) { case ASB_TEST_CONTEXT_MODE_NO_CACHE: case ASB_TEST_CONTEXT_MODE_WITH_OLD_CACHE: - g_assert_cmpint (asb_context_get_packages(ctx)->len, ==, 4); + g_assert_cmpint (asb_context_get_packages(ctx)->len, ==, 5); break; default: /* no packages should need extracting */ @@ -476,7 +485,37 @@ asb_test_context_test_func (AsbTestContextMode mode) ret = as_store_from_file (store_ignore, file_ignore, NULL, NULL, &error); g_assert_no_error (error); g_assert (ret); - g_assert_cmpint (as_store_get_size (store_ignore), ==, 2); + + /* check output */ + xml_ignore = as_store_to_xml (store_ignore, AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE); + expected_xml = + "<components version=\"0.8\" builder_id=\"appstream-glib:4\" origin=\"asb-self-test-ignore\">\n" + "<component>\n" + "<id>app-console.noarch</id>\n" + "<pkgname>app-console</pkgname>\n" + "<metadata>\n" + "<value key=\"X-CacheID\">app-console-1-1.fc21.noarch.rpm</value>\n" + "</metadata>\n" + "</component>\n" + "<component>\n" + "<id>app.i686</id>\n" + "<pkgname>app</pkgname>\n" + "<metadata>\n" + "<value key=\"X-CacheID\">app-1-1.fc21.i686.rpm</value>\n" + "</metadata>\n" + "</component>\n" + "<component>\n" + "<id>test.noarch</id>\n" + "<pkgname>test</pkgname>\n" + "<metadata>\n" + "<value key=\"X-CacheID\">test-0.1-1.fc21.noarch.rpm</value>\n" + "</metadata>\n" + "</component>\n" + "</components>\n"; + if (g_strcmp0 (xml_ignore->str, expected_xml) != 0) + g_warning ("Expected:\n%s\nGot:\n%s", expected_xml, xml_ignore->str); + g_assert_cmpstr (xml_ignore->str, ==, expected_xml); + } #endif |