[bug#76036] gnu: flatpak: Update to 1.16.0.

Message ID f3ececec04cc6e6f0213e85dbd0cc3fd3813be18.1738624064.git.aurtzy@gmail.com
State New
Headers
Series [bug#76036] gnu: flatpak: Update to 1.16.0. |

Commit Message

aurtzy Feb. 3, 2025, 11:18 p.m. UTC
* gnu/packages/package-management.scm (flatpak): Update to 1.16.0.
[build-system]: Switch to meson-build-system, which is now the recommended
build system upstream.
[arguments]<#:configure-flags>: Use equivalent options for meson.
<#:phases>: Enable running more tests, disabling a select few in new
'disable-failing-tests phase.  Remove 'check phase override.  Add
'pre-check phase.  Add 'wrap-flatpak phase so GIO can still find TLS backend
with the build system change.
[native-inputs]: Add gtk-doc.
[inputs]: Add bash-minimal.

Change-Id: Iacf5c527e7a1cce7f418cecf73bb89018fcec71e
---

Hi!

Meson is now the recommended build system for Flatpak [1], so I have had a go at
making flatpak use meson-build-system in this patch.  Most configure flags had
one-to-one equivalents, but there were two exceptions:
1. The --with-curl option doesn't seem to have an equivalent meson option, but
   there is an http_backend option that already defaults to "curl"; perhaps this
   can be simply dropped?  This patch drops it with no noticeable issues,
   although I'm not sure what I'd test to make sure.
2. The --enable-documentation option also has no equivalent.  I wasn't sure what
   the FIXME comment was specifically referring to (git-blamed commit didn't
   have context), but adding gtk-doc appears to enable generating documentation
   just fine; would this be considered a fix?


According to the issue that led to using glib-or-gtk-build-system [2], there was
a TLS problem that was fixed by including GIO modules from glib-networking.  My
system didn't exhibit any sort of behavior related to this while updating
flatpak though (i.e. still worked without wrapper), so I'm not sure what the
correct course of action is for this or if there'd be breakage on other systems.

I opted for a wrap-program to include glib-networking in GIO_EXTRA_MODULES in
case the issue still applies.  Note that this ignores some other GIO modules and
XDG_DATA_DIRS directories that glib-or-gtk-build-system had additional wrappings
for.

[1] https://github.com/flatpak/flatpak/blob/main/CONTRIBUTING.md

[2] https://issues.guix.gnu.org/34861

Cheers,

aurtzy


 gnu/packages/package-management.scm | 52 +++++++++++++++++------------
 1 file changed, 30 insertions(+), 22 deletions(-)


base-commit: 6964f7ad3481461cbb3256dd87e88ebcb3356f21
  

Comments

Rodion Goritskov Feb. 10, 2025, 11:20 p.m. UTC | #1
Hello!

I tried running the updated version.
Good news - it builds fine!

Also tried running flatpak version of Firefox - works fine.
Webpages are loaded, WebRTC functionality (and screensharing) also work.

However, I have a problem with Bottles (com.usebottles.bottles).
On startup I can see the following errors in logs.

> 00:06:15 (WARNING) Connection status: offline …

Also, all menus that require network connection are disabled (i.e. I
cannot download any runners).
It works fine on the current flatpak from master.

I found some old bug with the similar problem [1]. Looks like it has
something to do with SSL cert paths (as per [2]).

Will try to investigate more if I have time later this week.

1 - https://github.com/bottlesdevs/Bottles/issues/2057
2 - https://github.com/bottlesdevs/Bottles/issues/2057#issuecomment-1312596839
  
aurtzy Feb. 12, 2025, 4:44 a.m. UTC | #2
Hey Rodion,

Thanks for testing! This issue with Bottles doesn't seem to occur on my system; 
does it persist after rebooting?

On 2/10/25 18:20, Rodion Goritskov wrote:
> 
> Hello!
> 
> I tried running the updated version.
> Good news - it builds fine!
> 
> Also tried running flatpak version of Firefox - works fine.
> Webpages are loaded, WebRTC functionality (and screensharing) also work.
> 
> However, I have a problem with Bottles (com.usebottles.bottles).
> On startup I can see the following errors in logs.
> 
>> 00:06:15 (WARNING) Connection status: offline …
> 
> Also, all menus that require network connection are disabled (i.e. I
> cannot download any runners).
> It works fine on the current flatpak from master.
> 
> I found some old bug with the similar problem [1]. Looks like it has
> something to do with SSL cert paths (as per [2]).
> 
> Will try to investigate more if I have time later this week.
> 
> 1 - https://github.com/bottlesdevs/Bottles/issues/2057
> 2 - https://github.com/bottlesdevs/Bottles/issues/2057#issuecomment-1312596839
  
Rodion Goritskov Feb. 12, 2025, 10:10 p.m. UTC | #3
user guix
usertag 76036 + reviewed-looks-good
thanks

Guix QA review form submission:
Builds with tests, runs, starts a bunch of programs

Items marked as checked: Lint warnings, Package builds, Commit messages.

Hi!

Today I updated the flatpak'ed Bottles to the latest version - and it
works fine with the updated version of Flatpak in this patch. Don't know
the actual reason for previous problems, but my version of Bottles was quiet old.

All programs I use in Flatpak (Firefox, Bottles, Flatseal and
Calibre) now work fine.

So everything look good to me.

Thank you for the patch!
  
宋文武 Feb. 13, 2025, 2:49 a.m. UTC | #4
Pushed to master, thanks.
  

Patch

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 2beb442451..1b2a3d9309 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -25,6 +25,7 @@ 
 ;;; Copyright © 2023 Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de>
 ;;; Copyright © 2024 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2025 aurtzy <aurtzy@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2037,40 +2038,42 @@  (define-public libostree
 (define-public flatpak
   (package
     (name "flatpak")
-    (version "1.14.10")
+    (version "1.16.0")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://github.com/flatpak/flatpak/releases/download/"
                            version "/flatpak-" version ".tar.xz"))
        (sha256
-        (base32 "1k91v0csghiis8gjpcvpx534qbyaj81dfisabbc0ld97h68cggbb"))
+        (base32 "0ajbz8ms4h5nyjr59hv9z8vaimj4f3p51v8idmy14qnbmmjwa2nb"))
        (patches
         (search-patches "flatpak-fix-fonts-icons.patch"
                         "flatpak-fix-path.patch"
                         "flatpak-fix-icon-validation.patch"
                         "flatpak-unset-gdk-pixbuf-for-sandbox.patch"))))
