[PATCH] Gnu: Elixir: Use previous method for detecting sh

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Maxime Devos
  • John Hamelink
Owner
unassigned
Submitted by
John Hamelink
Severity
normal
Merged with

Debbugs page

John Hamelink wrote 3 years ago
(address . guix-patches@gnu.org)
878ruwexe3.fsf@johnhame.link
gnu/packages/elixir.scm (elixir)[arguments]: Keep G-expressions, but use
========================================================================

WHICH instead of SEARCH-INPUT-FILES.

Signed-off-by: John Hamelink <me@johnhame.link>
---
gnu/packages/elixir.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Hi there,

While following a tutorial, I found myself struggling to build
elixir. After discussing on #guix, and looking on the build server for
clues, it seems that the SEARCH-INPUT-FILE change in 3da297997d ("gnu:
elixir: Use G-expressions.") was the culprit. Within the
G-expression, I reverted to the use of WHICH for the "sh" binary,
while leaving the others as they are.

I do not understand the differences between these two functions or why
SEARCH-INPUT-FILE is preferential, so there may be additional caveats I'm not
aware of that SEARCH-INPUT-FILE addresses.

Thanks
John

Toggle diff (15 lines)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 3fb74a56a5..5df50902ce 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -68,7 +68,7 @@ (define-public elixir
(substitute* '("lib/mix/lib/mix/release.ex"
"lib/mix/lib/mix/tasks/release.init.ex")
(("#!/bin/sh")
- (string-append "#!" (search-input-file inputs "sh"))))
+ (string-append "#!" (which "sh"))))
(substitute* "bin/elixir"
(("^ERTS_BIN=$")
(string-append
--
2.35.1
-----BEGIN PGP SIGNATURE-----

iQJFBAEBCgAvFiEE+Yt/N+nvP8wO2AcVFT3f6aVKmkwFAmH3AHQRHG1lQGpvaG5o
YW1lLmxpbmsACgkQFT3f6aVKmkz0Zg//X3fqmssUTlK1YCLNWbtlHVQ33CynHeYJ
O//RHqFOcya5JqliKZelHADW+WE5zsTyUW6IbDqzg4fXFVqPHPJGMHNsIVrSCBKk
w0dgFPgAK955sTi/Iy/iXFujKQ0/qqR0FWn5urGV81VyDAJ6TT6SDi3vndUI3ue8
rV1GRNlHjSzF7wWaj8OFBgn+fFAQ161zpL7hzwZ0OToZlCwkmBpMm+/5NfV5zrCZ
t6kkmZO7SsNHLwe4eyybcF6gfscwYUe5y71Wx1BBvXKMi+Rx8YiV4e2ANBWHITM6
Wvq0YITyt2WuOxk2pwmL22UJiGjRLxs0Gp9lmE4Loa96xhETsTq0APsFM2GqKsWl
C6Xca59ud7GPj3vAbSeTaZlv3LlM013MYxguhTbOt9Oq0vEMNcH2Ikhp90iHvmLf
5guz84JYW3cI2ihF1zRe5vcYinLjhtZXavJbIfRBVoibnmRHo4onjg9/T+ghKolB
JxwF/oF698L9GLR5Q1rk55cVid5TyXakDnRFJF6btgPjf7Ys2GhS7RRG89ozIqWp
i2gp65NCg1+3XBGbV4rZOFuewKYyxyu9g3qTSI9gOknwzQL4r6GmatsBEII0M+Dj
n2VmbrANz9qYmRzxq50eWm/2qGAxBILHhyhEcCI1wtiQBUzj64El4sn4Gpr6cxur
yoBQWT+0NpE=
=XwwH
-----END PGP SIGNATURE-----

Maxime Devos wrote 3 years ago
(name . John Hamelink)(address . me@johnhame.link)(address . 53643@debbugs.gnu.org)
1cfa84a32e79af82e0c57bfe11e4601a1db76880.camel@telenet.be
John Hamelink schreef op zo 30-01-2022 om 21:15 [+0000]:
Toggle quote (3 lines)
> - (string-append "#!" (search-input-file inputs "sh"))))
> + (string-append "#!" (which "sh"))))

