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

From: Ludovic Courtès <[email-masked]>
Date: Fri, 25 Jan 2019 18:07:07 +0100

Hi Danny,

Danny Milosavljevic <[email-masked]> 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’.