From 2d201f9bf76c231271f312ed45eff2fe70bf80c1 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 26 Oct 2017 20:10:29 +0200 Subject: extra/appstream-glib: added patch to make testing pass --- extra/appstream-glib/PKGBUILD | 10 + .../appstream-glib-0.7.2-aptest.patch | 242 +++++++++++++++++++++ 2 files changed, 252 insertions(+) create mode 100644 extra/appstream-glib/PKGBUILD create mode 100644 extra/appstream-glib/appstream-glib-0.7.2-aptest.patch (limited to 'extra') diff --git a/extra/appstream-glib/PKGBUILD b/extra/appstream-glib/PKGBUILD new file mode 100644 index 00000000..2256adbe --- /dev/null +++ b/extra/appstream-glib/PKGBUILD @@ -0,0 +1,10 @@ +source+=('appstream-glib-0.7.2-aptest.patch') +sha256sums+=('de5ca5f21e19f9d6ecb361c39c850cbfee9307049a82436ff0f14f360f525307') + +eval "$( + declare -f prepare | \ + sed ' + /}/ i \ + patch -Np1 -i "$srcdir/appstream-glib-0.7.2-aptest.patch" + ' +)" diff --git a/extra/appstream-glib/appstream-glib-0.7.2-aptest.patch b/extra/appstream-glib/appstream-glib-0.7.2-aptest.patch new file mode 100644 index 00000000..17b45070 --- /dev/null +++ b/extra/appstream-glib/appstream-glib-0.7.2-aptest.patch @@ -0,0 +1,242 @@ +diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c +index c13ed85..62ceeae 100644 +--- a/libappstream-builder/asb-self-test.c ++++ b/libappstream-builder/asb-self-test.c +@@ -491,6 +491,7 @@ asb_test_context_func (void) + "\n" + "org.freedesktop.AppStream\n" + "\n" ++ "app.desktop\n" + "\n" + "en_GB\n" + "ru\n" +diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c +index 488fd09..7f19b9b 100644 +--- a/libappstream-glib/as-app.c ++++ b/libappstream-glib/as-app.c +@@ -4635,7 +4635,7 @@ as_app_node_insert (AsApp *app, GNode *parent, AsNodeContext *ctx) + } + + /* */ +- if (priv->launchables->len > 0 && as_node_context_get_version (ctx) > 0.9) { ++ if (priv->launchables->len > 0) { + g_ptr_array_sort (priv->launchables, as_app_launchables_sort_cb); + for (i = 0; i < priv->launchables->len; i++) { + AsLaunchable *launchable = g_ptr_array_index (priv->launchables, i); +diff --git a/libappstream-glib/as-icon.c b/libappstream-glib/as-icon.c +index 9fc3ba7..8a13ae0 100644 +--- a/libappstream-glib/as-icon.c ++++ b/libappstream-glib/as-icon.c +@@ -513,11 +513,9 @@ as_icon_node_insert_embedded (AsIcon *icon, GNode *parent, AsNodeContext *ctx) + n = as_node_insert (parent, "icon", NULL, 0, + "type", as_icon_kind_to_string (priv->kind), + NULL); +- if (as_node_context_get_version (ctx) >= 0.8) { +- as_node_add_attribute_as_uint (n, "width", priv->width); +- as_node_add_attribute_as_uint (n, "height", priv->height); +- } +- if (priv->scale > 1 && as_node_context_get_version (ctx) > 0.9) ++ as_node_add_attribute_as_uint (n, "width", priv->width); ++ as_node_add_attribute_as_uint (n, "height", priv->height); ++ if (priv->scale > 1) + as_node_add_attribute_as_uint (n, "scale", priv->scale); + as_node_insert (n, "name", priv->name, 0, NULL); + data = g_base64_encode (g_bytes_get_data (priv->data, NULL), +@@ -575,8 +573,7 @@ as_icon_node_insert (AsIcon *icon, GNode *parent, AsNodeContext *ctx) + } + break; + } +- if (priv->kind == AS_ICON_KIND_CACHED && +- as_node_context_get_version (ctx) >= 0.8) { ++ if (priv->kind == AS_ICON_KIND_CACHED) { + if (priv->width > 0) + as_node_add_attribute_as_uint (n, "width", priv->width); + if (priv->height > 0) +diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c +index 833ec6a..3ccefaa 100644 +--- a/libappstream-glib/as-release.c ++++ b/libappstream-glib/as-release.c +@@ -645,7 +645,6 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx) + AsReleasePrivate *priv = GET_PRIVATE (release); + AsChecksum *checksum; + GNode *n; +- guint i; + + n = as_node_insert (parent, "release", NULL, + AS_NODE_INSERT_FLAG_NONE, +@@ -667,19 +666,16 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx) + } + if (priv->version != NULL) + as_node_add_attribute (n, "version", priv->version); +- if (as_node_context_get_version (ctx) >= 0.9) { +- const gchar *tmp; +- for (i = 0; priv->locations != NULL && i < priv->locations->len; i++) { +- tmp = g_ptr_array_index (priv->locations, i); +- as_node_insert (n, "location", tmp, +- AS_NODE_INSERT_FLAG_NONE, NULL); +- } +- for (i = 0; priv->checksums != NULL && i < priv->checksums->len; i++) { +- checksum = g_ptr_array_index (priv->checksums, i); +- as_checksum_node_insert (checksum, n, ctx); +- } ++ for (guint i = 0; priv->locations != NULL && i < priv->locations->len; i++) { ++ const gchar *tmp = g_ptr_array_index (priv->locations, i); ++ as_node_insert (n, "location", tmp, ++ AS_NODE_INSERT_FLAG_NONE, NULL); ++ } ++ for (guint i = 0; priv->checksums != NULL && i < priv->checksums->len; i++) { ++ checksum = g_ptr_array_index (priv->checksums, i); ++ as_checksum_node_insert (checksum, n, ctx); + } +- if (priv->descriptions != NULL && as_node_context_get_version (ctx) >= 0.6) { ++ if (priv->descriptions != NULL) { + as_node_insert_localized (n, "description", priv->descriptions, + AS_NODE_INSERT_FLAG_PRE_ESCAPED | + AS_NODE_INSERT_FLAG_DEDUPE_LANG); +@@ -687,7 +683,7 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx) + + /* add sizes */ + if (priv->sizes != NULL) { +- for (i = 0; i < AS_SIZE_KIND_LAST; i++) { ++ for (guint i = 0; i < AS_SIZE_KIND_LAST; i++) { + g_autofree gchar *size_str = NULL; + if (priv->sizes[i] == 0) + continue; +diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c +index 65ce4e7..327b20a 100644 +--- a/libappstream-glib/as-screenshot.c ++++ b/libappstream-glib/as-screenshot.c +@@ -436,15 +436,13 @@ as_screenshot_node_insert (AsScreenshot *screenshot, + as_node_add_attribute (n, "type", + as_screenshot_kind_to_string (priv->kind)); + } +- if (as_node_context_get_version (ctx) >= 0.41) { +- if (priv->captions != NULL) { +- as_node_insert_localized (n, +- "caption", +- priv->captions, +- AS_NODE_INSERT_FLAG_DEDUPE_LANG); +- } ++ if (priv->captions != NULL) { ++ as_node_insert_localized (n, ++ "caption", ++ priv->captions, ++ AS_NODE_INSERT_FLAG_DEDUPE_LANG); + } +- if (as_node_context_get_version (ctx) >= 0.8 && priv->priority != 0) ++ if (priv->priority != 0) + as_node_add_attribute_as_int (n, "priority", priv->priority); + for (i = 0; i < priv->images->len; i++) { + image = g_ptr_array_index (priv->images, i); +diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c +index b73a528..d8b4889 100644 +--- a/libappstream-glib/as-self-test.c ++++ b/libappstream-glib/as-self-test.c +@@ -968,7 +968,7 @@ as_test_icon_func (void) + as_node_context_set_version (ctx, 0.4); + n = as_icon_node_insert (icon, root, ctx); + xml = as_node_to_xml (n, AS_NODE_TO_XML_FLAG_NONE); +- ret = as_test_compare_lines (xml->str, src, &error); ++ ret = as_test_compare_lines (xml->str, "app.png", &error); + g_assert_no_error (error); + g_assert (ret); + g_string_free (xml, TRUE); +@@ -1098,7 +1098,7 @@ as_test_icon_embedded_func (void) + AsNode *root; + GString *xml; + const gchar *src = +-"app.png" ++"app.png" + "\n" + "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJ\n" + "TUUH1gsaCxQZBldDDAAACLxJREFUWIW9lmtsHNUVx/8zd3Zm9uFd73ptZ/3Gid+OoUlwyAscSJw4\n" +@@ -2465,6 +2465,7 @@ as_test_app_no_markup_func (void) + "\n" + "org.gnome.Software.desktop\n" + "Software is awesome:\n\n * Bada\n * Boom!\n" ++ "org.gnome.Software.desktop\n" + "\n"; + g_autoptr(AsNodeContext) ctx = NULL; + g_autoptr(AsApp) app = NULL; +@@ -3038,7 +3039,7 @@ as_test_store_embedded_func (void) + "eog.desktop" + "eog" + "Image Viewer" +-"" ++"" + "eog.png" + "\n" + "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJ\n" +@@ -3084,6 +3085,7 @@ as_test_store_embedded_func (void) + "xxVXYLZ16ADU690D3JzxXLG581caBWBep/71278AZpn8hFce4VcAAAAASUVORK5CYII=\n" + "" + "" ++"eog.desktop" + "" + ""; + +@@ -3909,30 +3911,12 @@ as_test_store_versions_func (void) + "

Hello

\n" + "\n" + "\n" ++ "test.desktop\n" + "\n" + "\n", &error); + g_assert_no_error (error); + g_assert (ret); + g_string_free (xml, TRUE); +- +- /* test with legacy options */ +- as_store_set_api_version (store, 0.6); +- xml = as_store_to_xml (store, 0); +- g_assert_cmpstr (xml->str, ==, +- "" +- "" +- "test.desktop" +- "

Hello world

" +- "i386" +- "" +- "" +- "

Hello

" +- "
" +- "
" +- "
" +- "
"); +- g_string_free (xml, TRUE); +- + g_object_unref (store); + + /* load a version 0.6 file to the store */ +@@ -3952,6 +3936,7 @@ as_test_store_versions_func (void) + "" + "" + "test.desktop" ++ "test.desktop" + "" + ""); + g_string_free (xml, TRUE); +@@ -3977,6 +3962,7 @@ as_test_store_addons_func (void) + "" + "" + "eclipse.desktop" ++ "eclipse.desktop" + "" + ""; + g_autoptr(AsStore) store = NULL; +@@ -4059,6 +4045,7 @@ as_test_node_no_dup_c_func (void) + "" + "test.desktop" + "Krita" ++ "test.desktop" + ""); + g_string_free (xml, TRUE); + as_node_unref (root); +@@ -4868,7 +4855,7 @@ as_test_store_yaml_func (void) + "iceweasel.desktop\n" + "iceweasel\n" + "Iceweasel\n" +- "iceweasel.png\n" ++ "iceweasel.png\n" + "\n" + "browser\n" + "\n" -- cgit v1.2.3-70-g09d2