Subject: [bug#62467] [PATCH gnome-team v2 01/12] gnu: glib: Update to 2.76.1.

From: Liliana Marie Prikler <[email-masked]>
Date: Sun, 26 Mar 2023 17:39:11 +0200

* gnu/packages/glib.scm (glib): Update to 2.76.1.
[source]<snippet>: Adjust accordingly.
[arguments]<#:phases>: Add ‘set-G_TEST_SRCDIR’.  Update ‘delete-failing-tests’.
[propagated-inputs]: Replace pcre with pcre2.
(glib-with-documentation): Inherit from glib.
* gnu/packages/gnome.scm (sysprof, gtranslator): Use glib.
* gnu/packages/gtk.scm (gtksourceview): Use glib.
* gnu/packages/guile-xyz.scm (guile-g-golf): Use glib.
* gnu/packages/patches/glib-skip-failing-test.patch: Adjust accordingly.
---
 gnu/packages/glib.scm                         | 92 +++++--------------
 gnu/packages/gnome.scm                        |  8 +-
 gnu/packages/gtk.scm                          |  2 +-
 gnu/packages/guile-xyz.scm                    |  2 +-
 .../patches/glib-skip-failing-test.patch      |  3 +-
 5 files changed, 30 insertions(+), 77 deletions(-)

diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index f85d5e3225..ecf5cb491f 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -215,7 +215,7 @@ (define-public dbus-verbose
 (define glib
   (package
     (name "glib")
-    (version "2.70.2")
+    (version "2.76.1")
     (source
      (origin
        (method url-fetch)
@@ -224,14 +224,14 @@ (define glib
                        name "/" (string-take version 4) "/"
                        name "-" version ".tar.xz"))
        (sha256
-        (base32 "0vw08p4jllavp9qmlqg1yl1zanmy53yid46wipas6gfdhnf4al85"))
+        (base32 "17x1zpr2avj8hjbpc6hp2sf2885lxac46v0kajsgan3929m0zp23"))
        (patches
         (search-patches "glib-appinfo-watch.patch"
                         "glib-skip-failing-test.patch"))
        (modules '((guix build utils)))
        (snippet
         '(begin
-           (substitute* "tests/spawn-test.c"
+           (substitute* "glib/tests/spawn-test.c"
              (("/bin/sh") "sh"))))))
     (build-system meson-build-system)
     (outputs '("out"                    ;libraries, locales, etc
@@ -256,6 +256,9 @@ (define glib
        #:phases
        (modify-phases %standard-phases
          ;; Needed to pass the test phase on slower ARM and i686 machines.
+         (add-after 'unpack 'set-G_TEST_SRCDIR
+           (lambda _
+             (setenv "G_TEST_SRCDIR" (string-append (getcwd) "/gio/tests"))))
          (add-after 'unpack 'increase-test-timeout
            (lambda _
              (substitute* "meson.build"
@@ -270,9 +273,19 @@ (define glib
                (substitute* '("unix.c" "utils.c")
                  (("[ \t]*g_test_add_func.*;") "")))
              (with-directory-excursion "gio/tests"
-               (substitute* '("contenttype.c" "gdbus-address-get-session.c"
-                              "gdbus-peer.c" "appinfo.c" "desktop-app-info.c")
-                 (("[ \t]*g_test_add_func.*;") "")))
+               (substitute* '("contenttype.c"
+                              "gdbus-address-get-session.c"
+                              "gdbus-server-auth.c"
+                              "gdbus-peer.c"
+                              "appinfo.c"
+                              "desktop-app-info.c")
+                 (("[ \t]*g_test_add_func.*;") ""))
+               (unless (which "update-desktop-database")
+                 (substitute* '("file.c")
+                 (("[ \t]*g_test_add_func.*query-default-handler.*;") "")))
+               (substitute* '("portal-support-snap.c")
+                 (("g_test_init .*")
+                  "return EXIT_SUCCESS;")))
 
              ,@(if (target-x86-32?)
                    ;; Comment out parts of timer.c that fail on i686 due to
@@ -357,7 +370,7 @@ (define glib
            libelf))
     (propagated-inputs
      (list libffi ; in the Requires.private field of gobject-2.0.pc
-           pcre ; in the Requires.private field of glib-2.0.pc
+           pcre2 ; in the Requires.private field of glib-2.0.pc
            `(,util-linux "lib") ;for libmount
            zlib))         ; in the Requires.private field of glib-2.0.pc
     (native-search-paths
@@ -383,68 +396,10 @@ (define glib
     (license license:lgpl2.1+)
     (properties '((hidden? . #t)))))
 
-(define-public glib-next
-  (package
-    (inherit glib)
-    (name "glib")
-    (version "2.73.3")
-    (source
-     (origin
-       (inherit (package-source glib))
-       (uri
-        (string-append "mirror://gnome/sources/"
-                       name "/" (string-take version 4) "/"
-                       name "-" version ".tar.xz"))
-       (snippet
-        '(substitute* "glib/tests/spawn-test.c"
-           (("/bin/sh") "sh")))
-       (sha256
-        (base32 "1bgfch7zj1pq4rkqcibfky1470ijljyrx5pn5s5v9mk72s22n6nz"))))
-    (arguments
-     (substitute-keyword-arguments (package-arguments glib)
-       ((#:test-options test-options ''())
-        ;; Skip flaky or slow tests.
-        `(cons* "--no-suite=slow" "--no-suite=flaky" ,test-options))
-       ((#:phases phases '%standard-phases)
-        `(modify-phases ,phases
-           (replace 'disable-failing-tests
-             (lambda _
-               (with-directory-excursion "glib/tests"
-                 (substitute* '("unix.c" "utils.c")
-                   (("[ \t]*g_test_add_func.*;") "")))
-               ;; The "glib:gio / file" test fails with the error "No
-               ;; application is registered as handling this file" (see:
-               ;; https://gitlab.gnome.org/GNOME/glib/-/issues/2742).
-               (with-directory-excursion "gio/tests"
-                 (substitute* '("appinfo.c"
-                                "contenttype.c"
-                                "desktop-app-info.c"
-                                "file.c"
-                                "gdbus-address-get-session.c"
-                                "gdbus-peer.c")
-                   (("[ \t]*g_test_add_func.*;") "")))
-
-               ,@(if (target-x86-32?)
-                     ;; Comment out parts of timer.c that fail on i686 due to
-                     ;; excess precision when building with GCC 10:
-                     ;; <https://gitlab.gnome.org/GNOME/glib/-/issues/820>.
-                     '((substitute* "glib/tests/timer.c"
-                         (("^  g_assert_cmpuint \\(micros.*" all)
-                          (string-append "//" all "\n"))
-                         (("^  g_assert_cmpfloat \\(elapsed, ==.*" all)
-                          (string-append "//" all "\n"))))
-                     '())))))))
-    (native-inputs
-     (modify-inputs (package-native-inputs glib)
-       (append desktop-file-utils)))
-    (propagated-inputs
-     (modify-inputs (package-propagated-inputs glib)
-       (replace "pcre" pcre2)))))
-
 (define-public glib-with-documentation
   ;; glib's doc must be built in a separate package since it requires gtk-doc,
   ;; which in turn depends on glib.
-  (let ((base glib-next))
+  (let ((base glib))
     (package/inherit base
       (properties (alist-delete 'hidden? (package-properties base)))
       (outputs (cons "doc" (package-outputs base))) ; 20 MiB of GTK-Doc reference
@@ -624,10 +579,7 @@ (define-public gobject-introspection-next
               (patches (search-patches
                         "gobject-introspection-cc-1.72.patch"
                         "gobject-introspection-girepository.patch"
-                        "gobject-introspection-absolute-shlib-path-1.72.patch"))))
-    (propagated-inputs
-     (modify-inputs (package-propagated-inputs gobject-introspection)
-       (replace "glib" glib-next)))))
+                        "gobject-introspection-absolute-shlib-path-1.72.patch"))))))
 
 (define intltool
   (package
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 0efb98b97c..4a7e188048 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -13167,7 +13167,7 @@ (define-public sysprof
     (propagated-inputs
      (list polkit))
     (inputs
-     (list glib-next
+     (list glib
            gtk
            json-glib
            libadwaita
@@ -13176,7 +13176,7 @@ (define-public sysprof
            polkit))
     (native-inputs
      (list gettext-minimal
-           `(,glib-next "bin")          ;for gdbus-codegen, etc.
+           `(,glib "bin")          ;for gdbus-codegen, etc.
            itstool
            libxml2
            pkg-config))
@@ -13445,7 +13445,7 @@ (define-public gtranslator
                    (substitute* "build-aux/meson/meson_post_install.py"
                      (("gtk-update-icon-cache") (which "true"))))))))
     (native-inputs
-     (list `(,glib-next "bin")
+     (list `(,glib "bin")
            gettext-minimal
            itstool
            pkg-config))
@@ -13453,7 +13453,7 @@ (define-public gtranslator
      (list json-glib
            jsonrpc-glib
            gettext-minimal
-           glib-next
+           glib
            gsettings-desktop-schemas
            gspell
            libgda
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index b9ef660a80..1911ed7774 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -710,7 +710,7 @@ (define-public gtksourceview
      ;; gtksourceview-5.pc refers to all these.
      (list fontconfig
            fribidi
-           glib-next
+           glib
            gtk
            libxml2
            pcre2
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 315c9a7554..5d861c5c82 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -2290,7 +2290,7 @@ (define (get lib)
               (setenv "DISPLAY" ":1")
               #t)))))
     (inputs
-     (list guile-3.0 guile-lib glib-next))
+     (list guile-3.0 guile-lib glib))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/glib-skip-failing-test.patch b/gnu/packages/patches/glib-skip-failing-test.patch
index c7706aaa74..3fde5cb1e2 100644
--- a/gnu/packages/patches/glib-skip-failing-test.patch
+++ b/gnu/packages/patches/glib-skip-failing-test.patch
@@ -10,12 +10,13 @@ diff --git a/gio/tests/meson.build b/gio/tests/meson.build
 index a926ae0..4fdbe7a 100644
 --- a/gio/tests/meson.build
 +++ b/gio/tests/meson.build
-@@ -317,10 +317,6 @@ if host_machine.system() != 'windows'
+@@ -317,11 +317,6 @@ if host_machine.system() != 'windows'
          'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
          'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32'],
        },
 -      'gdbus-threading' : {
 -        'extra_sources' : extra_sources,
+-        'extra_programs': extra_programs,
 -        'suite' : ['slow'],
 -      },
        'gmenumodel' : {
-- 
2.39.2