Subject: bug#51731: [PATCH] gnome-tweaks fails to start on core-updates-frozen

From: Vivien Kraus <[email-masked]>
Date: Wed, 10 Nov 2021 20:20:38 +0000

Hello,

Liliana Marie Prikler <[email-masked]> writes:
> Am Dienstag, den 09.11.2021, 23:10 +0000 schrieb Vivien Kraus:
>> I fixed a couple of linter errors, and applied guix style to
>> it. However, now the linter complains that we have the "bin" output
>> of glib in something that would be called "glib" and not "glib:bin"…
>> Should we still keep the styled output?
> IIUC that's an issue with the linter or perhaps the implementation of
> short input lists in general.  I've CC'd Ludo as he is the one who
> allowed us to write inputs (list bash sed ...) in the first place,
> perhaps he knows what to do here.  We probably ought to convert this to
> short-style inputs anyway.
Apparently, we shouldn’t apply guix style yet, we will apply it for all
packages at once some day.

>> Subject: [PATCH 1/5] gnu: gnome-tweaks: Use libhandy 1.
> Note, libhandy 0.0 only exists on master (and therefore core-updates),
> because there are packages still using it.  If there's no more users
> post updating gnome-tweaks, it is to be removed!
I tried, but there are 2 problems:
1. I can’t update authenticator (gnu/packages/gnome.scm), because
upstream switched to Rust and I don’t know how to package that;
2. Geary needs it too (and gmime 2, which we could drop the same way),
but it’s a pain to upgrade. I went a long way, but there’s some vala
code that acts on strings as if they were arrays and I don’t know what
happens: maybe a newer vala is required, or the glib string type does
not apply for some reason.

However, I can provide an upgrade for seahorse (and its dependency
gcr). That’s a start, I guess.
:)

>> Subject: [PATCH 2/5] gnu: gnome-tweaks: Set the python path.
> Nice catch, I think this was previously done by a different phase. 
> However...
>> gnu/packages/gnome.scm (gnome-tweaks)[phases]: Also wrap with
>> GUIX_PYTHONPATH.
> Please note the phase and perhaps change its name to reflect what it
> does.
Is the 'wrap-gi-typelib-and-python boring name appropriate?

>> Subject: [PATCH 3/5] gnu: gnome-tweaks: gobject-introspection should
>> be a native input.
> I'm not sure this is the correct move here.  Python uses GI at runtime,
> not natively during build.  If gnome-tweaks requires GI at build time,
> it's to be added as both inputs.
It does not, I’ll drop it.

>> Subject: [PATCH 4/5] gnu: gnome-tweaks: Add bash-minimal as an input
>> to wrap the program.
> Split the long line.  Also perhaps add a comment in the file itself as
> to why this is needed if it's not already obvious from best practises
> in core-updates-frozen.
It’s flagged by the linter, because wrapping a program produces a shell
script that needs to be executed.

>> Subject: [PATCH 5/5] gnu: gnome-tweaks: Style it.
> This should probably done first, particularly if it helps avoid the
> linter complaints you encounter.
I’ve dropped the guix style for the reason above.

> In my personal opinion, 1, 3, 4 and 5 could also be done in a single
> commit, though YMMV.  Also, I'm not active on core-updates-frozen, so
> take everything I said as lexical analysis at best and with sufficient
> amounts of salt.
I’ll wait for more desalinated advice, because lumping commits together
is easier than separating a big one.

From af7235dc2bbfa84cc1c94792b9822c74db2baf60 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Tue, 9 Nov 2021 22:17:43 +0000
Subject: [PATCH 1/5] gnu: gnome-tweaks: Use libhandy 1.

* gnu/packages/gnome.scm (gnome-tweaks)[inputs]: Use libhandy 1, not libhandy
0.
---
 gnu/packages/gnome.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 32f237e218..3903a00398 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9795,7 +9795,7 @@ (define-public gnome-tweaks
        ("gtk+" ,gtk+)
        ("gobject-introspection" ,gobject-introspection)
        ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
-       ("libhandy" ,libhandy-0.0)
+       ("libhandy" ,libhandy)
        ("libnotify" ,libnotify)
        ("libsoup" ,libsoup)
        ("nautilus" ,nautilus)
-- 
2.33.1

From edc67015e65dfce75d1b2cd4317e1105d4730057 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Tue, 9 Nov 2021 22:57:13 +0000
Subject: [PATCH 2/5] gnu: gnome-tweaks: Set the python path.

gnu/packages/gnome.scm (gnome-tweaks)[phase wrap-gi-typelib-and-python]:
Also wrap with GUIX_PYTHONPATH.
---
 gnu/packages/gnome.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 3903a00398..05750ea365 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9780,12 +9780,18 @@ (define-public gnome-tweaks
                (("gtk-update-icon-cache") "true"))))
          (add-after 'install 'wrap
            (@@ (guix build python-build-system) wrap))
-         (add-after 'wrap 'wrap-gi-typelib
+         (add-after 'wrap 'wrap-gi-typelib-and-python
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out               (assoc-ref outputs "out"))
                    (gi-typelib-path   (getenv "GI_TYPELIB_PATH")))
-               (wrap-program (string-append out "/bin/gnome-tweaks")
-                 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
+               (let ((python-path
+                      (string-append out "/lib/python"
+                                     ,(version-major+minor
+                                       (package-version python))
+                                     "/site-packages")))
+                 (wrap-program (string-append out "/bin/gnome-tweaks")
+                   `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
+                   `("GUIX_PYTHONPATH" ":" prefix (,python-path))))))))))
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-compile-resources, etc.
        ("intltool" ,intltool)
-- 
2.33.1

