From patchwork Thu Dec 19 00:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?No=C3=A9_Lopez?= X-Patchwork-Id: 35024 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id EC64C27BBEA; Thu, 19 Dec 2024 00:23:23 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A9BD627BBE2 for ; Thu, 19 Dec 2024 00:23:23 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO4Jl-0001Gz-Fq; Wed, 18 Dec 2024 19:23:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tO4Jj-0001G3-TD for guix-patches@gnu.org; Wed, 18 Dec 2024 19:23:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tO4Jj-0006MN-KD; Wed, 18 Dec 2024 19:23:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=7MpDuXpGYIEpbbqNG1QCrmCNBR+PKZUG5gD02OD9aLQ=; b=kAmdMIB3ZYISkmE/+MreWIOXr+o9cNYD8vFqm5IkIswP38J2ljOotyGtlIz1kWkbPLO2DheCtZTmAG24YOyJMMT4MIAsK9SCYonpfuOEyJp5lzgEJMXdWoy+y7RHRXWBxLyGcR2PkFo88+4X9B0tzIp6ZxuY3RpS4+HHtq2n0AMbl/7VgmfH9JFPZ5Zze1xwmniMq2TVdGYVz/0bS4WZ9u1w9WIR2FZuMkWXCPA+M9bDDcR6xRzXw5kVZ6B1vvt6EQjP+qcJbf4DvRK9ONr5ltfR36eRdU9y7khZtVmXc9Au7i5oz0xUnw6ekoWWnn8LwdsLEIuVMWMUGLeNQTd+Sg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tO4Jj-0002EC-3f; Wed, 18 Dec 2024 19:23:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74670] [PATCH v3 1/2] pack: Support localstatedir in AppImage format. Resent-From: =?utf-8?q?No=C3=A9?= Lopez Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 19 Dec 2024 00:23:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74670 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74670@debbugs.gnu.org Cc: =?utf-8?q?No=C3=A9?= Lopez , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 74670-submit@debbugs.gnu.org id=B74670.17345677278440 (code B ref 74670); Thu, 19 Dec 2024 00:23:03 +0000 Received: (at 74670) by debbugs.gnu.org; 19 Dec 2024 00:22:07 +0000 Received: from localhost ([127.0.0.1]:36531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO4Ip-0002C2-2z for submit@debbugs.gnu.org; Wed, 18 Dec 2024 19:22:07 -0500 Received: from smtp.domeneshop.no ([194.63.252.55]:41233) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO4In-0002BD-H3 for 74670@debbugs.gnu.org; Wed, 18 Dec 2024 19:22:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xn--no-cja.eu; s=ds202402; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=7MpDuXpGYIEpbbqNG1QCrmCNBR+PKZUG5gD02OD9aLQ=; b=n oqeHkeKAZySEYRHad22VYOJk6fR1il3xRWB2D7Iennd7mqx/lHqajOQJmLbiyY+/wSJW3+7tUSJpW KKhkpgUZWZbYZhGuw/EKOKUX0d7Hf3VAMI/QJNWewotVCAuh7ckgkk70VczRBqfjoBa3Ni3wvQJYT RGsCO6+xzJ79eS2NGxEU15ir5K7Cj4yYfL0DTYM1pF1QLR3mjQDimkb+mjerWu1FryuMWWm13zeQs ccfLUX1zfhXcs8dwpTZJ3vKxajgxU62icUjW861fQu14ldQKcxV7puM9FmBV7csshQdYp3o0ofoqE hGTWZCImwDjyRFWMkUtV351q6gZVjwhyg==; Received: from smtp by smtp.domeneshop.no with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) id 1tO4Ih-00CPhh-FZ; Thu, 19 Dec 2024 01:21:59 +0100 Date: Thu, 19 Dec 2024 01:23:02 +0100 Message-ID: <91137c795a6d4ac347893a7388fba240962225ef.1734566923.git.noelopez@free.fr> In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: =?utf-8?q?No=C3=A9?= Lopez X-ACL-Warn: , =?utf-8?q?No=C3=A9_Lopez_via_Guix-patches?= X-Patchwork-Original-From: =?utf-8?q?No=C3=A9_Lopez_via_Guix-patches?= via From: =?utf-8?q?No=C3=A9_Lopez?= Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Noé Lopez * 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" From patchwork Thu Dec 19 00:23:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?No=C3=A9_Lopez?= X-Patchwork-Id: 35025 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5508827BBEA; Thu, 19 Dec 2024 00:23:34 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B774727BBE2 for ; Thu, 19 Dec 2024 00:23:33 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO4Jl-0001Gx-FD; Wed, 18 Dec 2024 19:23:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tO4Jk-0001GA-2f for guix-patches@gnu.org; Wed, 18 Dec 2024 19:23:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tO4Jj-0006Mw-Pr; Wed, 18 Dec 2024 19:23:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=nDMMbeuBcHQ7jtu87PmbEm7tUXhID5o/acnNvAP3uE4=; b=sVqeWFdAA3lr9/Y531TrJNofTogisQGgvBZLjcHfmp0GgaENvJa81PE3YoLHN/PfWQuDAlJ4m4ohmYL06xdb97QRy+mbUF/nqlbf4KxB6gaVGXaj/djqa5fTSDbWNW3Fm6D+6UMrIl66pu1Mk+F453py2o/4TUIGgZA8l6vWOCEhG7WO1iKv2opv0orcWLvhmD/wBYnA7SkUTMvzEAzBiCpB+G6zdCrwgVI3jTUEJytaL80CdpA1sGBzU/ETdpjgHOxkNPdMsDaOmAmAQwfEM8iVoetUG9dyTQABVbOxQvE7KVV1nvJMbqte3KRYVROyyaRjp/JtLRPvzo1LYJw9NA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tO4Jj-0002EK-Ky; Wed, 18 Dec 2024 19:23:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74670] [PATCH v3 2/2] tests: pack: Improve AppImage tests. Resent-From: =?utf-8?q?No=C3=A9?= Lopez Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Thu, 19 Dec 2024 00:23:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74670 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74670@debbugs.gnu.org Cc: =?utf-8?q?No=C3=A9?= Lopez , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 74670-submit@debbugs.gnu.org id=B74670.17345677338457 (code B ref 74670); Thu, 19 Dec 2024 00:23:03 +0000 Received: (at 74670) by debbugs.gnu.org; 19 Dec 2024 00:22:13 +0000 Received: from localhost ([127.0.0.1]:36534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO4Iu-0002CK-DY for submit@debbugs.gnu.org; Wed, 18 Dec 2024 19:22:12 -0500 Received: from smtp.domeneshop.no ([194.63.252.55]:45471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO4Ip-0002Bc-CQ for 74670@debbugs.gnu.org; Wed, 18 Dec 2024 19:22:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xn--no-cja.eu; s=ds202402; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=nDMMbeuBcHQ7jtu87PmbEm7tUXhID5o/acnNvAP3uE4=; b=o RI4ueF45mlF3Jh8n9dU95WTTG6NHAd5x2uuNoBXWl34FoC8zcv73emx5TnF7oKv43EHU24Std0WB0 E0NSg3FLLU16V5Tq0LgqZlxcPI+0kWKctrQ+tKZ4Dfu37qEr067xzAZRWGebbS+Ev6ruXPWq3pKqj 37ZNfRrIfbxNlHI+8oA3JfUH5lxIF9OpmWyOVbbdYAuNvddkYSV4IqabO7J1XkAxJgnhLFloaE3yR RDuSFlvcBXbtxL2NDjNCOjGeeP5HM9vMhz/cWYX0UJ0H5D8GkhdEOabmeASJxPQty7Wx7O0bnKRuq Jnv6krLxflceN2S8R3AN0XkJVJSLmAbKg==; Received: from smtp by smtp.domeneshop.no with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) id 1tO4Ij-00CPhh-N2; Thu, 19 Dec 2024 01:22:01 +0100 Date: Thu, 19 Dec 2024 01:23:03 +0100 Message-ID: <7faf45d433e43621cbf3194f306e0177d21679f2.1734566923.git.noelopez@free.fr> In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: =?utf-8?q?No=C3=A9?= Lopez X-ACL-Warn: , =?utf-8?q?No=C3=A9_Lopez_via_Guix-patches?= X-Patchwork-Original-From: =?utf-8?q?No=C3=A9_Lopez_via_Guix-patches?= via From: =?utf-8?q?No=C3=A9_Lopez?= Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Noé Lopez * 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 +;;; Copyright © 2017-2021, 2023, 2024 Ludovic Courtès ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2021, 2023 Maxim Cournoyer ;;; Copyright © 2023 Oleg Pykhalov @@ -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"