Maxime Devos 5378edeab4
utils: Define ‘search-input-file’ procedure.
The procedure ‘which’ from (guix build utils)
is used for two different purposes:

  1. for finding the absolute file name of a binary
     that needs to run during the build process

  2. for finding the absolute file name of a binary,
     for the target system (as in --target=TARGET),
     e.g. for substituting sh->/gnu/store/.../bin/sh,
     python->/gnu/store/.../bin/python.

When compiling natively (target=#f in Guix parlance),
this is perfectly fine.

However, when cross-compiling, there is a problem.
"which" looks in $PATH for binaries.  That's good for purpose (1),
but incorrect for (2), as the $PATH contains binaries from native-inputs
instead of inputs.

This commit defines a ‘search-input-file’ procedure. It functions
like 'which', but instead of searching in $PATH, it searches in
the 'inputs' of the build phase, which must be passed to
‘search-input-file’ as an argument. Also, the file name must
include "bin/" or "sbin/" as appropriate.

* guix/build/utils.scm (search-input-file): New procedure.
* tests/build-utils.scm
  ("search-input-file: exception if not found")
  ("search-input-file: can find if existent"): Test it.
* doc/guix.texi (File Search): Document it.

Partially-Fixes: <https://issues.guix.gnu.org/47869>
Co-Authored-By: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-06-04 22:34:26 +02:00
..
2020-05-04 09:56:12 +02:00
2020-12-21 17:47:35 +01:00
2020-05-04 09:56:12 +02:00
2020-05-04 09:56:12 +02:00
2020-05-04 09:56:12 +02:00
2020-06-05 22:54:06 +02:00
2020-06-05 22:54:06 +02:00
2021-03-06 11:41:48 +01:00
2021-03-30 22:48:44 +02:00
2020-12-09 22:25:17 +01:00
2021-04-12 18:42:22 +02:00
2021-02-01 17:32:31 +01:00
2021-05-16 23:28:11 +02:00
2020-05-04 09:56:12 +02:00
2019-03-24 00:13:53 +01:00
2019-04-10 17:09:47 +02:00
2021-03-06 11:41:48 +01:00
2019-06-14 21:57:39 +02:00
2021-02-03 12:41:28 +01:00