From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id +M7MEelSEmeJEQEAe85BDQ:P1 (envelope-from ) for ; Fri, 18 Oct 2024 12:22:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id +M7MEelSEmeJEQEAe85BDQ (envelope-from ) for ; Fri, 18 Oct 2024 14:22:01 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=Q47x+BOu; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=OfiN5lXb; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729254121; h=from:from:sender:sender: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=FZig0L6nBWXB0UEtObhE8Ki2ZR29UOb0h4fJ2FLmdSY=; b=cymF8kOGMqNrXdMzLur67skhw2XiJmo/VNMSIf3C7nIC0EL1uVI3Ms1qDsm/Q0FnC03PB7 fOqtxwNu0Z1Yz5ool0o2QcsF7QPr56dilK2lYxyRPN0gdl2ZeTfjFD6Ate1+RV7JVh2mGJ 7hW+oEuKFrKtlLJvvfFwrRKKepuMNYjDCZdhukWtKrpkxr+Z3qwew09DpilrT6akptwH6g RHzzSOBFRsk/Tm0fKQ0k/pxBhGzkyqRfhW+kkPqvZik40WgOBA6T1M1jOEtvW9j6ft4Udj aeToi4YHasj8YBqSnd26E/ssXuMRAJ3zoj/OqILkDu2VKL+xgz3oDpqoilQx3w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=Q47x+BOu; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=OfiN5lXb; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729254121; a=rsa-sha256; cv=none; b=U/DlSihkaXYugWnv5Aj9scZzvmektoeVmsyaOdnw41nKs3hClbx8QlvkI8N5mWbw1QCT6l 0EP4PInRLQLYr2Wo2CuBNW23N+BmFTMcnlGWE3cyMNgJJDSrZF0Oi7+4DU16Yg5RFr6c37 gaFwtTRh2x95T/uRAxAUY/CXJKWoCsIvel6MKiW6Wf8M7UrhBR8OgWZC1l/igYWfSyrDWs TviiwX0f3bZTbtHXrUOGGkQoRqL52l1+uZ4Zw8zQkqi2UZ1DCjrNj1XKBpTjZ2G+/1hKdh 3XTya+kPum+azZhD9kS/VrzjyUr2+89u2wIgWeC3rcD1ZOgyL1tYHqnRB4fE1w== 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 5920C89773 for ; Fri, 18 Oct 2024 14:21:59 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1lzB-00027r-MW; Fri, 18 Oct 2024 08:21:41 -0400 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 1t1lzA-00027j-M3 for guix-patches@gnu.org; Fri, 18 Oct 2024 08:21:40 -0400 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 1t1lzA-00059l-8T for guix-patches@gnu.org; Fri, 18 Oct 2024 08:21:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=FZig0L6nBWXB0UEtObhE8Ki2ZR29UOb0h4fJ2FLmdSY=; b=Q47x+BOusCh1mngaiTxSRCXhD32Yuq/W7G/Yk9RTtApjXPvsd7lZuSllfgXDvzuJMma3EhndiO5g4TMwsgFxLOg1JdCzzQd1K9Z38aiWG72e7a9ImY8cXLndMHNJ9krDWoLLMOm+3v10nOoQ+My1W2PU1YqVN1zHivPy/um+U7pa/EAUt+lTGGSJBlc4VdBpfne5HJZqLY4wP1g552LEHn6CxM09c4J8DJy5MABqUttO3vvxx/yeBz/7/Ye4Z9qo6NX1DM37sLn5L3olWvC9CTLratGeZh1c/rL3u3BfRHe36PlllVXtDO5rsXI3VLp9hzr0R/rsBuUYJIe70WIX/w==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t1lzW-0004dl-GB for guix-patches@gnu.org; Fri, 18 Oct 2024 08:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73842] [PATCH] pack: Add support for AppImage pack format. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Oct 2024 12:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73842 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?No=C3=A9?= Lopez Cc: Josselin Poiret , 73842@debbugs.gnu.org, Maxim Cournoyer , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , Sebastian =?UTF-8?Q?D=C3=BCmcke?= , Christopher Baines Received: via spool by 73842-submit@debbugs.gnu.org id=B73842.172925407317750 (code B ref 73842); Fri, 18 Oct 2024 12:22:02 +0000 Received: (at 73842) by debbugs.gnu.org; 18 Oct 2024 12:21:13 +0000 Received: from localhost ([127.0.0.1]:37352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1lyi-0004cD-TR for submit@debbugs.gnu.org; Fri, 18 Oct 2024 08:21:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1lyf-0004bx-W0 for 73842@debbugs.gnu.org; Fri, 18 Oct 2024 08:21:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1ly9-00056K-UH; Fri, 18 Oct 2024 08:20:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=FZig0L6nBWXB0UEtObhE8Ki2ZR29UOb0h4fJ2FLmdSY=; b=OfiN5lXbvfhI+IB5xnMX C10KDcpcK9EwBJi9MDM9JEd6e618d0jLpJb+oSzF9YM92A80n6A80lgZZKsJv8KqDAnh3WTXfvCR8 DeVIl811bRJf0pBn8JAJ0xRBR3LMOqAzZqOf6nmogkUsKyjcf1aqWTfQrMFB0tQJG1KA3V0ZdJZWV naoXYnFrSaGDGIeyMRQdY/iM24tmaxggtVKsshbCwSlcx/4MIc6smwLo6lHOKlvWOaJtC4CMWFfAD O5ms9vaPobc1+uPMFO0gho4VNdbKkV0swX5yUcyNdCdR1z1+/INHNO0r51fPOFoQ8KivJS+WiQkGW AeX+0uDeH7K79w==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: ("=?UTF-8?Q?No=C3=A9?= Lopez"'s message of "Wed, 16 Oct 2024 23:51:30 +0200") References: Date: Fri, 18 Oct 2024 14:20:33 +0200 Message-ID: <877ca5r4a6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 1.29 X-Spam-Score: 1.29 X-Migadu-Queue-Id: 5920C89773 X-TUID: 8ALc1coXrmXX Hi No=C3=A9 & Sebastian, No=C3=A9 Lopez skribis: > From: Sebastian D=C3=BCmcke > > * guix/scripts/pack.scm: Add Appimage format. > * gnu/packages/appimage.scm > (gnu packages appimage): New module. > (fuse-for-appimage, squashfuse-for-appimage) > (appimage-type2-runtime): New variables. > * doc/guix.texi: Document AppImage pack. > > Co-authored-by: No=C3=A9 Lopez > Change-Id: I09f1241dfb9b267f94dce59914dea527d35ac60e [...] > This patch adds a new AppImage export format to =C2=AB=C2=A0guix pack=C2= =A0=C2=BB. This > enables guix users to easily share packets or environments with their > peers that don=E2=80=99t have guix via a statically linked, runs-everywhe= re > executable. > > Sebastian and I co-authored this patch, I did the runtime packaging > and Sebastian did the actual command. I=E2=80=99ve personally tested the > generated AppImages with my friend=E2=80=99s various distros, they work g= reat! Nice work! Overall looks great to me. What follows are pretty minor suggestions. > +@cindex AppImage, create an AppImage file with guix pack s/guix pack/@command{guix pack}/ > +Another format internally based on SquashFS is > +@uref{https://appimage.org/, AppImage}. An AppImage file can be made ^ Nitpick: please leave two spaces after end-of-sentence periods throughout this patch. > +The resulting AppImage does not conform to the complete standard as it > +currently does not contain a @code{.DirIcon} file. This does not impact s/@code/@file/ > +@quotation Warning > +Unless @option{--relocatable} is used, the software will contain > +references to items inside the guix store, which are not present on > +systems without Guix. It is recommended to use @option{--relocatable} > +when distributing software to 3rd parties. A warning is printed when > +this option is not used. I would it perhaps more upfront, like: When building an AppImage, always @emph{pass} the @option{--relocatable} option (or @option{-R}, or @option{-RR}) to make sure the image can be used on systems where Guix is not installed. In practice, if Guix is installed but the image=E2=80=99s dependencies are = not in the store, it won=E2=80=99t work either. So I think the =E2=80=9Calways= =E2=80=9D bit is not exaggerated. WDYT? > +++ b/gnu/packages/appimage.scm Could you add this file as a separate commit, before the one adding AppImage support to =E2=80=98guix pack=E2=80=99? > + (arguments > + `(#:configure-flags ,#~(list (string-append "-Dudevrulesdir=3D" > + #$output "/udev/rules.d= ") > + "-Duseroot=3Dfalse" "--default-library= =3Dstatic") > + #:tests? #f Please add a short comment explaining why tests are skipped. > + #:phases ,#~(modify-phases %standard-phases The recommended style is to avoid quasiquote/unquote and instead write: (arguments (list #:configure-flags =E2=80=A6 #:phases #~(=E2=80=A6))) > + (add-before 'configure 'set-paths > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (let ((dummy-init.d (string-append (getcwd) > + "/etc/init.d= "))) > + (setenv "MOUNT_FUSE_PATH" > + (string-append #$output "/sbin")) > + (setenv "UDEV_RULES_PATH" > + (string-append #$output "/lib/udev/ru= les.d")))))))))) Maybe call this phase =E2=80=98set-fuse+udev+paths=E2=80=99, to avoid confu= sion with the standard =E2=80=98set-paths=E2=80=99 phase. > +(define squashfuse-for-appimage > + (let ((revision "0") > + (commit "e51978cd6bb5c4d16fae9eee43d0b258f570bb0f")) > + (package > + (inherit squashfuse) > + (name "squashfuse") > + (version (git-version "0.1.104" revision commit)) Can you add a comment explaining why this specific commit is needed? That way, our future selves will know when =E2=80=98squashfuse-for-appimage= =E2=80=99 can be removed. > +(define-public appimage-type2-runtime > + (let ((revision "0") > + (commit "47b665594856b4e8928f8932adcf6d13061d8c30")) > + (package > + (name "appimage-type2-runtime") Likewise. > + #:phases #~(modify-phases %standard-phases > + (delete 'configure) > + (delete 'check) > + (replace 'install > + (lambda _ > + (install-file "src/runtime/runtime-fuse3" > + (string-append #$output "/bin")))) > + ;; must be after all elf reliant phases > + (add-after 'make-dynamic-linker-cache 'set-magic-by= tes > + (lambda _ > + (use-modules (ice-9 binary-ports)) Please do not use =E2=80=98use-modules=E2=80=99 in a non-top-level context;= it=E2=80=99s not guaranteed to work in that context. Instead use #:modules (check the repo for examples). > + (home-page "https://github.com/AppImage/type2-runtime") > + (synopsis "Runtime for AppImages") > + (description "The runtime is the executable part of every AppImage= . It Please make it a full sentence, as per . > + (define (concatenate result file1 file2) Please add a short comment below =E2=80=98define=E2=80=99 explaining what i= t does, similar to docstrings. > + (let ((p (open-file-output-port result)) Rather: (call-with-output-file result (lambda (output) =E2=80=A6)) > + (f1 (open-file-input-port file1)) > + (f2 (open-file-input-port file2))) > + (put-bytevector p (get-bytevector-all f1)) > + (close-port f1) > + (put-bytevector p (get-bytevector-all f2)) To avoid loading it all in memory, rather use: (call-with-input-file file1 (lambda (input) (dump-port input output))) Same with FILE2. > + (let* ((appdir "AppDir") > + (squashfs "squashfs") > + (profile-items (map store-info-item > + (call-with-input-file "profile" r= ead-reference-graph))) > + (profile-path (find (cut (file-name-predicate "profil= e$") <> #f) profile-items))) s/-path// Also, rather: (find (lambda (item) (string-suffix? "-profile" item)) items) > + (mkdir-p appdir) > + ;; copy all store items from the profile to the AppDir > + (for-each (lambda (f) > + (copy-store-item f appdir)) profile-items) I believe you could write: (populate-store '("profile") appdir) > + ;; symlink the provided entry-point to AppDir/AppRun=20 > + (symlink (string-append "." profile-path "/" #$entry-point) > + (string-append appdir "/AppRun")) > + ;; create .desktop file as required by the spec > + (make-desktop-entry-file > + (string-append appdir "/" #$name ".desktop") > + #:name #$name > + #:exec #$entry-point) > + ;; compress the AppDir > + (invoke #+(file-append squashfs-tools "/bin/mksquashfs") a= ppdir > + squashfs "-root-owned" "-noappend" > + "-comp" #+(compressor-name compressor)) > + ;; append runtime and squashFS into file AppImage > + (concatenate #$output > + #$(file-append runtime-package "/" runtime-pa= th) > + squashfs)))))) And you can finish with: (chmod #$output #o555). (Then you can remove the doc that says to =E2=80=9Cchmod +x=E2=80=9D the re= sult.) It looks like this procedure ignores its #:symlinks argument. Could you add support for it? Could you send an updated patch? At any rate, kudos for this new backend! This had been suggested many times, so I=E2=80=99m sure it=E2=80=99ll find some good use. Thank you! Ludo=E2=80=99.