guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.


From: Ludovic Courtès
Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
Date: Fri, 25 Jan 2019 18:07:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi Danny,

Danny Milosavljevic <address@hidden> skribis:

> * gnu/build/linux-modules.scm (not-softdep-whitespace): New variable.
> (module-soft-dependencies): New procedure.

That was fast!  :-)


[...]

> +(define (module-soft-dependencies file)
> +  "Return a list of (cons mode soft-dependency) of module FILE."
> +  ;; TEXT: "pre: baz blubb foo post: bax bar"
> +  (define (parse-softdep text)
> +    (let loop ((value '())
> +               (tokens (string-tokenize text not-softdep-whitespace))
> +               (section #f))
> +      (match tokens
> +       ((token _ ...)
> +        (if (string=? (string-take-right token 1) ":") ; section
> +            (loop value
> +                  (cdr tokens)
> +                  (string-trim-both token))

You can use the pattern (token rest ...) and then:

  (loop value rest (string-trim-both token))

instead of the not-so-nice ‘cdr’.  :-)

> +  (let ((info (modinfo-section-contents file)))
> +    (apply append
> +     (filter-map (match-lambda
> +                  (('softdep . value)
> +                   (parse-softdep value))
> +                  (_ #f))
> +                 (modinfo-section-contents file)))))

Replace ‘apply append’ with ‘concatenate’.

OK with these changes, thank you!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]