[PATCH] gnu: Add goawk.

  • Done
  • quality assurance status badge
Details
4 participants
  • Ludovic Courtès
  • Maxime Devos
  • Paul A. Patience
  • Sharlatan Hellseher
Owner
unassigned
Submitted by
Paul A. Patience
Severity
normal
P
P
Paul A. Patience wrote on 10 Jul 2022 03:58
(address . guix-patches@gnu.org)(name . Paul A. Patience)(address . paul@apatience.com)
20220710015832.129472-1-paul@apatience.com
* gnu/packages/gawk.scm (goawk): New variable.
---
gnu/packages/gawk.scm | 41 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)

Toggle diff (56 lines)
diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 9feaf059fb..9bc96d87e7 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -33,7 +33,8 @@ (define-module (gnu packages gawk)
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix build-system copy)
- #:use-module (guix build-system gnu))
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system go))

(define-public gawk
(package
@@ -245,3 +246,41 @@ (define-public cppawk-egawk
(delete "gawk-mpfr")
(prepend egawk-next)))
(synopsis "cppawk that calls Enhanced GNU Awk by default")))
+
+(define-public goawk
+ (package
+ (name "goawk")
+ (version "1.19.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 "12z7nzrqyx0y18bsc95i1vp251jw3ik2xj5g8bc12vybndw5x0j0"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/benhoyt/goawk"
+ #:install-source? #f
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-paths
+ (lambda _
+ (substitute* "src/github.com/benhoyt/goawk/interp/interp.go"
+ (("/bin/sh") (which "sh")))
+ (substitute* "src/github.com/benhoyt/goawk/goawk_test.go"
+ (("/bin/sh") (which "sh")))))
+ (add-after 'fix-paths 'fix-tests
+ (lambda _
+ (substitute* "src/github.com/benhoyt/goawk/goawk_test.go"
+ ;; Don't write test output; it is compared with expected
+ ;; results anyway.
+ (("\"writegoawk\", true") "\"writegoawk\", false")))))))
+ (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)))
--
2.36.1
P
P
Paul A. Patience wrote on 11 Jul 2022 14:17
(address . 56474@debbugs.gnu.org)
874jzn4zgk.fsf@apatience.com
Don't merge this yet, I need to apply some changes.

GoAWK also exposes a Go package, so I need to remove the
‘#:install-source #f’ line.
However, how should I go about naming the package (or packages)?

The Go library should be go-github-com-benhoyt-goawk (in
gnu/packages/golang.scm), but should there be an additional package
named just goawk for the command itself that goes in
gnu/packages/gawk.scm?

Thanks,
Paul
L
L
Ludovic Courtès wrote on 19 Jul 2022 23:03
(name . Paul A. Patience)(address . paul@apatience.com)(address . 56474@debbugs.gnu.org)
87a694rf1f.fsf_-_@gnu.org
Hi,

"Paul A. Patience" <paul@apatience.com> skribis:

Toggle quote (11 lines)
> Don't merge this yet, I need to apply some changes.
>
> GoAWK also exposes a Go package, so I need to remove the
> ‘#:install-source #f’ line.
> However, how should I go about naming the package (or packages)?
>
> The Go library should be go-github-com-benhoyt-goawk (in
> gnu/packages/golang.scm), but should there be an additional package
> named just goawk for the command itself that goes in
> gnu/packages/gawk.scm?

Maybe leave ‘goawk’ in golang.scm so that gawk.scm doesn’t pull in all
of Go?

