Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Oct 2021 23:02:09 GMT
From:      Daniel Engberg <diizzy@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 3014d5a8f0e3 - main - devel/glib20: Add option for unit tests
Message-ID:  <202110022302.192N29bM010365@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3014d5a8f0e3c411b758afb8873ba4043b2a003c

commit 3014d5a8f0e3c411b758afb8873ba4043b2a003c
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2021-10-02 22:08:00 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2021-10-02 23:01:33 +0000

    devel/glib20: Add option for unit tests
    
    Don't build tests by default, the reduces time spent on compiling
    substantially (~450 objects vs ~1200)
    Add dependency for unit tests
    Some tests are disable due to circular dependency
    Backport upstream commit 75c854b359b8bd8b78938e51e5a2c7a42e5847ae
    to fix an issue calling getpwnam_r
    Thanks to arrowd for troubleshooting and submitting bugfix upstream
    
    References:
    https://gitlab.gnome.org/GNOME/glib/-/issues/2488
    https://gitlab.gnome.org/GNOME/glib/-/commit/75c854b359b8bd8b78938e51e5a2c7a42e5847ae
    https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2276 (backport)
    
    PR:             257623
    Approved by:    arrowd (mentor)
    Differential Revision:  https://reviews.freebsd.org/D31702
---
 devel/glib20/Makefile                          |  6 ++-
 devel/glib20/files/patch-gio_tests_meson.build | 61 +++++++++++++++++++++++++
 devel/glib20/files/patch-glib_glib-unix.c      | 63 ++++++++++++++++++++++++++
 3 files changed, 129 insertions(+), 1 deletion(-)

diff --git a/devel/glib20/Makefile b/devel/glib20/Makefile
index 62d08626ae72..6b6c5fd91646 100644
--- a/devel/glib20/Makefile
+++ b/devel/glib20/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=	glib
 DISTVERSION=	2.70.0
+PORTREVISION=	1
 PORTEPOCH=	2
 CATEGORIES=	devel
 MASTER_SITES=	GNOME
@@ -36,7 +37,7 @@ CPE_VENDOR=	gnome
 _LIBVERSION=	0.7000.0
 PLIST_SUB=	LIBVERSION=${_LIBVERSION}
 
-OPTIONS_DEFINE=	DEBUG FAM_ALTBACKEND MANPAGES NLS
+OPTIONS_DEFINE=	DEBUG FAM_ALTBACKEND MANPAGES NLS TEST
 OPTIONS_DEFAULT=	MANPAGES
 OPTIONS_SUB=		yes
 
@@ -47,6 +48,9 @@ MANPAGES_BUILD_DEPENDS=	docbook-xml>4.1.2:textproc/docbook-xml \
 MANPAGES_USE=		GNOME=libxslt:build
 MANPAGES_MESON_TRUE=	man
 
+TEST_DEPENDS=		dbus-daemon:devel/dbus
+TEST_MESON_TRUE=	tests
+
 .include <bsd.port.pre.mk>
 
 # doesn't build yet
