From 4bd880624978dfd0c14c7f751b8b725c2d2e7d22 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Sun, 10 Jul 2022 01:58:41 +0000 Subject: gnu: Add goawk. * gnu/packages/gawk.scm (goawk): New variable. Co-authored-by: Ashish SHUKLA Signed-off-by: Sharlatan Hellseher Change-Id: I4011e97962b23bab10c516c7d4d2b25f92330f9d --- gnu/packages/textutils.scm | 58 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) 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 ;;; Copyright © 2021 Bonface Munyoki Kilyungi ;;; Copyright © 2022 Gabriel Wicki +;;; Copyright © 2022 Paul A. Patience ;;; Copyright © 2023 Reza Housseini ;;; Copyright © 2023 Hilton Chain ;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com> -;;; Copyright © 2024 Timotej Lazar ;; +;;; Copyright © 2024 Timotej Lazar ;;; Copyright © 2024 Sharlatan Hellseher +;;; Copyright © 2024 Ashish SHUKLA ;;; ;;; 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") -- cgit v1.2.3