guix-patches
[Top][All Lists]
Advanced

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

[bug#54852] [PATCH] gnu: Add openjdk18.


From: Rostislav Svoboda
Subject: [bug#54852] [PATCH] gnu: Add openjdk18.
Date: Sat, 23 Apr 2022 17:11:18 +0200

> > Here, (if such a pattern repeats) we could define a new syntax
> > `substitue` in the guix/packages.scm analogical to `delete`,
> > `prepend`, `append` and `replace`.
>
> Isn't this just (modify-inputs ... (replace "..." ...))?
>
> What's the difference between 'replace' and 'substitute'?  They
> conceptually seem to be about the same to me.  And in case of
> substitute, I'm more thinking of 'substitute*' than package inputs.

The lists `inputs`, `native-inputs` and `propagated-inputs` are lists
of association lists that map input labels to file names. E.g.:

(native-inputs
     `(("autoconf" ,autoconf)
       ("openjdk16:jdk" ,openjdk16 "jdk")
       ("pkg-config" ,pkg-config)
       ("unzip" ,unzip)
       ("which" ,which)
       ("zip" ,zip)))

The `replace` just replaces the file name for a given input label (see
guix/packages.scm, line 1099):

(define (replace-input name replacement inputs)
  "Replace input NAME by REPLACEMENT within INPUTS."
  (map (lambda (input)
         (match input
           (((? string? label) _ . outputs)
            (if (string=? label name)
                (match replacement        ;does REPLACEMENT specify an output?
                  ((_ _) (cons label replacement))
                  (_     (cons* label replacement outputs)))
                input))))
       inputs))

(define-syntax replace
  (lambda (s)
    (syntax-violation 'replace
                      "'replace' may only be used within 'modify-inputs'"
                      s)))

See also https://guix.gnu.org/en/blog/2021/the-big-change/

> I'm more thinking of 'substitute*' than package inputs.

That thing which I named `substitute` doesn't exist. I was just
contemplating that we could write it, if we want to change the whole
association list, i.e. the pair input label & file name, not just the
file name. (And when I think about it again, such a name will lead to
confusion. So nah, forget about it.)

Cheers
Bost





reply via email to

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