From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id cAK+FV1iY2cilgAA62LTzQ:P1 (envelope-from ) for ; Thu, 19 Dec 2024 00:01:33 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id cAK+FV1iY2cilgAA62LTzQ (envelope-from ) for ; Thu, 19 Dec 2024 01:01:33 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="qnQav/0d"; dkim=fail ("headers rsa verify failed") header.d=xn--no-cja.eu header.s=ds202402 header.b="P /l2BlW"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734566493; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=q3phKICaYVo+VkNOI0zbut4jpHPWsvJy3+SCbDLOjLw=; b=rvdmBQWwu2EpKpaKZ4j72ujHdUMNc6toIPTuXqQM07N2FtJ+2gHPl7s8bOcTQ4rRK8DiDx oDJlR9P3KX4Fqm20a+5rbb6vgTJUibKOPVPSh1bvcgGwYQJ5w9y+7Ytomp4qzJbaZl4v9e 8y9vjQeJ1hW9yU2W2Y/2bJnESNBqRHVRFyYxCuAsBdmncs9AUbC4hQc5bOXhC9KfKiPRgu HWIXQqevEIdOu3uJmvWC5VDROLJV8dqMI87fJ0GFIrzEQvhtSACAGMjTvZeW7XwVsnEOzU nULfB0YTQ0Qe6jz6Qh4OeF+ZLiemUwEE8GgcmIoXgfIrSt/AgEKVGgAeR204eQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734566493; a=rsa-sha256; cv=none; b=ihw0J33cojwXWjWcQ21NNzha1RTj8Pb5F1zAMoL2BkGCnfXdEgcI140wZ2TrG6airvGjNi EAeuCfWMPY3JbWZThMiYDaa4HVyjMPG0zA7sVvDnNhP6PZeuJ1jQtJkXHmJ/BW4cTnH18m UcMxlf6K8Ui7vFCQleCmB7/65bRGZHeMjPGpfuXABz2i6axHWhdAzSHymo7qr785BORGZf qcyXdKmqRUK0qmqk3DfL5sEGJHdLAy9e9P8k9bgjNgcjTPn99vaziLApc9IPFvuZkQc++7 9/XRCzNzzWcYgFC41W3HD9RiMWYwUrpjPz9PrkUGCjR70YKMK0B6ekMzfgsnKQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="qnQav/0d"; dkim=fail ("headers rsa verify failed") header.d=xn--no-cja.eu header.s=ds202402 header.b="P /l2BlW"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A08EA19FE3 for ; Thu, 19 Dec 2024 01:01:32 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO3yW-00043E-88; Wed, 18 Dec 2024 19:01:08 -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 1tO3yU-00042Q-Jr for guix-patches@gnu.org; Wed, 18 Dec 2024 19:01:06 -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 1tO3yT-00015a-8c; Wed, 18 Dec 2024 19:01:05 -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=q3phKICaYVo+VkNOI0zbut4jpHPWsvJy3+SCbDLOjLw=; b=qnQav/0dB5dCzAQq660RwSb3K3FrGLHByhTxDIisHZk57dL9hoHrgJUR9WBK4673zKN/3RliTOscDRbihWcdQgK0mBv3pOdQLlVkW/JGJ52F49pYiaYgmSOEtVeTupIWK+9JSwFEpZdV1vqNtd/hZu0so+lmhicGGO7OjUEqpOh7DrFSY4ZqAovWl5i97Pzpc3VGG6XmS2Zcew5VQqP2qu5o6RDU47X9k03uLuCro8W+pGTl7Ewv/Az862qds14IpZDQTRH2p9PYeu91sidqoK7vtS93VAfkdn9LymD3ZWtXDCXmxsyTPqdk5mcOfRu2TZ611t2MW9I/ERtTzyFEQQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tO3yP-00017b-Ml; Wed, 18 Dec 2024 19:01:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74670] [PATCH v2 1/2] pack: Support localstatedir in AppImage format. Resent-From: =?UTF-8?Q?No=C3=A9?= Lopez 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:01:01 +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.17345664504277 (code B ref 74670); Thu, 19 Dec 2024 00:01:01 +0000 Received: (at 74670) by debbugs.gnu.org; 19 Dec 2024 00:00:50 +0000 Received: from localhost ([127.0.0.1]:36489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO3yD-00016t-EW for submit@debbugs.gnu.org; Wed, 18 Dec 2024 19:00:49 -0500 Received: from smtp.domeneshop.no ([194.63.252.55]:56275) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO3yB-00016d-Qy for 74670@debbugs.gnu.org; Wed, 18 Dec 2024 19:00:48 -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=q3phKICaYVo+VkNOI0zbut4jpHPWsvJy3+SCbDLOjLw=; b=P /l2BlW8IUfdIv8dfKdJz0NLh08p8EMTh+x8E/xoFKorOaYBniKPpRps81eT6FO33eyik6ZLTj4oXI 7zAqgma0GmgzLDIF9Yoxaj0xPJnQWuCG4jNjFWwWE+TjMBkn9gLqxo28nKg/DAkNNoVpHMFbhlb5D 6PCJ6+gQWxHC4n9vZa10LZC1SwZytrm0eyusIKhi+iJ7GvswWM4JSIlM9fyvHJygAEH/8s8/M4Zzg 6QTmJbdQuSayPwXQErrcDMk2b8dU4j4MfQnQBmFhz234NtgJwE0QqvRUh464ukAaYxvvgLCgyb1pK xkDyvn8PHOJoGbnc6jxuLBrGpXOLUS5pw==; Received: from smtp by smtp.domeneshop.no with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) id 1tO3vz-00CMYy-QK; Thu, 19 Dec 2024 00:58:31 +0100 Date: Thu, 19 Dec 2024 00:59:39 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: , From: =?utf-8?q?No=C3=A9_Lopez_via_Guix-patches?= Reply-To: =?UTF-8?Q?No=C3=A9?= Lopez Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -3.81 X-Spam-Score: -3.81 X-Migadu-Queue-Id: A08EA19FE3 X-TUID: pEvtrWQwxR1h From: Noé Lopez From: Noé Lopez * 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