~ruther/guix-local

e6f0746d6d88106066fb646f3d195f8306924f5c — Sharlatan Hellseher 5 months ago 843c85d
gnu: goawk: Build with go-1.24.

* gnu/packages/textutils.scm (goawk)[arguments] <go>: Use default (go-1.24).
<test-flags>: Disable vet during tests and move test skip logic here.
<phases>: Remove 'disable-failing-tests, and 'patch-pats; add
'pre-check, and 'post-check-remove-output-temp; use default 'check.

Change-Id: Id3b3c4c62fd660f693b7b7f44dd3129813894d58
1 files changed, 20 insertions(+), 25 deletions(-)

M gnu/packages/textutils.scm
M gnu/packages/textutils.scm => gnu/packages/textutils.scm +20 -25
@@ 1503,46 1503,41 @@ formats (e.g. Bibtex, RIS, etc.) using a common XML intermediate.")
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/benhoyt/goawk")
             (commit (string-append "v" version))))
              (url "https://github.com/benhoyt/goawk")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0riimisq3y6pahl1yld5yjxywh39i0v0kd4vmybf5j09klqynbn3"))))
    (build-system go-build-system)
    (arguments
     (list
      #:go go-1.23
      #:install-source? #f
      #:import-path "github.com/benhoyt/goawk"
      #:test-flags
      #~(list "-vet=off" ;Go@1.24 forces vet, but tests are not ready yet.
              ;; XXX: The most of the tests passed but some of the group fails
              ;; to find additional commands or compare output of test data.
              "-skip" "TestCommandLine|TestInterp")
      #: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)
          (add-before 'check 'pre-check
            (lambda* (#:key import-path #:allow-other-keys)
              (with-directory-excursion (string-append "src/" import-path)
                (substitute* (list "interp/interp.go" "goawk_test.go")
                (substitute* (list "interp/interp.go"
                                   "interp/interp_test.go"
                                   "goawk_test.go")
                  (("/bin/cat") (which "cat"))
                  (("/bin/echo") (which "echo"))
                  (("/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"))))))))
                  (("/testdata/output") "/testdata/output-tmp"))
                (mkdir "testdata/output-tmp"))))
          (add-after 'check 'post-check-remove-output-temp
            (lambda* (#:key  import-path #:allow-other-keys)
              (with-directory-excursion (string-append "src/" import-path)
                (delete-file-recursively "testdata/output-tmp")))))))
    (home-page "https://github.com/benhoyt/goawk")
    (synopsis "AWK interpreter with CSV support")
    (description