From: "Ludovic Courtès" <ludo@gnu.org>
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: Stefan <stefan-guix@vodafonemail.de>,
Mathieu Othacehe <othacehe@gnu.org>,
41066@debbugs.gnu.org, Efraim Flashner <efraim@flashner.co.il>,
Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#41066] [PATCH] gnu: bootloader: Support for chain loading.
Date: Fri, 23 Oct 2020 14:48:36 +0200 [thread overview]
Message-ID: <87eelpp0pn.fsf@gnu.org> (raw)
In-Reply-To: <20201022194630.597302a2@scratchpost.org> (Danny Milosavljevic's message of "Thu, 22 Oct 2020 19:46:30 +0200")
Hi,
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> On Sun, 18 Oct 2020 13:21:28 +0200
> Stefan <stefan-guix@vodafonemail.de> wrote:
>
>> (bootloader-chain grub-efi-netboot-bootloader
>> (list u-boot-my-scb
>> firmware)
>> '("libexec/u-boot.bin"
>> "firmware/")
>> (list (plain-file "config.txt"
>> "kernel=u-boot.bin"))
>> #:installer (install-grub-efi-netboot "efi/boot"))
In the example above, I think that you could merge the 2nd and 3rd
arguments by using ‘file-append’:
(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 ‘bootloader-chain’ to take a list of <bootloader>
records and return a <bootloader> 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 list--which
> thus should be renamed to ITEMS or something).
Yes, if it’s about building a profile, you could just use a <profile>
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 DIRECTORY."
>> + (when (file-exists? file)
>> + (symlink file
>> + (string-append directory "/" (transform file)))))
>> + (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 transform
> any package (or profile?) like this. @Ludo: What do you think?
From a quick look at the patch, I don’t fully understand yet what’s
going on.
Stylistically, I’d suggest a few things to make the code more consistent
with the rest of the code base, and thus hopefully easier to grasp for
the rest of us:
1. Don’t sort the result of ‘scandir’, it’s already sorted.
2. Remove ‘select-names’ as it requires people to read more code to
understand that we’re just filtering/removing. Instead, declare:
(define absolute-file-name? (cut string-suffix? "/" <>))
and write:
(filter absolute-file-name? names)
(remote absolute-file-name? names)
HTH!
Ludo’.
next prev parent reply other threads:[~2020-10-23 12:55 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-03 23:34 [bug#41066] [PATCH] gnu: grub: Support for chain loading Stefan
2020-05-24 11:13 ` Danny Milosavljevic
2020-05-24 13:21 ` Stefan
2020-10-04 16:31 ` [bug#41066] [PATCH] gnu: bootloader: " Stefan
2020-10-10 9:31 ` Stefan
2020-10-18 11:20 ` Stefan
2020-10-18 11:21 ` Stefan
2020-10-22 17:46 ` Danny Milosavljevic
2020-10-23 12:48 ` Ludovic Courtès [this message]
2020-10-24 1:30 ` Danny Milosavljevic
2020-10-24 16:22 ` Ludovic Courtès
2020-10-25 0:33 ` Danny Milosavljevic
2020-10-25 16:58 ` Stefan
2020-10-25 16:59 ` Stefan
2020-11-02 15:42 ` Danny Milosavljevic
2020-11-02 16:21 ` Mathieu Othacehe
2020-11-03 9:07 ` Ludovic Courtès
2020-11-03 9:32 ` Mathieu Othacehe
2020-11-07 21:14 ` Stefan
2020-11-07 21:15 ` Stefan
2020-10-26 10:37 ` Ludovic Courtès
2020-11-16 9:33 ` bug#41066: " Danny Milosavljevic
2020-11-17 14:26 ` [bug#41066] " Stefan
2020-11-17 15:47 ` Danny Milosavljevic
2020-11-17 16:17 ` Danny Milosavljevic
2020-11-17 20:27 ` Stefan
2020-11-18 18:05 ` Danny Milosavljevic
2020-11-18 18:20 ` Stefan
2020-11-28 22:14 ` [bug#41066] [PATCH] gnu: bootloader: Improve support " Stefan
2020-12-12 17:14 ` Stefan
2020-12-13 14:42 ` Danny Milosavljevic
2020-12-13 17:24 ` Stefan
2020-12-13 19:28 ` Stefan
2020-12-28 19:02 ` Stefan
2021-03-27 16:48 ` bug#41066: " Stefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eelpp0pn.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=41066@debbugs.gnu.org \
--cc=dannym@scratchpost.org \
--cc=efraim@flashner.co.il \
--cc=maxim.cournoyer@gmail.com \
--cc=othacehe@gnu.org \
--cc=stefan-guix@vodafonemail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).