-
-    ;; Wrap 'flatpak' so that GIO_EXTRA_MODULES is set, thereby allowing GIO to
-    ;; find the TLS backend in glib-networking.
-    (build-system glib-or-gtk-build-system)
-
+    (build-system meson-build-system)
     (arguments
      (list
       #:configure-flags
       #~(list
-         "--with-curl"
-         "--enable-documentation=no" ;; FIXME
-         "--enable-system-helper=no"
-         "--localstatedir=/var"
-         (string-append "--with-system-bubblewrap="
+         "-Dsystem_helper=disabled"
+         "-Dlocalstatedir=/var"
+         (string-append "-Dsystem_bubblewrap="
                         (assoc-ref %build-inputs "bubblewrap")
                         "/bin/bwrap")
-         (string-append "--with-system-dbus-proxy="
+         (string-append "-Dsystem_dbus_proxy="
                         (assoc-ref %build-inputs "xdg-dbus-proxy")
                         "/bin/xdg-dbus-proxy"))
       #:phases
       #~(modify-phases %standard-phases
+          (add-after 'unpack 'disable-failing-tests
+            (lambda _
+              (substitute* "tests/test-matrix/meson.build"
+                ;; The following tests fail with error message related to fusermount3
+                ;; failing an unmount operation ("No such file or directory").
+                (("^.*test-http-utils.*$") "")
+                (("^.*test-summaries@system.wrap.*$") "")
+                (("^.*test-prune.*$") ""))))
           (add-after 'unpack 'fix-tests
             (lambda* (#:key inputs #:allow-other-keys)
               (copy-recursively
@@ -2101,20 +2104,24 @@  (define-public flatpak
                      (store (dirname out)))
                 (substitute* "icon-validator/validate-icon.c"
                   (("@storeDir@") store)))))
-          ;; Many tests fail for unknown reasons, so we just run a few basic
-          ;; tests.
-          (replace 'check
-            (lambda* (#:key tests? #:allow-other-keys)
-              (when tests?
-                (setenv "HOME" "/tmp")
-                (invoke "make" "check"
-                        "TESTS=tests/test-basic.sh tests/test-config.sh
-                        testcommon")))))))
+          (add-before 'check 'pre-check
+            (lambda _
+              ;; Set $HOME to writable location for testcommon tests.
+              (setenv "HOME" "/tmp")))
+          (add-after 'install 'wrap-flatpak
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((flatpak (string-append #$output "/bin/flatpak"))
+                    (glib-networking (assoc-ref inputs "glib-networking")))
+                (wrap-program flatpak
+                  ;; Allow GIO to find TLS backend.
+                  `("GIO_EXTRA_MODULES" prefix
+                    (,(string-append glib-networking "/lib/gio/modules"))))))))))
     (native-inputs
      (list bison
            dbus ; for dbus-daemon
            gettext-minimal
            `(,glib "bin") ; for glib-mkenums + gdbus-codegen
+           gtk-doc
            (libc-utf8-locales-for-target)
            gobject-introspection
            libcap
@@ -2126,6 +2133,7 @@  (define-public flatpak
     (inputs
      (list appstream
            appstream-glib
+           bash-minimal
            bubblewrap
            curl
            dconf