From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0G4aH8XSkl8AcwAA0tVLHw (envelope-from ) for ; Fri, 23 Oct 2020 12:55:33 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id EJhmGcXSkl93agAAB5/wlQ (envelope-from ) for ; Fri, 23 Oct 2020 12:55:33 +0000 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 D3F529403CA for ; Fri, 23 Oct 2020 12:55:32 +0000 (UTC) Received: from localhost ([::1]:45322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVwbT-0006kt-Mf for larch@yhetil.org; Fri, 23 Oct 2020 08:55:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVwVC-0001Nx-Mo for guix-patches@gnu.org; Fri, 23 Oct 2020 08:49:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVwVC-0005F5-Cl for guix-patches@gnu.org; Fri, 23 Oct 2020 08:49:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVwVC-00035I-AJ for guix-patches@gnu.org; Fri, 23 Oct 2020 08:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41066] [PATCH] gnu: bootloader: Support for chain loading. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Oct 2020 12:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41066 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: Stefan , Mathieu Othacehe , 41066@debbugs.gnu.org, Efraim Flashner , Maxim Cournoyer Received: via spool by 41066-submit@debbugs.gnu.org id=B41066.160345733311841 (code B ref 41066); Fri, 23 Oct 2020 12:49:02 +0000 Received: (at 41066) by debbugs.gnu.org; 23 Oct 2020 12:48:53 +0000 Received: from localhost ([127.0.0.1]:56281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVwV2-00034v-Rc for submit@debbugs.gnu.org; Fri, 23 Oct 2020 08:48:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVwUz-00034g-Cg for 41066@debbugs.gnu.org; Fri, 23 Oct 2020 08:48:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48854) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVwUq-0005Dq-Kw; Fri, 23 Oct 2020 08:48:40 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55328 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kVwUp-0008TP-6m; Fri, 23 Oct 2020 08:48:40 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <7A4ABEA8-4500-4D55-BCCE-BFB37FB06B2C@vodafonemail.de> <20200524131316.4c6e8a50@scratchpost.org> <3197004D-0131-4781-99FD-60EBE434E794@vodafonemail.de> <023CBBED-35CD-4AD3-97C4-0DE0B7623B9A@vodafonemail.de> <6E5ECFBA-57F4-485F-9403-1D04CF82062D@vodafonemail.de> <4D71A75A-5722-457C-A5CE-98CE51A53450@vodafonemail.de> <975EC414-6A81-444B-9BB0-AE303C6A9511@vodafonemail.de> <20201022194630.597302a2@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 2 Brumaire an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 23 Oct 2020 14:48:36 +0200 In-Reply-To: <20201022194630.597302a2@scratchpost.org> (Danny Milosavljevic's message of "Thu, 22 Oct 2020 19:46:30 +0200") Message-ID: <87eelpp0pn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) 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" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: wxBs+jbZ7Yjj Hi, Danny Milosavljevic skribis: > On Sun, 18 Oct 2020 13:21:28 +0200 > Stefan wrote: > >> (bootloader-chain grub-efi-netboot-bootloader >> (list u-boot-my-scb >> firmware) >> '("libexec/u-boot.bin" >> "firmware/") >> (list (plain-file "config.txt" >> "kernel=3Du-boot.bin")) >> #:installer (install-grub-efi-netboot "efi/boo= t")) In the example above, I think that you could merge the 2nd and 3rd arguments by using =E2=80=98file-append=E2=80=99: (bootloader-chain grub-efi-netboot-bootloader (list (file-append u-boot "/libexec/u-boot.bin") (file-append firmware "/firmware"))) No? I think we should look at how to simplify this interface. Intuitively, I would expect the =E2=80=98bootloader-chain=E2=80=99 to take a list of records and return a record. Is this something that can be achieved? If not, what are the extra constraints that need to be taken into account? >> +(define (bootloader-profile packages package-contents files) > > If using my suggested bootloader-chain API, this would just get PACKAGES, > not PACKAGE-CONTENTS and FILES (FILES would be mixed into the PACKAGES li= st--which > thus should be renamed to ITEMS or something). Yes, if it=E2=80=99s about building a profile, you could just use a object. Would that work here? >> + (define (bootloader-collection manifest) >> + (define build >> + (with-imported-modules '((guix build utils) >> + (ice-9 ftw) >> + (srfi srfi-1)) >> + #~(begin >> + (use-modules ((guix build utils) >> + #:select (mkdir-p strip-store-file-name)) >> + ((ice-9 ftw) >> + #:select (scandir)) >> + ((srfi srfi-1) >> + #:select (append-map every remove))) >> + (define (symlink-to file directory transform) >> + "Creates a symlink to FILE named (TRANSFORM FILE) in DIRE= CTORY." >> + (when (file-exists? file) >> + (symlink file >> + (string-append directory "/" (transform fi= le))))) >> + (define (directory-content directory) >> + "Creates a list of absolute path names inside DIRECTORY." >> + (map (lambda (name) >> + (string-append directory name)) >> + (sort (or (scandir directory >> + (lambda (name) >> + (not (member name '("." "..")))= )) >> + '()) >> + string> + (define (select-names select names) >> + "Set SELECT to 'filter' or 'remove' names ending with '/'= ." >> + (select (lambda (name) >> + (string-suffix? "/" name)) >> + names)) >> + (define (filter-names-without-slash names) >> + (select-names remove names)) >> + (define (filter-names-with-slash names) >> + (select-names filter names)) > > I would prefer these to be in another procedure that can be used to trans= form > any package (or profile?) like this. @Ludo: What do you think? >From a quick look at the patch, I don=E2=80=99t fully understand yet what= =E2=80=99s going on. Stylistically, I=E2=80=99d suggest a few things to make the code more consi= stent with the rest of the code base, and thus hopefully easier to grasp for the rest of us: 1. Don=E2=80=99t sort the result of =E2=80=98scandir=E2=80=99, it=E2=80= =99s already sorted. 2. Remove =E2=80=98select-names=E2=80=99 as it requires people to read mo= re code to understand that we=E2=80=99re just filtering/removing. Instead, decl= are: (define absolute-file-name? (cut string-suffix? "/" <>)) and write: (filter absolute-file-name? names) (remote absolute-file-name? names) HTH! Ludo=E2=80=99.