unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Brian Kubisiak <brian@kubisiak.com>
To: 72482@debbugs.gnu.org
Subject: [bug#72482] [PATCH 3/3] gnu: Add shfmt.
Date: Mon, 5 Aug 2024 16:05:37 -0700	[thread overview]
Message-ID: <a77b8bd9acc73e22e56fecb09714779d931fe660.1722894774.git.brian@kubisiak.com> (raw)
In-Reply-To: <cover.1722894774.git.brian@kubisiak.com>

* gnu/packages/golang.scm (shfmt): New variable.

Change-Id: I7c8bcb0f0a1d0c45d5f8f2274724188a435f0cd7
---
 gnu/packages/golang.scm | 48 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 63308d1af7..cf8e482bee 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8120,6 +8120,54 @@ (define-public go-mvdan-cc-gofumpt
     (native-inputs '())
     (inputs '())))

+(define-public shfmt
+  (package
+    (name "shfmt")
+    (version "3.8.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mvdan/sh")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "13anc64m088plwazrx5c68m3nbnig7wxa92zqk83w83q16dx42fq"))
+       (modules '((guix build utils)))
+       (snippet #~(let ((fixed-version (string-append #$version " (GNU Guix)")))
+                    ;; shfmt uses modules to look up the version at runtime;
+                    ;; since our build system does not yet support modules,
+                    ;; inject the version string here instead
+                    (substitute* "cmd/shfmt/main.go"
+                      (("version = \"\\(devel\\)\"")
+                       (format #f "version = \"~a\"" fixed-version)))
+                    (substitute* "cmd/shfmt/testdata/script/flags.txtar"
+                      (("devel\\|v3")
+                       #$version))))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "mvdan.cc/sh/v3/cmd/shfmt"
+      #:unpack-path "mvdan.cc/sh/v3"))
+    (inputs (list go-mvdan-cc-editorconfig
+                  go-golang-org-x-term
+                  go-golang-org-x-sys
+                  go-golang-org-x-sync
+                  go-github-com-rogpeppe-go-internal
+                  go-github-com-pkg-diff
+                  go-github-com-google-renameio-v2
+                  go-github-com-google-go-cmp-cmp
+                  go-github-com-frankban-quicktest
+                  go-github-com-creack-pty))
+    (home-page "https://github.com/mvdan/sh")
+    (synopsis "Shell formatter with bash support")
+    (description
+     "This package provides a shell formatter.  Supports
+@url{https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html,POSIX
+Shell}, @url{https://www.gnu.org/software/bash/,Bash}, and
+@url{http://www.mirbsd.org/mksh.htm,mksh}.")
+    (license license:bsd-3)))
+
 (define-public unparam
   (package
     (name "unparam")
--
2.45.2





  parent reply	other threads:[~2024-08-05 23:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 21:56 [bug#72482] [PATCH 0/3] Add shfmt Brian Kubisiak
2024-08-05 23:04 ` [bug#72482] [PATCH 1/3] gnu: Add go-github-com-google-renameio-v2 Brian Kubisiak
2024-08-05 23:05 ` [bug#72482] [PATCH 2/3] gnu: Add go-mvdan-cc-editorconfig Brian Kubisiak
2024-08-05 23:05 ` Brian Kubisiak [this message]
2024-08-23 17:42 ` bug#72482: [PATCH 0/3] Add shfmt Sharlatan Hellseher

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=a77b8bd9acc73e22e56fecb09714779d931fe660.1722894774.git.brian@kubisiak.com \
    --to=brian@kubisiak.com \
    --cc=72482@debbugs.gnu.org \
    /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).