'which' looks in $PATH, which is formed by native-inputs,
so this change is incorrect when cross-compiling.

Instead, I suggest:

- (string-append "#!" (search-input-file inputs "sh"))))
+ (string-append "#!" (search-input-file inputs "bin/sh"))))

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYfcPNhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7p7cAP4irrzsl+sdH1nvAcS3U5wMAg1F
lKJlLWFbRVDM0fhmWAD/RuhYk0gQ58PxNARynOPeOHvMVAud/zVL1+u1YR42eQY=
=ex28
-----END PGP SIGNATURE-----


Maxime Devos wrote 3 years ago
(name . John Hamelink)(address . me@johnhame.link)(address . 53643@debbugs.gnu.org)
73379b4b9c971a9fcfe586a99f584e5fc33c2e23.camel@telenet.be
John Hamelink schreef op zo 30-01-2022 om 21:15 [+0000]:
Toggle quote (9 lines)
> gnu/packages/elixir.scm (elixir)[arguments]: Keep G-expressions, but
> use
> =====================================================================
> ===
>
> WHICH instead of SEARCH-INPUT-FILES.
>
> Signed-off-by: John Hamelink <me@johnhame.link>

That's not how Signed-off-by is used in Guix; Guix assigns a different
(albeit slightly related) meaning to Signed-off-by than Linux does, see
(guix)Commit access:

When pushing a commit on behalf of somebody else, please add a
‘Signed-off-by’ line at the end of the commit log message—e.g., with
‘git am --signoff’. This improves tracking of who did what.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYfcPkRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7lMiAPsEOhCLElrT70bi1zl74PLwXfZE
/5HSnx2+FDyfQBJZIgD+IwN2gKJmXgiwVLxCIXOmn4J03KQAAbrwPkO9V64kzQ8=
=0Jz9
-----END PGP SIGNATURE-----


Maxime Devos wrote 3 years ago
(name . John Hamelink)(address . me@johnhame.link)(address . 53643@debbugs.gnu.org)
eef44c42fe66491a0a186a5f7861cadcebede3bd.camel@telenet.be
John Hamelink schreef op zo 30-01-2022 om 21:15 [+0000]:
Toggle quote (2 lines)
> [bug#53643] [PATCH] Gnu: Elixir: Use previous method for detecting sh

The package is named 'elixir', not 'Elixir'. The directory is
$CHECKOUT/gnu, not $CHECKOUT/Gnu.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYfcPzBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jppAQDnZktn8GbuVfTBQjLo8lp8hs+X
Ys/MZaN1OgqRy34hCgEApvUdM9pQFHPH6puCduo8Q8whG+QixNcTHjd6q0shoQ0=
=2weB
-----END PGP SIGNATURE-----


John Hamelink wrote 3 years ago
Re: [bug#53643] [PATCH] gnu: elixir: Use previous method for detecting sh
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53643@debbugs.gnu.org)
87k0eg4xvy.fsf@johnhame.link
Hi Maxime,

Thanks for looking over my submission. I agree on all points.

Toggle quote (3 lines)
> - (string-append "#!" (search-input-file inputs "sh"))))
> + (string-append "#!" (search-input-file inputs "bin/sh"))))

The rest of the file's usage of search-input-file involves a
forward-slash before bin. I tried including the forward-slash and
leaving it out in all relevant places, and it doesn't seem like it
makes a difference - I didn't try to cross-compile, though. Regardless,
I made a patch for each option.