Thanks,
Ludo’.
M
M
Maxime Devos wrote on 20 Jul 2022 15:34
Re: [bug#56474] [PATCH] gnu: Add goawk.
f3c3d5c3-d4b0-de6e-fab3-42ce27b55834@telenet.be
On 10-07-2022 03:58, Paul A. Patience wrote:
Toggle quote (23 lines)
> * gnu/packages/gawk.scm (goawk): New variable.
> ---
> gnu/packages/gawk.scm | 41 ++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
> index 9feaf059fb..9bc96d87e7 100644
> --- a/gnu/packages/gawk.scm
> +++ b/gnu/packages/gawk.scm
> @@ -33,7 +33,8 @@ (define-module (gnu packages gawk)
> #:use-module (guix git-download)
> #:use-module (guix utils)
> #:use-module (guix build-system copy)
> - #:use-module (guix build-system gnu))
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system go))
>
> (define-public gawk
> (package
> @@ -245,3 +246,41 @@ (define-public cppawk-egawk
> (delete "gawk-mpfr")
> (prepend egawk-next)))
> (synopsis "cppawk that calls Enhanced GNU Awk by default")))
What Ludo wrote about not making the module graph more cyclic than it
already is with all that entails, and ...
Toggle quote (25 lines)
> +(define-public goawk
> + (package
> + (name "goawk")
> + (version "1.19.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 "12z7nzrqyx0y18bsc95i1vp251jw3ik2xj5g8bc12vybndw5x0j0"))))
> + (build-system go-build-system)
> + (arguments
> + '(#:import-path "github.com/benhoyt/goawk"
> + #:install-source? #f
> + #:phases
> + (modify-phases %standard-phases
> + (add-after 'unpack 'fix-paths
> + (lambda _
> + (substitute* "src/github.com/benhoyt/goawk/interp/interp.go"
> + (("/bin/sh") (which "sh")))
> + (substitute* "src/github.com/benhoyt/goawk/goawk_test.go"
> + (("/bin/sh") (which "sh")))))
... these two can be combined, substitute* accepts a list of files, it's
not restricted to a single file.
Also, this which seems incorrect when cross-compiling, do
(search-input-file inputs "bin/sh") instead and add 'bash-minimal' (or
'bash'?) to inputs, so you get the cross-compiled bash instead of the
native bash (for the goawk_test.go, it probably doesn't matter, but it's
important for interp.go).
Greetings,
Maxime.
Attachment: OpenPGP_signature
L
L
Ludovic Courtès wrote on 3 Aug 2022 12:05
control message for bug #56474
(address . control@debbugs.gnu.org)
878ro5vdzh.fsf@gnu.org
tags 56474 + moreinfo
quit
S
S
Sharlatan Hellseher wrote on 14 Aug 10:44 +0200
[PATCH] gnu: Add goawk.
(address . 56474-done@debbugs.gnu.org)
87wmkjze6e.fsf@gmail.com
Hi,

I've picked up some ideas from the recent patch with
https://issues.guix.gnu.org/72595 and from the way how it's packed in
NixOS

- Copyright for both patches reserved
- Package does not depend on gawk
- Failing tests are silent
- Tests do no change existing files
- All artifacts are removed after check phase

--
Oleg
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEmEeB3micIcJkGAhndtcnv/Ys0rUFAma8bnkACgkQdtcnv/Ys
0rXTFg/+NDt62uZW6QHtSM4QFMyEsrYU0frMkn5j4THcCnNMdf/iuHQMAM72REFC
MAmoahP127WaS8IrvZAa3e1quxN4bL2CHeBwq0f5TPWwfW2bLDo3jDn/yStd0meV
zUksNeSxiMBDSdkEfuHM0NHFqMjHSJNci9d4EY8ThbAYkeQASXVaJZT7CPGvMLS1
HV8udNkGwhPHEhIhliKMXmNbnPiHAw1Nibzu45GuQahyHdotezSjiFytwgShpL/h
/2h4k/oQjZ8Xy4CSRRne8c5lXD1Q2FogqfxI86gLHmaraO/6s/ulgPH7aFKF1Ix5
Rlpj8eda6c38YWxa5xgmu/Fqcwfe2+80rSHIheCYPWXa3jaOSVznvNdxGCnI399T
LMXS6KiolcpfjlM2DnNiZu0iYF8jl63s3z7JwhBWf+ryjPOc/bC3tSLK39OUsha7
dNRJlB3on6CXLGNRFV3aAXoWmdojsn8oDnEwA+SbfLQBKzaxJT+xTHYJFEujFg5O
ZPBiUvTyV2c8x2N1p7FxNJGRQVWqqLHll2vOgZcjteYrP8eIeXM4twstycaiVqJC
je8uGL4wQ0kItp316mghgOdoyGn+GO4lnjRT0iGmEqF49kYMzs635uOtTltyzEg3
k1U9eoZHcEdxsU+cLvWUQEz7sbeIl/g5k+Ktvk/IWsPTOgTSnU8=
=6BzI
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 56474@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 56474
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch