Package: guix-patches;
Reported by: Noé Lopez <noe <at> xn--no-cja.eu>
Date: Tue, 3 Dec 2024 15:13:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74670 in the body.
You can then email your comments to 74670 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
ludo <at> gnu.org, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Tue, 03 Dec 2024 15:13:02 GMT) Full text and rfc822 format available.Noé Lopez <noe <at> xn--no-cja.eu>
:ludo <at> gnu.org, guix-patches <at> gnu.org
.
(Tue, 03 Dec 2024 15:13:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu> To: guix-patches <at> gnu.org Cc: Noé Lopez <noe <at> xn--no-cja.eu> Subject: [PATCH] tests: pack: Fix AppImage tests. Date: Tue, 3 Dec 2024 16:13:24 +0100
From: Noé Lopez <noelopez <at> free.fr> * tests/pack.scm: Add glibc to AppImage tests’ profiles. Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c --- Hi, This patch fixes the tests failing for AppImage pack. I believe the issue was that without the AppImage runtime (--appimage-extract-and-run), the glibc is not available to the AppRun binary, causing a file not found error. This is an issue caused because AppRun is built using the relocatable runtime, which requires (or at least is built with) the glibc. This is not an issue when using the AppImage runtime with FUSE, since it correctly mounts the store payload before starting the AppRun. Have a nice day, Noé tests/pack.scm | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/tests/pack.scm b/tests/pack.scm index 1c1e312557..2cb643f136 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017-2021, 2023 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2017-2021, 2023, 2024 Ludovic Courtès <ludo <at> gnu.org> ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net> ;;; Copyright © 2021, 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> ;;; Copyright © 2023 Oleg Pykhalov <go.wigust <at> gmail.com> @@ -34,7 +34,7 @@ (define-module (test-pack) #:use-module ((guix build utils) #:select (%store-directory)) #:use-module (gnu packages) #:use-module ((gnu packages base) #:select (libc-utf8-locales-for-target - hello)) + hello glibc)) #:use-module (gnu packages bootstrap) #:use-module ((gnu packages package-management) #:select (rpm)) #:use-module ((gnu packages compression) #:select (squashfs-tools)) @@ -347,36 +347,53 @@ (define rpm-for-tests (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello))) + (content (packages->manifest (list %bootstrap-guile hello glibc))) (hooks '()) (locales? #f))) (image (self-contained-appimage "hello-appimage" profile #:entry-point "bin/hello" #:extra-options - (list #:relocatable? #t))) + '(#:relocatable? #t))) (check (gexp->derivation "check-appimage" - #~(invoke #$image)))) - (built-derivations (list check)))) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (ice-9 popen) + (guix build utils)) + (let ((pipe (open-pipe* OPEN_READ + #$image "--appimage-extract-and-run"))) + (call-with-output-file #$output + (lambda (port) + (dump-port pipe port))) + (exit (status:exit-val (close-pipe pipe))))))))) + (built-derivations (list (pk 'APPIMAGE-drv check))))) (unless store (test-skip 1)) (test-assertm "appimage + localstatedir" (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello))) + (content (packages->manifest (list %bootstrap-guile hello glibc))) (hooks '()) (locales? #f))) (image (self-contained-appimage "hello-appimage" profile #:entry-point "bin/hello" #:localstatedir? #t #:extra-options - (list #:relocatable? #t))) + '(#:relocatable? #t))) (check (gexp->derivation "check-appimage" - #~(begin - (invoke #$image))))) - (built-derivations (list check)))) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (ice-9 popen) + (guix build utils)) + (let ((pipe (open-pipe* OPEN_READ + #$image "--appimage-extract-and-run"))) + (call-with-output-file #$output + (lambda (port) + (dump-port pipe port))) + (exit (status:exit-val (close-pipe pipe))))))))) + (built-derivations (list (pk 'APPIMAGE-drv check))))) (unless store (test-skip 1)) (test-assertm "deb archive with symlinks and control files" base-commit: bb8a6f0ac47296d3a18e1e0a26ea3a833eb77c4a -- 2.46.0
guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 12 Dec 2024 22:00:02 GMT) Full text and rfc822 format available.Message #8 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Noé Lopez <noe <at> xn--no-cja.eu> Cc: 74670 <at> debbugs.gnu.org Subject: Re: [bug#74670] [PATCH] tests: pack: Fix AppImage tests. Date: Thu, 12 Dec 2024 22:58:28 +0100
[Message part 1 (text/plain, inline)]
Hi Noé, Noé Lopez <noe <at> noé.eu> skribis: > From: Noé Lopez <noelopez <at> free.fr> > > * tests/pack.scm: Add glibc to AppImage tests’ profiles. > > Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c > --- > Hi, > > This patch fixes the tests failing for AppImage pack. I believe the issue was > that without the AppImage runtime (--appimage-extract-and-run), the glibc is > not available to the AppRun binary, causing a file not found error. > > This is an issue caused because AppRun is built using the relocatable runtime, > which requires (or at least is built with) the glibc. Hmm, that further limits the applicability of AppImage, but OK. (Not our fault!) I noticed that the tests were not going very far, so I tried the patch below to: (1) check the output of ‘hello’ in the first test, (2) change the second test to check for the existence of /var/guix/db/db.sqlite. The second test doesn’t work though, because where’s that file supposed to live? The image is apparently extracted in an unguessable directory, so cannot tell where it is. Am I right? Thanks, Ludo’.
[Message part 2 (text/x-patch, inline)]
diff --git a/tests/pack.scm b/tests/pack.scm index 2cb643f136..7fcae1ec1f 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -39,9 +39,10 @@ (define-module (test-pack) #:use-module ((gnu packages package-management) #:select (rpm)) #:use-module ((gnu packages compression) #:select (squashfs-tools)) #:use-module ((gnu packages debian) #:select (dpkg)) - #:use-module ((gnu packages guile) #:select (guile-sqlite3)) + #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0)) #:use-module ((gnu packages gnupg) #:select (guile-gcrypt)) #:use-module ((gnu packages linux) #:select (fakeroot)) + #:use-module ((ice-9 textual-ports) #:select (get-string-all)) #:use-module (srfi srfi-64)) (define %store @@ -347,7 +348,9 @@ (define rpm-for-tests (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello glibc))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list hello glibc))) (hooks '()) (locales? #f))) (image (self-contained-appimage "hello-appimage" profile @@ -366,34 +369,46 @@ (define rpm-for-tests (lambda (port) (dump-port pipe port))) (exit (status:exit-val (close-pipe pipe))))))))) - (built-derivations (list (pk 'APPIMAGE-drv check))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello, world!\n"))))) (unless store (test-skip 1)) (test-assertm "appimage + localstatedir" (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello glibc))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list guile-3.0 glibc))) (hooks '()) (locales? #f))) - (image (self-contained-appimage "hello-appimage" profile - #:entry-point "bin/hello" + (image (self-contained-appimage "guile-appimage" profile + #:entry-point "bin/guile" #:localstatedir? #t #:extra-options '(#:relocatable? #t))) (check (gexp->derivation - "check-appimage" - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (ice-9 popen) - (guix build utils)) - (let ((pipe (open-pipe* OPEN_READ - #$image "--appimage-extract-and-run"))) - (call-with-output-file #$output - (lambda (port) - (dump-port pipe port))) - (exit (status:exit-val (close-pipe pipe))))))))) - (built-derivations (list (pk 'APPIMAGE-drv check))))) + "check-appimage-with-localstatedir" + #~(begin + (system* #$image "--appimage-extract-and-run" "-c" + (object->string + `(call-with-output-file #$output + (lambda (port) + (display "Hello from Guile!\n" + port))))) + (execl #$image #$image "--appimage-extract-and-run" "-c" + (object->string + '(exit + (pk 'db? (getcwd) + (file-exists? "var/guix/db/db.sqlite"))))))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello from Guile!\n"))))) (unless store (test-skip 1)) (test-assertm "deb archive with symlinks and control files"
guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 12 Dec 2024 22:00:03 GMT) Full text and rfc822 format available.Message #11 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Noé Lopez <noe <at> xn--no-cja.eu> Cc: 74670 <at> debbugs.gnu.org Subject: Re: [bug#74670] [PATCH] tests: pack: Fix AppImage tests. Date: Thu, 12 Dec 2024 22:59:03 +0100
[Message part 1 (text/plain, inline)]
Hi Noé, Noé Lopez <noe <at> noé.eu> skribis: > From: Noé Lopez <noelopez <at> free.fr> > > * tests/pack.scm: Add glibc to AppImage tests’ profiles. > > Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c > --- > Hi, > > This patch fixes the tests failing for AppImage pack. I believe the issue was > that without the AppImage runtime (--appimage-extract-and-run), the glibc is > not available to the AppRun binary, causing a file not found error. > > This is an issue caused because AppRun is built using the relocatable runtime, > which requires (or at least is built with) the glibc. Hmm, that further limits the applicability of AppImage, but OK. (Not our fault!) I noticed that the tests were not going very far, so I tried the patch below to: (1) check the output of ‘hello’ in the first test, (2) change the second test to check for the existence of /var/guix/db/db.sqlite. The second test doesn’t work though, because where’s that file supposed to live? The image is apparently extracted in an unguessable directory, so cannot tell where it is. Am I right? Thanks, Ludo’.
[Message part 2 (text/x-patch, inline)]
diff --git a/tests/pack.scm b/tests/pack.scm index 2cb643f136..7fcae1ec1f 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -39,9 +39,10 @@ (define-module (test-pack) #:use-module ((gnu packages package-management) #:select (rpm)) #:use-module ((gnu packages compression) #:select (squashfs-tools)) #:use-module ((gnu packages debian) #:select (dpkg)) - #:use-module ((gnu packages guile) #:select (guile-sqlite3)) + #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0)) #:use-module ((gnu packages gnupg) #:select (guile-gcrypt)) #:use-module ((gnu packages linux) #:select (fakeroot)) + #:use-module ((ice-9 textual-ports) #:select (get-string-all)) #:use-module (srfi srfi-64)) (define %store @@ -347,7 +348,9 @@ (define rpm-for-tests (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello glibc))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list hello glibc))) (hooks '()) (locales? #f))) (image (self-contained-appimage "hello-appimage" profile @@ -366,34 +369,46 @@ (define rpm-for-tests (lambda (port) (dump-port pipe port))) (exit (status:exit-val (close-pipe pipe))))))))) - (built-derivations (list (pk 'APPIMAGE-drv check))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello, world!\n"))))) (unless store (test-skip 1)) (test-assertm "appimage + localstatedir" (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello glibc))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list guile-3.0 glibc))) (hooks '()) (locales? #f))) - (image (self-contained-appimage "hello-appimage" profile - #:entry-point "bin/hello" + (image (self-contained-appimage "guile-appimage" profile + #:entry-point "bin/guile" #:localstatedir? #t #:extra-options '(#:relocatable? #t))) (check (gexp->derivation - "check-appimage" - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (ice-9 popen) - (guix build utils)) - (let ((pipe (open-pipe* OPEN_READ - #$image "--appimage-extract-and-run"))) - (call-with-output-file #$output - (lambda (port) - (dump-port pipe port))) - (exit (status:exit-val (close-pipe pipe))))))))) - (built-derivations (list (pk 'APPIMAGE-drv check))))) + "check-appimage-with-localstatedir" + #~(begin + (system* #$image "--appimage-extract-and-run" "-c" + (object->string + `(call-with-output-file #$output + (lambda (port) + (display "Hello from Guile!\n" + port))))) + (execl #$image #$image "--appimage-extract-and-run" "-c" + (object->string + '(exit + (pk 'db? (getcwd) + (file-exists? "var/guix/db/db.sqlite"))))))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello from Guile!\n"))))) (unless store (test-skip 1)) (test-assertm "deb archive with symlinks and control files"
guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 19 Dec 2024 00:00:02 GMT) Full text and rfc822 format available.Message #14 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noelopez <at> free.fr> Subject: [PATCH v2 0/2] Fix AppImage tests. Date: Thu, 19 Dec 2024 00:58:13 +0100
From: Noé Lopez <noelopez <at> free.fr> Hi, Thanks you very much for working on the tests, I should have spent more time on them myself. > I noticed that the tests were not going very far, so I tried the patch > below to: (1) check the output of ‘hello’ in the first test, (2) change > the second test to check for the existence of /var/guix/db/db.sqlite. > > The second test doesn’t work though, because where’s that file supposed > to live? The image is apparently extracted in an unguessable directory, > so cannot tell where it is. Am I right? Yes, --appimage-extract-and-run uses a temporary directory but you can use --appimage-extract which always places the contents in ./squashfs-root. The other reason the test did not work is because the localstatedir option wasn’t supported to begin with, this is an oversight that I could have avoided. I’m sending a second version with the localstatedir support and your updated tests. Thanks, Noé Noé Lopez (2): pack: Support localstatedir in AppImage format. build: pack: Fix unexpected type in assert-utf8-local. guix/build/pack.scm | 2 +- guix/scripts/pack.scm | 13 ++++++++++- tests/pack.scm | 51 ++++++++++++++++++++++++++++--------------- 3 files changed, 46 insertions(+), 20 deletions(-) base-commit: bb8a6f0ac47296d3a18e1e0a26ea3a833eb77c4a prerequisite-patch-id: f3798629973582541e158d322c1a461038c657b8 -- 2.46.0
guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 19 Dec 2024 00:01:01 GMT) Full text and rfc822 format available.Message #17 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noe <at> xn--no-cja.eu> Subject: [PATCH v2 1/2] pack: Support localstatedir in AppImage format. Date: Thu, 19 Dec 2024 00:59:39 +0100
From: Noé Lopez <noe <at> xn--no-cja.eu> From: Noé Lopez <noelopez <at> free.fr> * guix/scripts/pack.scm (self-contained-appimage): Support localstatedir option. * tests/pack.scm: Update tests. Change-Id: Ibf4758db890b2db0cff4b663fed6564015e347d1 --- guix/scripts/pack.scm | 13 ++++++++++- tests/pack.scm | 51 ++++++++++++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 58cd55b129..61e2da12e7 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1018,15 +1018,22 @@ (define* (self-contained-appimage name profile compressor-name %valid-compressors))) + (define database + (and localstatedir? + (file-append (store-database (list profile)) + "/db/db.sqlite"))) + (define builder (with-extensions (list guile-gcrypt) (with-imported-modules (source-module-closure '((guix build store-copy) - (guix build utils)) + (guix build utils) + (gnu build install)) #:select? not-config?) #~(begin (use-modules (guix build utils) (guix build store-copy) + (gnu build install) (rnrs io ports) (srfi srfi-1) (srfi srfi-26)) @@ -1060,6 +1067,10 @@ (define* (self-contained-appimage name profile (string-append appdir "/" #$name ".desktop") #:name #$name #:exec #$entry-point) + ;; Install database and gc roots. + (when #+database + ;; Initialize /var/guix. + (install-database-and-gc-roots appdir #+database profile)) ;; Compress the AppDir. (invoke #+(file-append squashfs-tools "/bin/mksquashfs") appdir squashfs "-root-owned" "-noappend" diff --git a/tests/pack.scm b/tests/pack.scm index 2cb643f136..00a8e250ed 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -39,9 +39,10 @@ (define-module (test-pack) #:use-module ((gnu packages package-management) #:select (rpm)) #:use-module ((gnu packages compression) #:select (squashfs-tools)) #:use-module ((gnu packages debian) #:select (dpkg)) - #:use-module ((gnu packages guile) #:select (guile-sqlite3)) + #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0)) #:use-module ((gnu packages gnupg) #:select (guile-gcrypt)) #:use-module ((gnu packages linux) #:select (fakeroot)) + #:use-module ((ice-9 textual-ports) #:select (get-string-all)) #:use-module (srfi srfi-64)) (define %store @@ -347,7 +348,9 @@ (define rpm-for-tests (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello glibc))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list hello glibc))) (hooks '()) (locales? #f))) (image (self-contained-appimage "hello-appimage" profile @@ -366,34 +369,46 @@ (define rpm-for-tests (lambda (port) (dump-port pipe port))) (exit (status:exit-val (close-pipe pipe))))))))) - (built-derivations (list (pk 'APPIMAGE-drv check))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello, world!\n"))))) (unless store (test-skip 1)) (test-assertm "appimage + localstatedir" (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello glibc))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list guile-3.0 glibc))) (hooks '()) (locales? #f))) - (image (self-contained-appimage "hello-appimage" profile - #:entry-point "bin/hello" + (image (self-contained-appimage "guile-appimage" profile + #:entry-point "bin/guile" #:localstatedir? #t #:extra-options '(#:relocatable? #t))) (check (gexp->derivation - "check-appimage" - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (ice-9 popen) - (guix build utils)) - (let ((pipe (open-pipe* OPEN_READ - #$image "--appimage-extract-and-run"))) - (call-with-output-file #$output - (lambda (port) - (dump-port pipe port))) - (exit (status:exit-val (close-pipe pipe))))))))) - (built-derivations (list (pk 'APPIMAGE-drv check))))) + "check-appimage-with-localstatedir" + #~(begin + (system* #$image "--appimage-extract-and-run" "-c" + (object->string + `(call-with-output-file #$output + (lambda (port) + (display "Hello from Guile!\n" + port))))) + (execl #$image #$image "--appimage-extract" "-c" + (object->string + '(exit + (pk 'db? (getcwd) + (file-exists? "squashfs-root/var/guix/db/db.sqlite"))))))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello from Guile!\n"))))) (unless store (test-skip 1)) (test-assertm "deb archive with symlinks and control files" -- 2.46.0
ludo <at> gnu.org, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 19 Dec 2024 00:23:02 GMT) Full text and rfc822 format available.Message #20 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu> To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noelopez <at> free.fr> Subject: [PATCH v3 0/2] tests: pack: Fix AppImage tests. Date: Thu, 19 Dec 2024 01:23:01 +0100
From: Noé Lopez <noelopez <at> free.fr> (messed up git in v2) Hi, Thanks you very much for working on the tests, I should have spent more time on them myself. > I noticed that the tests were not going very far, so I tried the patch > below to: (1) check the output of ‘hello’ in the first test, (2) change > the second test to check for the existence of /var/guix/db/db.sqlite. > > The second test doesn’t work though, because where’s that file supposed > to live? The image is apparently extracted in an unguessable directory, > so cannot tell where it is. Am I right? Yes, --appimage-extract-and-run uses a temporary directory but you can use --appimage-extract which always places the contents in ./squashfs-root. The other reason the test did not work is because the localstatedir option wasn’t supported to begin with, this is an oversight that I could have avoided by knowing what I was doing. I’m sending a second version with the localstatedir support and your updated tests. Thanks, Noé Noé Lopez (2): pack: Support localstatedir in AppImage format. tests: pack: Improve AppImage tests. guix/scripts/pack.scm | 13 +++++++++- tests/pack.scm | 60 +++++++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 15 deletions(-) base-commit: 1a62f687e504c67f26693f3bc60a90e503ab4ea9 -- 2.46.0
guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 19 Dec 2024 00:23:03 GMT) Full text and rfc822 format available.Message #23 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu> To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noe <at> xn--no-cja.eu> Subject: [PATCH v3 1/2] pack: Support localstatedir in AppImage format. Date: Thu, 19 Dec 2024 01:23:02 +0100
From: Noé Lopez <noelopez <at> free.fr> * guix/scripts/pack.scm (self-contained-appimage): Support localstatedir option. Change-Id: I296b3d3e442aa90f36de62a9b23aba4a2c3de9a0 --- guix/scripts/pack.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index d0e66c3013..7f5a5f2aa7 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1018,15 +1018,22 @@ (define* (self-contained-appimage name profile compressor-name %valid-compressors))) + (define database + (and localstatedir? + (file-append (store-database (list profile)) + "/db/db.sqlite"))) + (define builder (with-extensions (list guile-gcrypt) (with-imported-modules (source-module-closure '((guix build store-copy) - (guix build utils)) + (guix build utils) + (gnu build install)) #:select? not-config?) #~(begin (use-modules (guix build utils) (guix build store-copy) + (gnu build install) (rnrs io ports) (srfi srfi-1) (srfi srfi-26)) @@ -1060,6 +1067,10 @@ (define* (self-contained-appimage name profile (string-append appdir "/" #$name ".desktop") #:name #$name #:exec #$entry-point) + ;; Install database and gc roots. + (when #+database + ;; Initialize /var/guix. + (install-database-and-gc-roots appdir #+database profile)) ;; Compress the AppDir. (invoke #+(file-append squashfs-tools "/bin/mksquashfs") appdir squashfs "-root-owned" "-noappend" -- 2.46.0
ludo <at> gnu.org, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 19 Dec 2024 00:23:03 GMT) Full text and rfc822 format available.Message #26 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu> To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noe <at> xn--no-cja.eu> Subject: [PATCH v3 2/2] tests: pack: Improve AppImage tests. Date: Thu, 19 Dec 2024 01:23:03 +0100
From: Noé Lopez <noelopez <at> free.fr> * tests/pack.scm: Improve AppImage tests. Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c --- tests/pack.scm | 60 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/tests/pack.scm b/tests/pack.scm index 1c1e312557..4eac98fbdd 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017-2021, 2023 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2017-2021, 2023, 2024 Ludovic Courtès <ludo <at> gnu.org> ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net> ;;; Copyright © 2021, 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> ;;; Copyright © 2023 Oleg Pykhalov <go.wigust <at> gmail.com> @@ -34,14 +34,15 @@ (define-module (test-pack) #:use-module ((guix build utils) #:select (%store-directory)) #:use-module (gnu packages) #:use-module ((gnu packages base) #:select (libc-utf8-locales-for-target - hello)) + hello glibc)) #:use-module (gnu packages bootstrap) #:use-module ((gnu packages package-management) #:select (rpm)) #:use-module ((gnu packages compression) #:select (squashfs-tools)) #:use-module ((gnu packages debian) #:select (dpkg)) - #:use-module ((gnu packages guile) #:select (guile-sqlite3)) + #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0)) #:use-module ((gnu packages gnupg) #:select (guile-gcrypt)) #:use-module ((gnu packages linux) #:select (fakeroot)) + #:use-module ((ice-9 textual-ports) #:select (get-string-all)) #:use-module (srfi srfi-64)) (define %store @@ -347,36 +348,67 @@ (define rpm-for-tests (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list hello glibc))) (hooks '()) (locales? #f))) (image (self-contained-appimage "hello-appimage" profile #:entry-point "bin/hello" #:extra-options - (list #:relocatable? #t))) + '(#:relocatable? #t))) (check (gexp->derivation "check-appimage" - #~(invoke #$image)))) - (built-derivations (list check)))) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (ice-9 popen) + (guix build utils)) + (let ((pipe (open-pipe* OPEN_READ + #$image "--appimage-extract-and-run"))) + (call-with-output-file #$output + (lambda (port) + (dump-port pipe port))) + (exit (status:exit-val (close-pipe pipe))))))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello, world!\n"))))) (unless store (test-skip 1)) (test-assertm "appimage + localstatedir" (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list guile-3.0 glibc))) (hooks '()) (locales? #f))) - (image (self-contained-appimage "hello-appimage" profile - #:entry-point "bin/hello" + (image (self-contained-appimage "guile-appimage" profile + #:entry-point "bin/guile" #:localstatedir? #t #:extra-options - (list #:relocatable? #t))) + '(#:relocatable? #t))) (check (gexp->derivation - "check-appimage" + "check-appimage-with-localstatedir" #~(begin - (invoke #$image))))) - (built-derivations (list check)))) + (system* #$image "--appimage-extract-and-run" "-c" + (object->string + `(call-with-output-file #$output + (lambda (port) + (display "Hello from Guile!\n" + port))))) + (execl #$image #$image "--appimage-extract" + (object->string + '(exit + (pk 'db? (getcwd) + (file-exists? "squashfs-root/var/guix/db/db.sqlite"))))))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello from Guile!\n"))))) (unless store (test-skip 1)) (test-assertm "deb archive with symlinks and control files" -- 2.46.0
guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Mon, 23 Dec 2024 18:38:02 GMT) Full text and rfc822 format available.Message #29 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Noé Lopez <noe <at> xn--no-cja.eu> Cc: 74670 <at> debbugs.gnu.org Subject: Re: [bug#74670] [PATCH v3 2/2] tests: pack: Improve AppImage tests. Date: Mon, 23 Dec 2024 19:37:34 +0100
Hi Noé, Noé Lopez <noe <at> noé.eu> skribis: > From: Noé Lopez <noelopez <at> free.fr> > > * tests/pack.scm: Improve AppImage tests. > > Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c [...] > + (system* #$image "--appimage-extract-and-run" "-c" > + (object->string > + `(call-with-output-file #$output > + (lambda (port) > + (display "Hello from Guile!\n" > + port))))) > + (execl #$image #$image "--appimage-extract" > + (object->string > + '(exit > + (pk 'db? (getcwd) > + (file-exists? "squashfs-root/var/guix/db/db.sqlite"))))))))) The second part here does nothing: you can place any other file name and it still exits successfully. Looking at an strace, I think ‘--appimage-extract’ does next to nothing: essentially it reads /proc/self/exe, create an empty “squashfs-root” directory, and exits. Could you check exactly what’s happening? We’re getting really close! Thanks, Ludo’.
ludo <at> gnu.org, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 23 Jan 2025 20:26:01 GMT) Full text and rfc822 format available.Message #32 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu> To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noelopez <at> free.fr> Subject: [PATCH v4 0/2] tests: pack: Fix AppImage tests. Date: Thu, 23 Jan 2025 21:26:23 +0100
From: Noé Lopez <noelopez <at> free.fr> Hi, Here is a working version of the tests, though I don’t really understand why the tests are GEXPs? What is the point of using #$output and checking outside of the gexp instead of just using assert? And why do I need to use #$output in order for the test to run? Thanks, Noé Noé Lopez (2): pack: Support localstatedir in AppImage format. tests: pack: Improve AppImage tests. guix/scripts/pack.scm | 13 +++++++++- tests/pack.scm | 58 ++++++++++++++++++++++++++++++++----------- 2 files changed, 56 insertions(+), 15 deletions(-) base-commit: 1a62f687e504c67f26693f3bc60a90e503ab4ea9 -- 2.47.1
guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 23 Jan 2025 20:26:02 GMT) Full text and rfc822 format available.Message #35 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu> To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noe <at> xn--no-cja.eu> Subject: [PATCH v4 1/2] pack: Support localstatedir in AppImage format. Date: Thu, 23 Jan 2025 21:26:24 +0100
From: Noé Lopez <noelopez <at> free.fr> * guix/scripts/pack.scm (self-contained-appimage): Support localstatedir option. Change-Id: I296b3d3e442aa90f36de62a9b23aba4a2c3de9a0 --- guix/scripts/pack.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index d0e66c3013..7f5a5f2aa7 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1018,15 +1018,22 @@ (define* (self-contained-appimage name profile compressor-name %valid-compressors))) + (define database + (and localstatedir? + (file-append (store-database (list profile)) + "/db/db.sqlite"))) + (define builder (with-extensions (list guile-gcrypt) (with-imported-modules (source-module-closure '((guix build store-copy) - (guix build utils)) + (guix build utils) + (gnu build install)) #:select? not-config?) #~(begin (use-modules (guix build utils) (guix build store-copy) + (gnu build install) (rnrs io ports) (srfi srfi-1) (srfi srfi-26)) @@ -1060,6 +1067,10 @@ (define* (self-contained-appimage name profile (string-append appdir "/" #$name ".desktop") #:name #$name #:exec #$entry-point) + ;; Install database and gc roots. + (when #+database + ;; Initialize /var/guix. + (install-database-and-gc-roots appdir #+database profile)) ;; Compress the AppDir. (invoke #+(file-append squashfs-tools "/bin/mksquashfs") appdir squashfs "-root-owned" "-noappend" -- 2.47.1
ludo <at> gnu.org, guix-patches <at> gnu.org
:bug#74670
; Package guix-patches
.
(Thu, 23 Jan 2025 20:26:02 GMT) Full text and rfc822 format available.Message #38 received at 74670 <at> debbugs.gnu.org (full text, mbox):
From: Noé Lopez <noe <at> xn--no-cja.eu> To: 74670 <at> debbugs.gnu.org Cc: Noé Lopez <noe <at> xn--no-cja.eu> Subject: [PATCH v4 2/2] tests: pack: Improve AppImage tests. Date: Thu, 23 Jan 2025 21:26:25 +0100
From: Noé Lopez <noelopez <at> free.fr> * tests/pack.scm: Improve AppImage tests. Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c --- tests/pack.scm | 58 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/tests/pack.scm b/tests/pack.scm index 1c1e312557..1651fa4440 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017-2021, 2023 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2017-2021, 2023, 2024 Ludovic Courtès <ludo <at> gnu.org> ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net> ;;; Copyright © 2021, 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> ;;; Copyright © 2023 Oleg Pykhalov <go.wigust <at> gmail.com> @@ -34,14 +34,15 @@ (define-module (test-pack) #:use-module ((guix build utils) #:select (%store-directory)) #:use-module (gnu packages) #:use-module ((gnu packages base) #:select (libc-utf8-locales-for-target - hello)) + hello glibc)) #:use-module (gnu packages bootstrap) #:use-module ((gnu packages package-management) #:select (rpm)) #:use-module ((gnu packages compression) #:select (squashfs-tools)) #:use-module ((gnu packages debian) #:select (dpkg)) - #:use-module ((gnu packages guile) #:select (guile-sqlite3)) + #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0)) #:use-module ((gnu packages gnupg) #:select (guile-gcrypt)) #:use-module ((gnu packages linux) #:select (fakeroot)) + #:use-module ((ice-9 textual-ports) #:select (get-string-all)) #:use-module (srfi srfi-64)) (define %store @@ -347,36 +348,65 @@ (define rpm-for-tests (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list hello glibc))) (hooks '()) (locales? #f))) (image (self-contained-appimage "hello-appimage" profile #:entry-point "bin/hello" #:extra-options - (list #:relocatable? #t))) + '(#:relocatable? #t))) (check (gexp->derivation "check-appimage" - #~(invoke #$image)))) - (built-derivations (list check)))) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (ice-9 popen) + (guix build utils)) + (let ((pipe (open-pipe* OPEN_READ + #$image "--appimage-extract-and-run"))) + (call-with-output-file #$output + (lambda (port) + (dump-port pipe port))) + (exit (status:exit-val (close-pipe pipe))))))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello, world!\n"))))) (unless store (test-skip 1)) (test-assertm "appimage + localstatedir" (mlet* %store-monad ((guile (set-guile-for-build (default-guile))) (profile -> (profile - (content (packages->manifest (list %bootstrap-guile hello))) + ;; When using '--appimage-extract-and-run', the dynamic + ;; linker is necessary, hence glibc below. + (content (packages->manifest (list guile-3.0 glibc))) (hooks '()) (locales? #f))) - (image (self-contained-appimage "hello-appimage" profile - #:entry-point "bin/hello" + (image (self-contained-appimage "guile-appimage" profile + #:entry-point "bin/guile" #:localstatedir? #t #:extra-options - (list #:relocatable? #t))) + '(#:relocatable? #t))) (check (gexp->derivation - "check-appimage" + "check-appimage-with-localstatedir" #~(begin - (invoke #$image))))) - (built-derivations (list check)))) + (use-modules (rnrs base)) + (system* #$image "--appimage-extract-and-run" "-c" + (object->string + `(call-with-output-file #$output + (lambda (port) + (display "Hello from Guile!\n" + port))))) + (system* #$image "--appimage-extract") + (assert (file-exists? "squashfs-root/var/guix/db/db.sqlite")))))) + (mbegin %store-monad + (built-derivations (list (pk 'APPIMAGE-drv check))) + (return (string=? (call-with-input-file (derivation->output-path check) + get-string-all) + "Hello from Guile!\n"))))) (unless store (test-skip 1)) (test-assertm "deb archive with symlinks and control files" -- 2.47.1
Ludovic Courtès <ludo <at> gnu.org>
:Noé Lopez <noe <at> xn--no-cja.eu>
:Message #43 received at 74670-done <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Noé Lopez <noe <at> xn--no-cja.eu> Cc: 74670-done <at> debbugs.gnu.org, Noé Lopez <noelopez <at> free.fr> Subject: Re: [bug#74670] [PATCH v4 0/2] tests: pack: Fix AppImage tests. Date: Fri, 24 Jan 2025 23:52:35 +0100
[Message part 1 (text/plain, inline)]
Hi, Noé Lopez <noe <at> noé.eu> skribis: > Here is a working version of the tests, though I don’t really understand why > the tests are GEXPs? The tests build derivations, each of which runs Guile code; that Guile code is represented as gexps because it is staged to be executed when those derivations get built. > What is the point of using #$output and checking outside of the gexp instead > of just using assert? And why do I need to use #$output in order for the test > to run? If you do (gexp->derivation "foo" #~(display "hi!")), you end up with a derivation with zero outputs. In that case, its builder is never executed because we know in advance that it won’t produce anything. If you do (gexp->derivation "bar" #~(pk #$output)), then the resulting derivation has one output, “out”. > pack: Support localstatedir in AppImage format. > tests: pack: Improve AppImage tests. Applied with the cosmetic change below. Thanks! Ludo’.
[Message part 2 (text/x-patch, inline)]
diff --git a/tests/pack.scm b/tests/pack.scm index 1651fa4440..9c7e0a50ba 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -393,7 +393,6 @@ (define rpm-for-tests (check (gexp->derivation "check-appimage-with-localstatedir" #~(begin - (use-modules (rnrs base)) (system* #$image "--appimage-extract-and-run" "-c" (object->string `(call-with-output-file #$output @@ -401,7 +400,7 @@ (define rpm-for-tests (display "Hello from Guile!\n" port))))) (system* #$image "--appimage-extract") - (assert (file-exists? "squashfs-root/var/guix/db/db.sqlite")))))) + (exit (file-exists? "squashfs-root/var/guix/db/db.sqlite")))))) (mbegin %store-monad (built-derivations (list (pk 'APPIMAGE-drv check))) (return (string=? (call-with-input-file (derivation->output-path check)
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sat, 22 Feb 2025 12:24:31 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.