unofficial mirror of gwl-devel@gnu.org
 help / color / mirror / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: Olivier Dion <olivier.dion@polymtl.ca>
Cc: gwl-devel@gnu.org
Subject: Re: [PATCH v3 1/1] packages: Support for full Guix specification
Date: Sun, 22 May 2022 08:43:03 +0200	[thread overview]
Message-ID: <87h75ijbr7.fsf@elephly.net> (raw)
In-Reply-To: <20220429180247.17830-2-olivier.dion@polymtl.ca>


Hi Olivier,

thanks for the new patch and my apologies for the delay!

It looks fine, but I can’t help but feel a little confused about what
variables are actual package values and what are wrappers.  Sometimes we
have a variable called “packages”, but it’s seemingly always going to be
package wrappers, so we map “package-unwrap”.

I wonder if there’s a way to hide this machinery somewhat.  On the other
hand, “package-unwrap” is a no-op for actual packages, so it doesn’t
really matter.

> +(define package-native-inputs
> +  (match-lambda
> +    ((? package? pkg)
> +     (package-native-inputs pkg))
> +    ((? inferior-package? pkg)
> +     (inferior-package-native-inputs pkg))
> +    ((? package-wrapper? pkg)
> +     (package-native-inputs (package-wrapper-package pkg)))))

I’m confused about the naming.  Is this a recursive application of
PACKAGE-NATIVE-INPUTS?  Or are these two different implementations of
PACKAGE-NATIVE-INPUTS, one from GWL and the other from Guix?

>  (define (lookup-package specification)
>    (log-event 'guix (G_ "Looking up package `~a'~%") specification)
> -  (match (lookup-inferior-packages (current-guix) specification)
> -    ((first . rest) first)
> -    (_ (raise (condition
> -               (&gwl-package-error
> -                (package-spec specification)))))))
> +  (let-values (((name version output)
> +                (package-specification->name+version+output
> +                 specification)))
> +    (let* ((inferior-package
> +            (lookup-inferior-packages (current-guix)
> +                                      name version))
> +           (package (match inferior-package
> +                      ((first . rest) first)
> +                      (_ (raise (condition
> +                                 (&gwl-package-error
> +                                  (package-spec specification))))))))
> +      (make-package-wrapper package output))))

I think this would be slightly improved by using SRFI-71 instead of
LET-VALUES.  SRFI-71 replaces LET and LET* so that you can assign
multiple values without needing to be explicit about it.

Since this procedure is now a bit more complicated I think it would be
good to have a docstring that mentions the input and output values.

>  (define default-guile
>    (mlambda ()
>      "Return the variant of Guile that was used to build the \"guix\"
>  package, which provides all library features used by the GWL.  We use
>  this Guile to run scripts."
> -    (and=> (assoc-ref (inferior-package-native-inputs (build-time-guix))
> +    (and=> (assoc-ref (package-native-inputs (build-time-guix))
>                        "guile") first)))

Is this correct?  BUILD-TIME-GUIX has been changed so that the return
value is an unwrapped wrapper — so it really is an inferior package.
Does PACKAGE-NATIVE-INPUTS refer to the implementation here or that in
Guix?

I think it would be best if we can make all this unambiguous.

-- 
Ricardo


  reply	other threads:[~2022-05-22  6:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 17:22 Packages specification does not work Olivier Dion via
2022-04-21 18:25 ` Olivier Dion via
2022-04-21 19:51 ` [PATCH v1 1/2] packages: Support for full Guix specification Olivier Dion
2022-04-21 19:51   ` [PATCH v1 2/2] pre-inst-env.in: Export GUIX_EXTENSIONS_PATH Olivier Dion
2022-04-29 11:42     ` Ricardo Wurmus
2022-04-21 20:10   ` [PATCH v1 1/2] packages: Support for full Guix specification Olivier Dion via
2022-04-22 18:43   ` [PATCH v2 0/2] Support full package specifications Olivier Dion
2022-04-22 18:43     ` [PATCH v2 1/2] packages: Support for full Guix specification Olivier Dion
2022-04-26 18:11       ` Ricardo Wurmus
2022-04-26 18:59         ` Olivier Dion via
2022-04-26 20:30           ` Ricardo Wurmus
2022-04-26 21:52             ` Olivier Dion via
2022-04-22 18:43     ` [PATCH v2 2/2] pre-inst-env.in: Export GUIX_EXTENSIONS_PATH Olivier Dion
2022-04-29  9:00       ` zimoun
2022-04-29 18:02     ` [PATCH v3 0/1] Support full package specifications Olivier Dion
2022-04-29 18:02       ` [PATCH v3 1/1] packages: Support for full Guix specification Olivier Dion
2022-05-22  6:43         ` Ricardo Wurmus [this message]
2022-05-22 12:33           ` Olivier Dion via
2022-05-17 20:40       ` [PATCH v3 0/1] Support full package specifications Olivier Dion via
2022-05-22 12:38       ` [PATCH v4] packages: Support for full Guix specification Olivier Dion
2022-05-23 21:02         ` Ricardo Wurmus
2022-05-23 21:45         ` [PATCH v5] " Olivier Dion
2022-06-01 13:07           ` Ricardo Wurmus

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://www.guixwl.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h75ijbr7.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=gwl-devel@gnu.org \
    --cc=olivier.dion@polymtl.ca \
    /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.
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).