diff mbox series

[bug#51364] gnu: emacs-flymake-shellcheck: Add shellcheck as an input

Message ID BYAPR05MB4023A6FD0C1527D04116C7F3C5819@BYAPR05MB4023.namprd05.prod.outlook.com
State Accepted
Headers show
Series [bug#51364] gnu: emacs-flymake-shellcheck: Add shellcheck as an input | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Morgan Smith Oct. 23, 2021, 10:21 p.m. UTC
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/emacs-xyz.scm (emacs-flymake-shellcheck)
[inputs]: Add shellcheck.
[arguments]: Add substitute-shellcheck-path phase.
---
 gnu/packages/emacs-xyz.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Efraim Flashner Oct. 25, 2021, 11:39 a.m. UTC | #1
On Sat, Oct 23, 2021 at 06:21:28PM -0400, Morgan.J.Smith@outlook.com wrote:
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
> 
> * gnu/packages/emacs-xyz.scm (emacs-flymake-shellcheck)
> [inputs]: Add shellcheck.
> [arguments]: Add substitute-shellcheck-path phase.
> ---
>  gnu/packages/emacs-xyz.scm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index aeb6aa4aba..602e6067a4 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -1649,6 +1649,18 @@ (define-public emacs-flymake-shellcheck
>           (sha256
>            (base32 "04yfb4sy41spjzk9mhm4gy0h8vnjx09p2g6nm1yzgd9a5ph9sqgl"))))
>        (build-system emacs-build-system)
> +      (arguments
> +       '(#:phases
> +         (modify-phases %standard-phases
> +           (add-after 'unpack 'substitute-shellcheck-path
> +             (lambda* (#:key inputs #:allow-other-keys)
> +               (chmod "flymake-shellcheck.el" #o644)

This line I'd change to
(make-file-writable "flymake-shellcheck.el")

> +               (emacs-substitute-variables "flymake-shellcheck.el"
> +                 ("flymake-shellcheck-path"
> +                  (string-append (assoc-ref inputs "shellcheck")
> +                                 "/bin/shellcheck"))))))))
> +      (inputs
> +       `(("shellcheck" ,shellcheck)))
>        (home-page "https://github.com/federicotdn/flymake-shellcheck")
>        (synopsis "Flymake backend for Bash/Sh powered by ShellCheck")
>        (description
> -- 
> 2.33.1
> 

I'm not sure about hardcoding the path to shellcheck and removing the
option to override it in the normal way of the file, by setting
flymake-shellcheck-path¹. I am not sure of the exact return value of
(executable-find "shellcheck") but it seems safer to replace that.

Can you send an updated patch?

¹ I assume, I don't actually use emacs
diff mbox series

Patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index aeb6aa4aba..602e6067a4 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1649,6 +1649,18 @@  (define-public emacs-flymake-shellcheck
          (sha256
           (base32 "04yfb4sy41spjzk9mhm4gy0h8vnjx09p2g6nm1yzgd9a5ph9sqgl"))))
       (build-system emacs-build-system)
+      (arguments
+       '(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'substitute-shellcheck-path
+             (lambda* (#:key inputs #:allow-other-keys)
+               (chmod "flymake-shellcheck.el" #o644)
+               (emacs-substitute-variables "flymake-shellcheck.el"
+                 ("flymake-shellcheck-path"
+                  (string-append (assoc-ref inputs "shellcheck")
+                                 "/bin/shellcheck"))))))))
+      (inputs
+       `(("shellcheck" ,shellcheck)))
       (home-page "https://github.com/federicotdn/flymake-shellcheck")
       (synopsis "Flymake backend for Bash/Sh powered by ShellCheck")
       (description