mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
glib now needs to be built in two stages, first without gobject introspection and then a second build with introspection. Also enable and fix tests ref: https://gitlab.gnome.org/GNOME/glib/-/issues/3317 ref: https://gitlab.gnome.org/GNOME/glib/-/blob/main/NEWS?ref_type=heads#L296
458 lines
13 KiB
Diff
458 lines
13 KiB
Diff
From 01304c97693a7c789bde9c543979872fc63c387c Mon Sep 17 00:00:00 2001
|
|
From: Natanael Copa <ncopa@alpinelinux.org>
|
|
Date: Wed, 3 Apr 2024 21:11:24 +0200
|
|
Subject: [PATCH 1/3] tests: skip test that requires shared-mime-info when its
|
|
missing
|
|
|
|
shared-mime-info required glib to build and will not be there during
|
|
bootstrap. Skip the test if it is missing.
|
|
|
|
ref: https://gitlab.gnome.org/GNOME/glib/-/issues/3317
|
|
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
---
|
|
gio/tests/contenttype.c | 47 +++++++++++++++++++++++++++++++++++++++--
|
|
1 file changed, 45 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/gio/tests/contenttype.c b/gio/tests/contenttype.c
|
|
index 8784374f2..b442d5352 100644
|
|
--- a/gio/tests/contenttype.c
|
|
+++ b/gio/tests/contenttype.c
|
|
@@ -13,6 +13,20 @@
|
|
__s1, " == ", __s2); \
|
|
} while (0)
|
|
|
|
+static gboolean
|
|
+skip_missing_shared_mime_info (void)
|
|
+{
|
|
+ const gchar *path = g_find_program_in_path("update-mime-database");
|
|
+
|
|
+ if (path == NULL)
|
|
+ {
|
|
+ g_test_skip ("shared-mime-info is required to run this test");
|
|
+ return TRUE;
|
|
+ }
|
|
+ g_free(path);
|
|
+ return FALSE;
|
|
+}
|
|
+
|
|
static void
|
|
test_guess (void)
|
|
{
|
|
@@ -26,6 +40,9 @@ test_guess (void)
|
|
"Name=appinfo-test\n"
|
|
"Exec=./appinfo-test --option\n";
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
#ifdef G_OS_WIN32
|
|
existing_directory = (gchar *) g_getenv ("SYSTEMROOT");
|
|
|
|
@@ -150,6 +167,9 @@ test_subtype (void)
|
|
gchar *plain;
|
|
gchar *xml;
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
plain = g_content_type_from_mime_type ("text/plain");
|
|
xml = g_content_type_from_mime_type ("application/xml");
|
|
|
|
@@ -175,6 +195,9 @@ test_list (void)
|
|
gchar *plain;
|
|
gchar *xml;
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
#ifdef __APPLE__
|
|
g_test_skip ("The OSX backend does not implement g_content_types_get_registered()");
|
|
return;
|
|
@@ -202,6 +225,9 @@ test_executable (void)
|
|
{
|
|
gchar *type;
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
#ifdef G_OS_WIN32
|
|
type = g_content_type_from_mime_type ("application/vnd.microsoft.portable-executable");
|
|
/* FIXME: the MIME is not in the default `MIME\Database\Content Type` registry.
|
|
@@ -228,6 +254,9 @@ test_description (void)
|
|
gchar *type;
|
|
gchar *desc;
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
type = g_content_type_from_mime_type ("text/plain");
|
|
desc = g_content_type_get_description (type);
|
|
g_assert_nonnull (desc);
|
|
@@ -242,6 +271,9 @@ test_icon (void)
|
|
gchar *type;
|
|
GIcon *icon;
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
type = g_content_type_from_mime_type ("text/plain");
|
|
icon = g_content_type_get_icon (type);
|
|
g_assert_true (G_IS_ICON (icon));
|
|
@@ -290,6 +322,9 @@ test_symbolic_icon (void)
|
|
gchar *type;
|
|
GIcon *icon;
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
type = g_content_type_from_mime_type ("text/plain");
|
|
icon = g_content_type_get_symbolic_icon (type);
|
|
g_assert_true (G_IS_ICON (icon));
|
|
@@ -344,6 +379,9 @@ test_tree (void)
|
|
gchar **types;
|
|
gsize i;
|
|
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
#if defined(__APPLE__) || defined(G_OS_WIN32)
|
|
g_test_skip ("The OSX & Windows backends do not implement g_content_type_guess_for_tree()");
|
|
return;
|
|
@@ -437,8 +475,13 @@ test_guess_svg_from_data (void)
|
|
</svg>\n";
|
|
|
|
gboolean uncertain = TRUE;
|
|
- gchar *res = g_content_type_guess (NULL, (guchar *)svgfilecontent,
|
|
- sizeof (svgfilecontent) - 1, &uncertain);
|
|
+ gchar *res;
|
|
+
|
|
+ if (skip_missing_shared_mime_info ())
|
|
+ return;
|
|
+
|
|
+ res = g_content_type_guess (NULL, (guchar *)svgfilecontent,
|
|
+ sizeof (svgfilecontent) - 1, &uncertain);
|
|
#ifdef __APPLE__
|
|
g_assert_cmpstr (res, ==, "public.svg-image");
|
|
#elif defined(G_OS_WIN32)
|
|
--
|
|
2.44.0
|
|
|
|
|
|
From a77fdc4cae8deb7ef9f47e81f81a8db139434093 Mon Sep 17 00:00:00 2001
|
|
From: Natanael Copa <ncopa@alpinelinux.org>
|
|
Date: Thu, 4 Apr 2024 17:08:46 +0200
|
|
Subject: [PATCH 2/3] tests: skip tests that requires dbus-daemon when its
|
|
missing
|
|
|
|
dbus may not be built yet during bootstrap, because it needs glib to
|
|
build.
|
|
|
|
Ref: https://gitlab.gnome.org/GNOME/glib/-/issues/3317
|
|
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
---
|
|
gio/tests/appinfo.c | 22 ++++++++++++++++++++++
|
|
gio/tests/desktop-app-info.c | 19 +++++++++++++++++++
|
|
2 files changed, 41 insertions(+)
|
|
|
|
diff --git a/gio/tests/appinfo.c b/gio/tests/appinfo.c
|
|
index d9c53c853..81bc48191 100644
|
|
--- a/gio/tests/appinfo.c
|
|
+++ b/gio/tests/appinfo.c
|
|
@@ -49,6 +49,19 @@ test_launch_for_app_info (GAppInfo *appinfo)
|
|
g_free (uri);
|
|
}
|
|
|
|
+static gboolean
|
|
+skip_missing_dbus_daemon (void)
|
|
+{
|
|
+ const gchar *path = g_find_program_in_path ("dbus-daemon");
|
|
+ if (path == NULL)
|
|
+ {
|
|
+ g_test_skip ("dbus-daemon is required to run this test");
|
|
+ return TRUE;
|
|
+ }
|
|
+ g_free (path);
|
|
+ return FALSE;
|
|
+}
|
|
+
|
|
static void
|
|
test_launch (void)
|
|
{
|
|
@@ -56,6 +69,9 @@ test_launch (void)
|
|
GAppInfo *appinfo;
|
|
const gchar *path;
|
|
|
|
+ if (skip_missing_dbus_daemon ())
|
|
+ return;
|
|
+
|
|
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
|
g_test_dbus_up (bus);
|
|
@@ -96,6 +112,9 @@ test_launch_no_app_id (void)
|
|
gchar *exec_line_variants[2];
|
|
gsize i;
|
|
|
|
+ if (skip_missing_dbus_daemon ())
|
|
+ return;
|
|
+
|
|
exec_line_variants[0] = g_strdup_printf (
|
|
"Exec=%s/appinfo-test --option %%U %%i --name %%c --filename %%k %%m %%%%",
|
|
g_test_get_dir (G_TEST_BUILT));
|
|
@@ -356,6 +375,9 @@ test_launch_context_signals (void)
|
|
gboolean success;
|
|
gchar *cmdline;
|
|
|
|
+ if (skip_missing_dbus_daemon ())
|
|
+ return;
|
|
+
|
|
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
|
g_test_dbus_up (bus);
|
|
diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c
|
|
index e82e2dd31..ec65b7618 100644
|
|
--- a/gio/tests/desktop-app-info.c
|
|
+++ b/gio/tests/desktop-app-info.c
|
|
@@ -593,6 +593,19 @@ wait_for_file (const gchar *want_this,
|
|
unlink (or_this);
|
|
}
|
|
|
|
+static gboolean
|
|
+skip_missing_dbus_daemon (void)
|
|
+{
|
|
+ const gchar *path = g_find_program_in_path ("dbus-daemon");
|
|
+ if (path == NULL)
|
|
+ {
|
|
+ g_test_skip ("dbus-daemon is required to run this test");
|
|
+ return TRUE;
|
|
+ }
|
|
+ g_free (path);
|
|
+ return FALSE;
|
|
+}
|
|
+
|
|
static void
|
|
test_actions (void)
|
|
{
|
|
@@ -606,6 +619,9 @@ test_actions (void)
|
|
gchar *tweak_path;
|
|
gchar *twiddle_path;
|
|
|
|
+ if (skip_missing_dbus_daemon ())
|
|
+ return;
|
|
+
|
|
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
|
g_test_dbus_up (bus);
|
|
@@ -1833,6 +1849,9 @@ test_launch_fail_dbus (void)
|
|
GAsyncResult *result = NULL;
|
|
GError *error = NULL;
|
|
|
|
+ if (skip_missing_dbus_daemon ())
|
|
+ return;
|
|
+
|
|
/* Set up a test session bus to ensure that launching the app happens using
|
|
* D-Bus rather than spawning. */
|
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
|
--
|
|
2.44.0
|
|
|
|
|
|
From 0ec9c399c7d2755147e409d065690b2ff53fda40 Mon Sep 17 00:00:00 2001
|
|
From: Natanael Copa <ncopa@alpinelinux.org>
|
|
Date: Wed, 3 Apr 2024 22:10:18 +0200
|
|
Subject: [PATCH 3/3] tests: find update-desktop-database
|
|
|
|
Disable tests that require update-desktop-database when it is missing.
|
|
|
|
It requires glib to build so it will be missing when bootstrapping glib.
|
|
|
|
Refactor the ifdef for Windows and MacOS while at it and reduce number
|
|
of ifdefs.
|
|
|
|
Ref: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3658
|
|
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
---
|
|
gio/tests/desktop-app-info.c | 35 +++++++++++++++++++++++++++++
|
|
gio/tests/file.c | 43 ++++++++++++++++++++++--------------
|
|
2 files changed, 62 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c
|
|
index ec65b7618..e492b1346 100644
|
|
--- a/gio/tests/desktop-app-info.c
|
|
+++ b/gio/tests/desktop-app-info.c
|
|
@@ -125,6 +125,20 @@ create_app_info (const char *name)
|
|
return info;
|
|
}
|
|
|
|
+static gboolean
|
|
+skip_missing_update_desktop_database (void)
|
|
+{
|
|
+ const gchar *path = g_find_program_in_path ("update-desktop-database");
|
|
+
|
|
+ if (path == NULL)
|
|
+ {
|
|
+ g_test_skip ("update-desktop-database is required to run this test");
|
|
+ return TRUE;
|
|
+ }
|
|
+ g_free (path);
|
|
+ return FALSE;
|
|
+}
|
|
+
|
|
static void
|
|
test_delete (void)
|
|
{
|
|
@@ -134,6 +148,9 @@ test_delete (void)
|
|
char *filename;
|
|
gboolean res;
|
|
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
+
|
|
info = create_app_info ("Blah");
|
|
|
|
id = g_app_info_get_id (info);
|
|
@@ -177,6 +194,9 @@ test_default (void)
|
|
GList *list;
|
|
GError *error = NULL;
|
|
|
|
+if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
+
|
|
info1 = create_app_info ("Blah1");
|
|
info2 = create_app_info ("Blah2");
|
|
info3 = create_app_info ("Blah3");
|
|
@@ -316,6 +336,9 @@ test_default_async (void)
|
|
GList *list;
|
|
GError *error = NULL;
|
|
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
+
|
|
data.loop = g_main_loop_new (NULL, TRUE);
|
|
|
|
info1 = create_app_info ("Blah1");
|
|
@@ -418,6 +441,9 @@ test_fallback (void)
|
|
GError *error = NULL;
|
|
gint old_length;
|
|
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
+
|
|
info1 = create_app_info ("Test1");
|
|
info2 = create_app_info ("Test2");
|
|
|
|
@@ -492,6 +518,9 @@ test_last_used (void)
|
|
GAppInfo *info1, *info2, *default_app;
|
|
GError *error = NULL;
|
|
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
+
|
|
info1 = create_app_info ("Test1");
|
|
info2 = create_app_info ("Test2");
|
|
|
|
@@ -1222,6 +1251,9 @@ test_default_uri_handler (void)
|
|
gchar *file_path = NULL;
|
|
GAppInfo *info;
|
|
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
+
|
|
info = create_app_info_toucher ("Touch Handled", "handled",
|
|
"x-scheme-handler/glib-touch",
|
|
&file_path);
|
|
@@ -1298,6 +1330,9 @@ test_default_uri_handler_async (void)
|
|
gboolean called = FALSE;
|
|
gint64 start_time, touch_time;
|
|
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
+
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
info = create_app_info_toucher ("Touch Handled", "handled-async",
|
|
"x-scheme-handler/glib-async-touch",
|
|
diff --git a/gio/tests/file.c b/gio/tests/file.c
|
|
index 72296d008..dba5fe66c 100644
|
|
--- a/gio/tests/file.c
|
|
+++ b/gio/tests/file.c
|
|
@@ -3784,6 +3784,25 @@ create_command_line_app_info (const char *name,
|
|
return g_steal_pointer (&info);
|
|
}
|
|
|
|
+static gboolean
|
|
+skip_missing_update_desktop_database (void)
|
|
+{
|
|
+#if defined(G_OS_WIN32) || defined(__APPLE__)
|
|
+ g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
+ return TRUE;
|
|
+#else
|
|
+ const gchar *path = g_find_program_in_path ("update-desktop-database");
|
|
+
|
|
+ if (path == NULL)
|
|
+ {
|
|
+ g_test_skip ("update-desktop-database is required to run this test");
|
|
+ return TRUE;
|
|
+ }
|
|
+ g_free (path);
|
|
+ return FALSE;
|
|
+#endif
|
|
+}
|
|
+
|
|
static void
|
|
test_query_default_handler_uri (void)
|
|
{
|
|
@@ -3793,10 +3812,8 @@ test_query_default_handler_uri (void)
|
|
GFile *file;
|
|
GFile *invalid_file;
|
|
|
|
-#if defined(G_OS_WIN32) || defined(__APPLE__)
|
|
- g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
- return;
|
|
-#endif
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
|
|
info = create_command_line_app_info ("Gio File Handler", "true",
|
|
"x-scheme-handler/gio-file");
|
|
@@ -3878,10 +3895,8 @@ test_query_default_handler_file (void)
|
|
const char buffer[] = "Text file!\n";
|
|
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
|
|
|
-#if defined(G_OS_WIN32) || defined(__APPLE__)
|
|
- g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
- return;
|
|
-#endif
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
|
|
text_file = g_file_new_tmp ("query-default-handler-XXXXXX", &iostream, &error);
|
|
g_assert_no_error (error);
|
|
@@ -3974,10 +3989,8 @@ test_query_default_handler_file_async (void)
|
|
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
|
GError *error = NULL;
|
|
|
|
-#if defined(G_OS_WIN32) || defined(__APPLE__)
|
|
- g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
- return;
|
|
-#endif
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
|
|
data.loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
@@ -4064,10 +4077,8 @@ test_query_default_handler_uri_async (void)
|
|
GFile *file;
|
|
GFile *invalid_file;
|
|
|
|
-#if defined(G_OS_WIN32) || defined(__APPLE__)
|
|
- g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
- return;
|
|
-#endif
|
|
+ if (skip_missing_update_desktop_database ())
|
|
+ return;
|
|
|
|
info = create_command_line_app_info ("Gio File Handler", "true",
|
|
"x-scheme-handler/gio-file");
|
|
--
|
|
2.44.0
|
|
|