unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Leo Famulari <leo@famulari.name>
Cc: guix-devel@gnu.org
Subject: Re: search-input-file vs (assoc-ref inputs)
Date: Mon, 03 Jan 2022 16:29:07 +0100	[thread overview]
Message-ID: <874k6kj0sc.fsf@gnu.org> (raw)
In-Reply-To: <YcS14RRg0/RUXaNt@jasmine.lan> (Leo Famulari's message of "Thu, 23 Dec 2021 12:46:09 -0500")

Hi!

Leo Famulari <leo@famulari.name> skribis:

> I noticed that, as part of the transition to the new inputs style [0],
> we are sometimes replacing code like (assoc-ref inputs "foo") with
> (search-input-file inputs "/bin/foo").
>
> I think that we should instead replace the old style with gexps that
> specify which package, in order to keep the equivalent functionality.
>
> Otherwise, we risk regressions, when the code finds a match for the
> desired filename in the wrong input.
>
> I would say that (search-input-file) is a replacement for the Guile
> (which) procedure.
>
> On the other hand, we can replace (assoc-ref inputs ...) with
> (this-package-input "foo").
>
> What do you think?

It depends.  In cases where we want a specific file or directory, I
think we should use ‘which’, ‘search-input-file’, and
‘search-input-directory’.

Sometimes though we want to form strings such as:

  --with-gmp-prefix=/gnu/store/…-gmp-6.3.0

In that case, (this-package-input "gmp") is more appropriate.

However, there are cases where we want code to be independent from the
package name.

For example, we have two implementations of the MPI standard (openmpi
and mpich) which are mostly interchangeable, for instance via
‘--with-input=openmpi=mpich’.  If we hardcode things like
(this-package-input "openmpi") everywhere, then we effectively prevent
input substitution.  The same goes for cases where we have a “-minimal”
variant: the actual name of the package shouldn’t matter.

To summarize, we should rely on package names only when it is strictly
needed.

Thoughts?

Ludo’.


  reply	other threads:[~2022-01-03 15:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23 17:46 search-input-file vs (assoc-ref inputs) Leo Famulari
2022-01-03 15:29 ` Ludovic Courtès [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-01-07 15:34 Zhu Zihao
2022-01-08 21:10 ` Ludovic Courtès

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=874k6kj0sc.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=leo@famulari.name \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).