[PATCH] linux-boot: Add find-long-options.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 7 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180131122933.6051-1-dannym@scratchpost.org
* gnu/build/linux/boot.scm (find-long-options): New variable.
---
gnu/build/linux-boot.scm | 13 +++++++++++++
1 file changed, 13 insertions(+)

Toggle diff (31 lines)
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 0ab8391b0..b88ce6b99 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -37,6 +37,7 @@
#:export (mount-essential-file-systems
linux-command-line
find-long-option
+ find-long-options
make-essential-device-nodes
make-static-device-nodes
configure-qemu-networking
@@ -99,6 +100,18 @@ Return the value associated with OPTION, or #f on failure."
(lambda (arg)
(substring arg (+ 1 (string-index arg #\=)))))))
+(define (find-long-options option arguments)
+ "Find OPTIONs among ARGUMENTS, where OPTION is something like \"console\".
+Return the values associated with OPTIONs as a list, or the empty list on
+failure."
+ (let ((opt (string-append option "=")))
+ (map (lambda (arg)
+ (substring arg (+ 1 (string-index arg #\=))))
+ (filter
+ (lambda (arg)
+ (string-prefix? opt arg))
+ arguments))))
+
(define* (make-disk-device-nodes base major #:optional (minor 0))
"Make the block device nodes around BASE (something like \"/root/dev/sda\")
with the given MAJOR number, starting with MINOR."
Ludovic Courtès wrote 7 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 30303@debbugs.gnu.org)
87po5pr6ri.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (2 lines)
> * gnu/build/linux/boot.scm (find-long-options): New variable.

[...]

Toggle quote (5 lines)
> +(define (find-long-options option arguments)
> + "Find OPTIONs among ARGUMENTS, where OPTION is something like \"console\".
> +Return the values associated with OPTIONs as a list, or the empty list on
> +failure."

s/on failure/if OPTION doesn't appear in ARGUMENTS/

Toggle quote (8 lines)
> + (let ((opt (string-append option "=")))
> + (map (lambda (arg)
> + (substring arg (+ 1 (string-index arg #\=))))
> + (filter
> + (lambda (arg)
> + (string-prefix? opt arg))
> + arguments))))

You can make it:

(filter-map (lambda (arg)
(and (string-prefix? opt arg)
(substring …)))
arguments)

OK with these changes, thanks! :-)

Ludo’.
Danny Milosavljevic wrote 7 years ago
(no subject)
(address . control@debbugs.gnu.org)
20180201001157.0f35138f@scratchpost.org
close 30303
?
Your comment

This issue is archived.

To comment on this conversation send an email to 30303@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 30303
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help