aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2022-07-10 01:58:41 +0000
committerSharlatan Hellseher <sharlatanus@gmail.com>2024-08-14 09:37:12 +0100
commit4bd880624978dfd0c14c7f751b8b725c2d2e7d22 (patch)
tree267d7a6e186a009f8028f3b2c096913a60171190
parent99a81b6f2a1386d6ea76a6ecb1942f1f7f891080 (diff)
downloadguix-4bd880624978dfd0c14c7f751b8b725c2d2e7d22.tar.gz
guix-4bd880624978dfd0c14c7f751b8b725c2d2e7d22.zip
gnu: Add goawk.
* gnu/packages/gawk.scm (goawk): New variable. Co-authored-by: Ashish SHUKLA <ashish.is@lostca.se> Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com> Change-Id: I4011e97962b23bab10c516c7d4d2b25f92330f9d
-rw-r--r--gnu/packages/textutils.scm58
1 files changed, 57 insertions, 1 deletions
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 7deea364d8..b7ed686371 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -25,11 +25,13 @@
;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
;;; Copyright © 2022 Gabriel Wicki <gabriel@erlikon.ch>
+;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space>
;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
-;;; Copyright © 2024 Timotej Lazar <timotej.lazar@araneo.si>;;
+;;; Copyright © 2024 Timotej Lazar <timotej.lazar@araneo.si>
;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1254,6 +1256,60 @@ OpenDocument presentations (*.odp).")
formats (e.g. Bibtex, RIS, ...) using a common XML intermediate.")
(license license:gpl2)))
+(define-public goawk
+ (package
+ (name "goawk")
+ (version "1.27.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/benhoyt/goawk")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "003idgqj1g41y4sja9gzbds95fl3ba0l20wfgh7hp4kiivgls7r8"))))
+ (build-system go-build-system)
+ (arguments
+ (list
+ #:install-source? #f
+ #:import-path "github.com/benhoyt/goawk"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-failing-tests
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ ;; Disable tests trying to setup up locale and requiring gawk
+ ;; executable.
+ (substitute* (find-files "." "\\_test.go$")
+ (("TestShellCommand") "OffTestShellCommand")
+ (("TestInterp") "OffTestInterp")
+ (("TestCommandLine") "OffTestCommandLine")))))
+ (add-before 'check 'patch-paths
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ (substitute* (list "interp/interp.go" "goawk_test.go")
+ (("/bin/sh") (which "sh")))
+ (substitute* "goawk_test.go"
+ ;; During tests goawk tries to write to existing files,
+ ;; point to an empty directory instead.
+ (("/testdata/output") "/testdata/output-tmp")))))
+ (replace 'check
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (when tests?
+ (with-directory-excursion (string-append "src/" import-path)
+ (mkdir "testdata/output-tmp")
+ (invoke "go" "test" "./...")
+ ;; Make sure we have not left any generated articfacts
+ ;; during tests and moved them to the store.
+ (delete-file-recursively "testdata/output-tmp"))))))))
+ (home-page "https://github.com/benhoyt/goawk")
+ (synopsis "AWK interpreter with CSV support")
+ (description
+ "GoAWK is a POSIX-compatible version of AWK that also has a CSV mode for
+reading and writing CSV and TSV files.")
+ (license license:expat)))
+
(define-public opencc
(package
(name "opencc")