Subject: [bug#53643] [PATCH] gnu: elixir: Use previous method for detecting sh

From: John Hamelink <[email-masked]>
Date: Sun, 30 Jan 2022 23:08:56 +0000

Hi Maxime,

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

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

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