diff --git a/devel/glib20/files/patch-gio_tests_meson.build b/devel/glib20/files/patch-gio_tests_meson.build
new file mode 100644
index 000000000000..435c5afe7f2d
--- /dev/null
+++ b/devel/glib20/files/patch-gio_tests_meson.build
@@ -0,0 +1,61 @@
+--- gio/tests/meson.build.orig	2021-06-10 18:57:57 UTC
++++ gio/tests/meson.build
+@@ -49,7 +49,6 @@ gio_tests = {
+   'buffered-output-stream' : {},
+   'cancellable' : {},
+   'contexts' : {},
+-  'contenttype' : {},
+   'converter-stream' : {},
+   'credentials' : {},
+   'data-input-stream' : {},
+@@ -94,7 +93,6 @@ gio_tests = {
+   'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']},
+   'tls-database' : {'extra_sources' : ['gtesttlsbackend.c']},
+   'tls-bindings' : {'extra_sources' : ['gtesttlsbackend.c']},
+-  'gdbus-address-get-session' : {},
+   'win32-appinfo' : {},
+ }
+ 
+@@ -151,10 +149,6 @@ endif
+ if host_machine.system() != 'windows'
+   gio_tests += {
+     'file' : {},
+-    'gdbus-peer' : {
+-      'dependencies' : [libgdbus_example_objectmanager_dep],
+-      'install_rpath' : installed_tests_execdir
+-    },
+     'gdbus-peer-object-manager' : {},
+     'live-g-file' : {},
+     'socket-address' : {},
+@@ -190,31 +184,14 @@ if host_machine.system() != 'windows'
+     }
+   endif
+ 
+-  # Uninstalled because of the check-for-executable logic in DesktopAppInfo
+-  # unable to find the installed executable
+-  if not glib_have_cocoa
+-    gio_tests += {
+-      'appinfo' : {
+-        'install' : false,
+-      },
+-      'desktop-app-info' : {
+-        'install' : false,
+-      },
+-    }
+-  endif
+-
+   test_extra_programs += {
+     'basic-application' : {},
+     'dbus-launch' : {},
+-    'appinfo-test' : {},
+   }
+ 
+   if not glib_have_cocoa
+     test_extra_programs += {
+       'apps' : {},
+-    }
+-    gio_tests += {
+-      'mimeapps' : {},
+     }
+   endif
+ 
diff --git a/devel/glib20/files/patch-glib_glib-unix.c b/devel/glib20/files/patch-glib_glib-unix.c
new file mode 100644
index 000000000000..1160e0cf537f
--- /dev/null
+++ b/devel/glib20/files/patch-glib_glib-unix.c
@@ -0,0 +1,63 @@
+--- glib/glib-unix.c.orig	2021-09-17 10:17:56 UTC
++++ glib/glib-unix.c
+@@ -463,7 +463,6 @@ g_unix_get_passwd_entry (const gchar  *user_name,
+     } *buffer = NULL;
+   gsize string_buffer_size = 0;
+   GError *local_error = NULL;
+-  int errsv = 0;
+ 
+   g_return_val_if_fail (user_name != NULL, NULL);
+   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+@@ -493,10 +492,8 @@ g_unix_get_passwd_entry (const gchar  *user_name,
+        */
+       buffer = g_malloc0 (sizeof (*buffer) + string_buffer_size + 6);
+ 
+-      errno = 0;
+       retval = getpwnam_r (user_name, &buffer->pwd, buffer->string_buffer,
+                            string_buffer_size, &passwd_file_entry);
+-      errsv = errno;
+ 
+       /* Bail out if: the lookup was successful, or if the user id can't be
+        * found (should be pretty rare case actually), or if the buffer should be
+@@ -508,19 +505,19 @@ g_unix_get_passwd_entry (const gchar  *user_name,
+           break;
+         }
+       else if (retval == 0 ||
+-          errsv == ENOENT || errsv == ESRCH ||
+-          errsv == EBADF || errsv == EPERM)
++          retval == ENOENT || retval == ESRCH ||
++          retval == EBADF || retval == EPERM)
+         {
+           /* Username not found. */
+-          g_unix_set_error_from_errno (&local_error, errsv);
++          g_unix_set_error_from_errno (&local_error, retval);
+           break;
+         }
+-      else if (errsv == ERANGE)
++      else if (retval == ERANGE)
+         {
+           /* Can’t allocate enough string buffer space. */
+           if (string_buffer_size > 32 * 1024)
+             {
+-              g_unix_set_error_from_errno (&local_error, errsv);
++              g_unix_set_error_from_errno (&local_error, retval);
+               break;
+             }
+ 
+@@ -529,7 +526,7 @@ g_unix_get_passwd_entry (const gchar  *user_name,
+         }
+       else
+         {
+-          g_unix_set_error_from_errno (&local_error, errsv);
++          g_unix_set_error_from_errno (&local_error, retval);
+           break;
+         }
+     }
+@@ -543,7 +540,6 @@ g_unix_get_passwd_entry (const gchar  *user_name,
+     {
+       g_clear_pointer (&buffer, g_free);
+       g_propagate_error (error, g_steal_pointer (&local_error));
+-      errno = errsv;
+     }
+ 
+   return (struct passwd *) g_steal_pointer (&buffer);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110022302.192N29bM010365>