---
gnu/packages/elixir.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (49 lines)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 3fb74a56a5..fae8279e5c 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -68,7 +68,7 @@ (define-public elixir
(substitute* '("lib/mix/lib/mix/release.ex"
"lib/mix/lib/mix/tasks/release.init.ex")
(("#!/bin/sh")
- (string-append "#!" (search-input-file inputs "sh"))))
+ (string-append "#!" (search-input-file inputs "/bin/sh"))))
(substitute* "bin/elixir"
(("^ERTS_BIN=$")
(string-append
--
2.35.1

---
gnu/packages/elixir.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 3fb74a56a5..2fee929d6a 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -64,11 +64,11 @@ (define-public elixir
"lib/mix/lib/mix/scm/git.ex")
(("(cmd\\(['\"])git" _ prefix)
(string-append prefix
- (search-input-file inputs "/bin/git"))))
+ (search-input-file inputs "bin/git"))))
(substitute* '("lib/mix/lib/mix/release.ex"
"lib/mix/lib/mix/tasks/release.init.ex")
(("#!/bin/sh")
- (string-append "#!" (search-input-file inputs "sh"))))
+ (string-append "#!" (search-input-file inputs "bin/sh"))))
(substitute* "bin/elixir"
(("^ERTS_BIN=$")
(string-append
@@ -79,7 +79,7 @@ (define-public elixir
;; are not in release mode and can point to the actual erl
;; binary in Guix store.
"\nif [ -z \"$ERTS_BIN\" ]; then ERTS_BIN="
- (string-drop-right (search-input-file inputs "/bin/erl") 3)
+ (string-drop-right (search-input-file inputs "bin/erl") 3)
"; fi\n")))
(substitute* "bin/mix"
(("#!/usr/bin/env elixir")
--
2.35.1
-----BEGIN PGP SIGNATURE-----

iQJFBAEBCgAvFiEE+Yt/N+nvP8wO2AcVFT3f6aVKmkwFAmH3HHERHG1lQGpvaG5o
YW1lLmxpbmsACgkQFT3f6aVKmkwoyBAAxEjZuH/W+FdYjl289SID0aGUaau/X8O/
jzPBeh6dFJDMbvtXrPTKYb8w6QfEt5G9uFtRMuwXQPOz7RfnI6Omm7nmZ8Y9Ni8j
tX44hGYKdA2JBjo+vK3MClutTMNzbftZ9k9bkWHOtX+/UMwvu2jqv0dIwllEMrR5
391EtPsQr0lo8Uht0Qfk3cynWCV4As/is8766Sf2Pnv8Qi5j8IGDv2df8swbOHPx
UvY92o57kHdypNy3prQGQbSSKQyEQVpqlIfFVLwoJcsF+Na5fDpDB0YlUZ4IyDs7
6c+ruM7W82GMc+RmXJlYRh2lUunmA+zHYhJwpMTr3Z5dbch+4ORWHRaWMqiF47vK
M0yHu1TIV+atbZwkiCFHoLjsxJVd81vlknJdEnorZyY14ekIY6I6y1m0AoSJkvYn
6sOC7YyegAD5b0D9VdVg6oirnZ0k0sUDfZVztSfAbHAB36Veim/85ME8cDvnGmpu
mDSjCdgFkPJqYiApb2DDYvtwzfAm/xHtlAGU4GXSu2RSmmFeqsghSQMT4Sc5LnEp
0HoMJrwnHQOQmN8ggJNl3ERQbB3N719hTRIU+dZQGerZ1VUCC37XVzxmTPYp5Xi1
Od9rr/tOfhAm2/5J3kEG9ivSDvf0ETWs1O2ccwWtd+ucHO+z5mYRQXgm5ml9Pdkq
nfByGu80Lko=
=Fblg
-----END PGP SIGNATURE-----

Ludovic Courtès wrote 3 years ago
control message for bug #53708
(address . control@debbugs.gnu.org)
875yphy3gm.fsf@gnu.org
merge 53708 53643
quit
Ludovic Courtès wrote 3 years ago
Re: bug#53643: [PATCH] Gnu: Elixir: Use previous method for detecting sh
(name . John Hamelink)(address . me@johnhame.link)(address . 53643-done@debbugs.gnu.org)(name . Cees de Groot)(address . cg@evrl.com)
87pmnpwlek.fsf@gnu.org
Hi,

Toggle quote (7 lines)
> While following a tutorial, I found myself struggling to build
> elixir. After discussing on #guix, and looking on the build server for
> clues, it seems that the SEARCH-INPUT-FILE change in 3da297997d ("gnu:
> elixir: Use G-expressions.") was the culprit. Within the
> G-expression, I reverted to the use of WHICH for the "sh" binary,
> while leaving the others as they are.

Fixed along the lines of what Maxime and Cees suggested.

Thanks,
Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 53643@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 53643
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help