From f1f5fa31282f184649733157f56d63255944952e Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Tue, 9 Nov 2021 23:01:45 +0000
Subject: [PATCH 3/5] gnu: gnome-tweaks: Add bash-minimal as an input.

* gnu/packages/gnome.scm (gnome-tweaks)[inputs]: Add bash-minimal.
---
 gnu/packages/gnome.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 05750ea365..fabeed03bd 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9806,7 +9806,9 @@ (define-public gnome-tweaks
        ("libsoup" ,libsoup)
        ("nautilus" ,nautilus)
        ("python" ,python)
-       ("python-pygobject" ,python-pygobject)))
+       ("python-pygobject" ,python-pygobject)
+       ;; So that the wrapper program can be executed
+       ("bash-minimal" ,bash-minimal)))
     (synopsis "Customize advanced GNOME 3 options")
     (home-page "https://wiki.gnome.org/Apps/Tweaks")
     (description
-- 
2.33.1

From c5032164a1f55c71fe49b9ee6af6d5acae04903c Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Wed, 10 Nov 2021 18:50:40 +0000
Subject: [PATCH 4/5] gnu: gcr: Upgrade to 3.41.0.

* gnu/packages/gnome.scm (gcr): Upgrade to 3.41.0.
---
 gnu/packages/gnome.scm | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index fabeed03bd..7c3f955937 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -2397,7 +2397,7 @@ (define-public gnome-font-viewer
 (define-public gcr
   (package
     (name "gcr")
-    (version "3.34.0")
+    (version "3.41.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
@@ -2405,8 +2405,8 @@ (define-public gcr
                                   name "-" version ".tar.xz"))
               (sha256
                (base32
-                "0925snsixzkwh49xiayqmj6fcrmklqk8kyy0jkv7m64h9abm1pr9"))))
-    (build-system gnu-build-system)
+                "00fsf82ycac8qi0kkiq759p6jrn63pyz4ksn4wnq7m4ax94zq289"))))
+    (build-system meson-build-system)
     (arguments
      '(#:phases
        (modify-phases %standard-phases
@@ -2414,10 +2414,21 @@ (define-public gcr
          ;; build environment.
          (add-after 'unpack 'disable-failing-tests
            (lambda _
-             (substitute* "Makefile.in"
-               (("[[:blank:]]+test-system-prompt\\$\\(EXEEXT\\)")
+             (substitute* "gcr/meson.build"
+               (("[[:blank:]]+'system-prompt',")
                 ""))
              #t))
+         (add-after 'unpack 'skip-gtk-update-icon-cache
+           ;; Don't create 'icon-theme.cache'.
+           (lambda _
+             (substitute* "meson_post_install.py"
+               (("gtk-update-icon-cache") "true"))
+             #t))
+         (add-after 'unpack 'fix-systemd-detection
+           (lambda _
+             (substitute* "gcr/gcr-ssh-agent-service.c"
+               (("#ifdef WITH_SYSTEMD")
+                "#if (WITH_SYSTEMD)"))))
          (add-before 'check 'pre-check
            (lambda _
              ;; Some tests expect to write to $HOME.
@@ -2426,11 +2437,17 @@ (define-public gcr
     (inputs
      `(("dbus" ,dbus)
        ("gnupg" ,gnupg)                ;called as a child process during tests
-       ("libgcrypt" ,libgcrypt)))
+       ("libgcrypt" ,libgcrypt)
+       ("libsecret" ,libsecret)))
     (native-inputs
      `(("python" ,python-wrapper)       ;for tests
+       ("openssh" ,openssh)             ;for tests
        ("pkg-config" ,pkg-config)
        ("gettext" ,gettext-minimal)
+       ("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("gtk-doc" ,gtk-doc)
        ("glib" ,glib "bin")
        ("gobject-introspection" ,gobject-introspection)
        ("libxml2" ,libxml2)
-- 
2.33.1

From 9a3cbae7896c9bba81c16ebb37656548e0110e57 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Wed, 10 Nov 2021 18:52:58 +0000
Subject: [PATCH 5/5] gnu: seahorse: Upgrade to 41.0.

* gnu/packages/gnome.scm (seahorse): Upgrade to 41.0.
---
 gnu/packages/gnome.scm | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 7c3f955937..debc800b1f 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -4329,15 +4329,15 @@ (define-public gnome-themes-standard
 (define-public seahorse
   (package
     (name "seahorse")
-    (version "3.36.2")
+    (version "41.0")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "mirror://gnome/sources/" name "/"
-                           (version-major+minor version) "/" name "-"
+                           (version-major version) "/" name "-"
                            version ".tar.xz"))
        (sha256
-        (base32 "16wmxxppgcgfj8zkagcny5af1c81x32ysm9d6j9f2k7bmik21ss5"))))
+        (base32 "1x99i7kdvd8hbxcs5rfrq7nw6r9bfzaw263zaigjjj04h6gc1vp6"))))
     (build-system meson-build-system)
     (arguments
      '(#:glib-or-gtk? #t
@@ -4348,7 +4348,11 @@ (define-public seahorse
            (lambda _
              (substitute* "build-aux/meson_post_install.py"
                (("gtk-update-icon-cache") "true"))
-             #t)))))
+             #t))
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; Tests require a writable HOME.
+             (setenv "HOME" (getcwd)))))))
     (inputs
      `(("gtk+" ,gtk+)
        ("gcr" ,gcr)
@@ -4357,7 +4361,7 @@ (define-public seahorse
        ("openldap" ,openldap)
        ("openssh" ,openssh)
        ("avahi" ,avahi)
-       ("libhandy" ,libhandy-0.0)
+       ("libhandy" ,libhandy)
        ("libpwquality" ,libpwquality)
        ("libsecret" ,libsecret)
        ("libsoup" ,libsoup)))
-- 
2.33.1

Vivien