unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#72189] [PATCH 0/7] Update and unbundle vale - part II
@ 2024-07-19 15:52 Sharlatan Hellseher
  2024-07-19 19:56 ` bug#72191: " Sharlatan Hellseher
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 15:52 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

Hi Guix!

This patch servies refresh vale to the aproximitly latest version which does
not include any vendor directory. Most of the missing inputs were packed in
<https://issues.guix.gnu.org/71843>.

I've made sure that introduced changes did not break the build of other
dependent packages:
--8<---------------cut here---------------start------------->8---
> ./pre-inst-env guix refresh --list-dependent vale
  go-github-com-mitchellh-mapstructure go-github-com-spf13-viper
  go-github-com-jdkato-twine go-github-com-mholt-archiver-v3
  go-github-com-xi2-xz go-github-com-niklasfasching-go-org
--8<---------------cut here---------------end--------------->8---

Sharlatan Hellseher (7):
  gnu: Add go-github-com-niklasfasching-go-org.
  gnu: Add go-github-com-xi2-xz.
  gnu: Add go-github-com-mholt-archiver-v3.
  gnu: go-github-com-jdkato-twine: Enable tests.
  gnu: go-github-com-spf13-viper: Disable tests.
  gnu: go-github-com-mitchellh-mapstructure: Update to 1.5.0.
  gnu: vale: Update to 3.4.2.

 gnu/packages/golang-compression.scm | 122 ++++++++++++++++++++++++++++
 gnu/packages/golang-xyz.scm         |  95 +++++++++++++++++-----
 gnu/packages/golang.scm             |   6 +-
 gnu/packages/textutils.scm          | 108 +++++++++++++++++-------
 4 files changed, 281 insertions(+), 50 deletions(-)


base-commit: 1aa8dfaeec3c6e4e587aadf7440246f7c5c04b9f
-- 
2.41.0





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72191: [PATCH 0/7] Update and unbundle vale - part II
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
@ 2024-07-19 19:56 ` Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 1/7] gnu: Add go-github-com-niklasfasching-go-org Sharlatan Hellseher
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:56 UTC (permalink / raw)
  To: 72191-done

[-- Attachment #1: Type: text/plain, Size: 52 bytes --]


Duplicated to #72189, bad day of outage.

Closing.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#72189] [PATCH 1/7] gnu: Add go-github-com-niklasfasching-go-org.
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
  2024-07-19 19:56 ` bug#72191: " Sharlatan Hellseher
@ 2024-07-19 19:57 ` Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 2/7] gnu: Add go-github-com-xi2-xz Sharlatan Hellseher
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:57 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

* gnu/packages/golang-xyz.scm (go-github-com-niklasfasching-go-org): New variable.

Change-Id: I0d17d5d1d25f0a0995e148ffe4cf40225ca5982d
---
 gnu/packages/golang-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index 9931911e32..159f2dd44e 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -3903,6 +3903,61 @@ (define-public go-github-com-neurosnap-sentences
 list of sentences.")
     (license license:expat)))
 
+(define-public go-github-com-niklasfasching-go-org
+  (package
+    (name "go-github-com-niklasfasching-go-org")
+    (version "1.7.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/niklasfasching/go-org")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100ay19a7my2m1za1ih0wvqxf5mq77byas1f23mx69qsbp391w04"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "github.com/niklasfasching/go-org"
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; FIXME: Pattern embedded: cannot embed directory embedded:
+          ;; contains no embeddable files.
+          ;;
+          ;; This happens due to Golang can't determine the valid directory of
+          ;; the module which is sourced during setup environment phase, but
+          ;; easy resolved after coping to expected directory "vendor" within
+          ;; the current package, see details in Golang source:
+          ;;
+          ;; - URL: <https://github.com/golang/go/blob/>
+          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
+          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
+          (add-before 'build 'copy-input-to-vendor-directory
+            (lambda* (#:key import-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                (mkdir "vendor")
+                (copy-recursively
+                 (string-append
+                  #$(this-package-input "go-github-com-alecthomas-chroma-v2")
+                  "/src/github.com")
+                 "vendor/github.com"))))
+          (add-before 'install 'remove-vendor-directory
+            (lambda* (#:key import-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                (delete-file-recursively "vendor")))))))
+    (propagated-inputs
+     (list go-golang-org-x-net
+           go-github-com-pmezard-go-difflib
+           go-github-com-alecthomas-chroma-v2))
+    (home-page "https://github.com/niklasfasching/go-org")
+    (synopsis "Org mode parser and render for Golang")
+    (description
+     "This package provides a library and CLI program to parse the
+@code{org-mode} file format alongside a static site generator with HTML &
+pretty printed rendering in Golang.")
+    (license license:expat)))
+
 (define-public go-github-com-nsqio-go-diskqueue
   (package
     (name "go-github-com-nsqio-go-diskqueue")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#72189] [PATCH 2/7] gnu: Add go-github-com-xi2-xz.
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
  2024-07-19 19:56 ` bug#72191: " Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 1/7] gnu: Add go-github-com-niklasfasching-go-org Sharlatan Hellseher
@ 2024-07-19 19:57 ` Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 3/7] gnu: Add go-github-com-mholt-archiver-v3 Sharlatan Hellseher
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:57 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

* gnu/packages/golang-compression.scm (go-github-com-xi2-xz): New variable.

Change-Id: I794886d82f532a626599ca6f07a1ce7e694bea04
---
 gnu/packages/golang-compression.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/golang-compression.scm b/gnu/packages/golang-compression.scm
index a6c0410051..c4465f1bcd 100644
--- a/gnu/packages/golang-compression.scm
+++ b/gnu/packages/golang-compression.scm
@@ -331,6 +331,34 @@ (define-public go-github-com-ulikunitz-xz
 any dependency on any C code.")
     (license license:bsd-3)))
 
+(define-public go-github-com-xi2-xz
+  (package
+    (name "go-github-com-xi2-xz")
+    (version "0.0.0-20171230120015-48954b6210f8")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/xi2/xz")
+             (commit (go-version->git-ref version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "178r0fa2dpzxf0sabs7dn0c8fa7vs87zlxk6spkn374ls9pir7nq"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "github.com/xi2/xz"))
+    (home-page "https://github.com/xi2/xz")
+    (synopsis "Native Golang XZ decompression package")
+    (description
+     "This package implements a native XZ decompression in Golang.")
+    ;; This package is a modified version of XZ Embedded
+    ;; <http://tukaani.org/xz/embedded.html>: 0BSD
+    ;;
+    ;; The contents of the testdata directory are modified versions of the
+    ;; test files from XZ Utils <http://tukaani.org/xz/>: 0BSD
+    (license license:public-domain)))
+
 ;;;
 ;;; Executables:
 ;;;
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#72189] [PATCH 3/7] gnu: Add go-github-com-mholt-archiver-v3.
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
                   ` (2 preceding siblings ...)
  2024-07-19 19:57 ` [bug#72189] [PATCH 2/7] gnu: Add go-github-com-xi2-xz Sharlatan Hellseher
@ 2024-07-19 19:57 ` Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 4/7] gnu: go-github-com-jdkato-twine: Enable tests Sharlatan Hellseher
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:57 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

* gnu/packages/golang-compression.scm (go-github-com-mholt-archiver-v3,
go-arc): New variables.

Change-Id: I37f628de21475f98acb10dcff86780b697bba839
---
 gnu/packages/golang-compression.scm | 94 +++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/gnu/packages/golang-compression.scm b/gnu/packages/golang-compression.scm
index c4465f1bcd..be7af6f894 100644
--- a/gnu/packages/golang-compression.scm
+++ b/gnu/packages/golang-compression.scm
@@ -218,6 +218,86 @@ (define-public go-github-com-klauspost-pgzip
 time, as otherwise the internal gzip library will likely be faster.")
     (license (list license:bsd-3 license:expat))))
 
+(define-public go-github-com-mholt-archiver-v3
+  (package
+    (name "go-github-com-mholt-archiver-v3")
+    (version "3.5.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mholt/archiver")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1py186hfy4p69wghqmbsyi1r3xvw1nyl55pz8f97a5qhmwxb3mwp"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "github.com/mholt/archiver/v3"))
+    (propagated-inputs
+     (list go-github-com-andybalholm-brotli
+           go-github-com-dsnet-compress
+           go-github-com-golang-snappy
+           go-github-com-klauspost-compress
+           go-github-com-klauspost-pgzip
+           go-github-com-nwaples-rardecode
+           go-github-com-pierrec-lz4-v4
+           go-github-com-ulikunitz-xz
+           go-github-com-xi2-xz))
+    (home-page "https://github.com/mholt/archiver")
+    (synopsis "Multi format archiver Golang library and CLI commad")
+    (description
+     "Package archiver facilitates convenient, cross-platform, high-level
+archival and compression operations for a variety of formats and compression
+algorithms.
+
+Features:
+@itemize
+@item stream-oriented APIs
+@item automatically identify archive and compression formats
+@item traverse directories, archive files, and any other file uniformly as
+@code{io/fs} file systems
+@item compress and decompress files
+@item create and extract archive files
+@item walk or traverse into archive files
+@item extract only specific files from archives
+@item insert (append) into .tar and .zip archives
+@item read from password-protected 7-Zip files
+@item numerous archive and compression formats supported
+@item extensible (add more formats just by registering them)
+@item cross-platform, static binary
+@item pure Golang (no cgo)
+@item multithreaded Gzip
+@item adjust compression levels
+@item automatically add compressed files to zip archives without
+re-compressing
+@item open password-protected rar archives
+@end itemize
+
+Supported compression formats:
+@itemize
+@item brotli (.br)
+@item bzip2 (.bz2)
+@item flate (.zip)
+@item gzip (.gz)
+@item lz4 (.lz4)
+@item lzip (.lz)
+@item snappy (.sz)
+@item xz (.xz)
+@item zlib (.zz)
+@item zstandard (.zst)
+@end itemize
+
+Supported archive formats:
+@itemize
+@item .zip
+@item .tar (including any compressed variants like .tar.gz)
+@item .rar (read-only)
+@item .7z (read-only)
+@end itemize")
+    (license license:expat)))
+
 (define-public go-github-com-nwaples-rardecode
   (package
     (name "go-github-com-nwaples-rardecode")
@@ -363,6 +443,20 @@ (define-public go-github-com-xi2-xz
 ;;; Executables:
 ;;;
 
+(define-public go-arc
+  (package
+    (inherit go-github-com-mholt-archiver-v3)
+    (name "go-arc")
+    (arguments
+     (list
+      #:install-source? #f
+      #:import-path "github.com/mholt/archiver/cmd/arc"
+      #:unpack-path "github.com/mholt/archiver"))
+    (description
+     (string-append (package-description go-github-com-mholt-archiver-v3)
+                    "\nThis package provides an command line interface (CLI)
+tool."))))
+
 (define-public go-lz4c
   (package
     (inherit go-github-com-pierrec-lz4-v4)
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#72189] [PATCH 4/7] gnu: go-github-com-jdkato-twine: Enable tests.
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
                   ` (3 preceding siblings ...)
  2024-07-19 19:57 ` [bug#72189] [PATCH 3/7] gnu: Add go-github-com-mholt-archiver-v3 Sharlatan Hellseher
@ 2024-07-19 19:57 ` Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 5/7] gnu: go-github-com-spf13-viper: Disable tests Sharlatan Hellseher
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:57 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

* gnu/packages/golang-xyz.scm (go-github-com-jdkato-twine) [source]: Add
snippet adjusting changed upstream module import path.
[arguments]: <#:phases>: Remove 'build and 'patch-module-import-path
phases. Add 'disable-failing-tests phase. Use custom 'check phase.

Change-Id: I8553705ca0b812c772005460b242ce47b0c65ced
---
 gnu/packages/golang-xyz.scm | 40 ++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index 159f2dd44e..6b6c953a1d 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -2644,33 +2644,33 @@ (define-public go-github-com-jdkato-twine
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1hbpxcrcsbi975lklrhzyzk0fzn79pxicvfyf2sckmd2n6jb4ayy"))))
+        (base32 "1hbpxcrcsbi975lklrhzyzk0fzn79pxicvfyf2sckmd2n6jb4ayy"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            ;; Module name has been changed upstream.
+            (substitute* (find-files "." "\\.go$")
+              (("gopkg.in/neurosnap/sentences.v1")
+               "github.com/neurosnap/sentences"))))))
     (build-system go-build-system)
     (arguments
      (list
-      ;; FIXME: Adjust tests sute or check with upstram:
-      ;; === Failed
-      ;; === FAIL: nlp/segment TestGoldenRules (0.00s)
-      ;;     segment_test.go:143: 25. Double quotations inside sentence
-      ;;     segment_test.go:144: Actual: [She turned to him, "This is great." she said.]
-      ;;     segment_test.go:145: Actual: 2, Expected: 1
-      ;;     segment_test.go:146: ===
-      #:tests? #f
       #:import-path "github.com/jdkato/twine"
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'patch-module-import-path
-            (lambda* (#:key import-path #:allow-other-keys)
-              (with-directory-excursion (string-append "src/" import-path)
-                (substitute* (find-files "." "\\.go$")
-                  (("gopkg.in/neurosnap/sentences.v1")
-                   "github.com/neurosnap/sentences")))))
-          (replace 'build
-            (lambda* (#:key import-path #:allow-other-keys)
+          (add-after 'unpack 'disable-failing-tests
+            (lambda* (#:key tests? import-path #:allow-other-keys)
               (with-directory-excursion (string-append "src/" import-path)
-                (invoke "go" "build" "-v" "-x" "-ldflags=-s -w" "-trimpath" "./...")))))))
-    (native-inputs
-     (list gotestsum))
+                (substitute* "nlp/segment/segment_test.go"
+                  (("TestGoldenRules") "OffTestGoldenRules")))))
+          ;; XXX: Workaround for go-build-system's lack of Go modules
+          ;; support.
+          (delete 'build)
+          (replace 'check
+            (lambda* (#:key tests? import-path #:allow-other-keys)
+              (when tests?
+                (with-directory-excursion (string-append "src/" import-path)
+                  (invoke "go" "test" "-v" "./..."))))))))
     (propagated-inputs
      (list go-github-com-montanaflynn-stats
            go-github-com-neurosnap-sentences
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#72189] [PATCH 5/7] gnu: go-github-com-spf13-viper: Disable tests.
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
                   ` (4 preceding siblings ...)
  2024-07-19 19:57 ` [bug#72189] [PATCH 4/7] gnu: go-github-com-jdkato-twine: Enable tests Sharlatan Hellseher
@ 2024-07-19 19:57 ` Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 6/7] gnu: go-github-com-mitchellh-mapstructure: Update to 1.5.0 Sharlatan Hellseher
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:57 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

* gnu/packages/golang.scm (go-github-com-spf13-viper): Disable tests.

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

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 3ea153978f..698dfe0120 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -3610,6 +3610,7 @@ (define-public go-github-com-spf13-pflag
 (define-public go-github-com-spf13-viper
   (package
     (name "go-github-com-spf13-viper")
+    ;; Refreshing to a newer version requires long chain of missing packages.
     (version "1.7.0")
     (source
      (origin
@@ -3624,6 +3625,7 @@ (define-public go-github-com-spf13-viper
     (build-system go-build-system)
     (arguments
      (list
+      #:tests? #f
       #:import-path "github.com/spf13/viper"))
     (propagated-inputs
      (list go-github-com-fsnotify-fsnotify
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#72189] [PATCH 6/7] gnu: go-github-com-mitchellh-mapstructure: Update to 1.5.0.
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
                   ` (5 preceding siblings ...)
  2024-07-19 19:57 ` [bug#72189] [PATCH 5/7] gnu: go-github-com-spf13-viper: Disable tests Sharlatan Hellseher
@ 2024-07-19 19:57 ` Sharlatan Hellseher
  2024-07-19 19:57 ` [bug#72189] [PATCH 7/7] gnu: vale: Update to 3.4.2 Sharlatan Hellseher
  2024-07-22 22:31 ` bug#72189: [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:57 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

* gnu/packages/golang.scm (go-github-com-mitchellh-mapstructure): Update to 1.5.0.

Change-Id: I3e18dabc4da5e4eec40cfe4328a6244dcc530e7d
---
 gnu/packages/golang.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 698dfe0120..fed47a3daf 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -4781,7 +4781,7 @@ (define-public go-github-com-mitchellh-go-homedir
 (define-public go-github-com-mitchellh-mapstructure
   (package
     (name "go-github-com-mitchellh-mapstructure")
-    (version "1.1.2") ;; NOTE: Updating to 1.3.1 breaks tests on viper-1.7.0
+    (version "1.5.0")
     (source
      (origin
        (method git-fetch)
@@ -4791,7 +4791,7 @@ (define-public go-github-com-mitchellh-mapstructure
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "03bpv28jz9zhn4947saqwi328ydj7f6g6pf1m2d4m5zdh5jlfkrr"))))
+         "10f2v143lkip8h46shd99k5yavfqpgqmd7a6y42v7szc0lcn3mff"))))
     (build-system go-build-system)
     (arguments
      `(#:import-path "github.com/mitchellh/mapstructure"))
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#72189] [PATCH 7/7] gnu: vale: Update to 3.4.2.
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
                   ` (6 preceding siblings ...)
  2024-07-19 19:57 ` [bug#72189] [PATCH 6/7] gnu: go-github-com-mitchellh-mapstructure: Update to 1.5.0 Sharlatan Hellseher
@ 2024-07-19 19:57 ` Sharlatan Hellseher
  2024-07-22 22:31 ` bug#72189: [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-19 19:57 UTC (permalink / raw)
  To: 72189; +Cc: Sharlatan Hellseher

* gnu/packages/textutils.scm (vale): Update to 3.4.2.
[source]: Change snippets removing vendored modules as they are not
provided any more, to one adjusting module import path.
[arguments]: <#:phases>: Add 'disable-failing-tests,
'copy-input-to-vendor-directory and 'remove-vendor-directory phases. Use
custom 'check phase.
[native-inputs]: Remove go-github-com-fatih-color,
go-github-com-mitchellh-go-homedir, go-github-com-spf13-afero,
go-github-com-urfave-cli, and go-gopkg-in-ini-v1; add
go-github-com-masterminds-sprig-v3, go-github-com-adrg-strutil,
go-github-com-adrg-xdg, go-github-com-bmatcuk-doublestar-v4,
go-github-com-d5-tengo-v2, go-github-com-errata-ai-ini,
go-github-com-errata-ai-regexp2, go-github-com-expr-lang-expr,
go-github-com-jdkato-twine, go-github-com-karrick-godirwalk,
go-github-com-mholt-archiver-v3, go-github-com-niklasfasching-go-org,
go-github-com-otiai10-copy, go-github-com-pterm-pterm,
go-github-com-remeh-sizedwaitgroup, go-github-com-spf13-pflag,
go-golang-org-x-exp, and go-golang-org-x-sys.

Change-Id: Ie378b419e34a924a5f1c8b383b029706d9846216
---
 gnu/packages/textutils.scm | 108 +++++++++++++++++++++++++++----------
 1 file changed, 80 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 39205f3784..7deea364d8 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -1428,7 +1428,9 @@ (define-public aha
 (define-public vale
   (package
     (name "vale")
-    (version "2.4.0")
+    ;; Newer versions requires <github.com/smacker/go-tree-sitter> which is
+    ;; quite a large project to pack.
+    (version "3.4.2")
     (source
      (origin
        (method git-fetch)
@@ -1436,43 +1438,93 @@ (define-public vale
              (url "https://github.com/errata-ai/vale")
              (commit (string-append "v" version))))
        (sha256
-        (base32 "0d07fwha2220m8j24h527xl0gnl3svvyaywflgk5292d6g49ach2"))
+        (base32 "15f8ggh7hpfmfpszl9qkdfz19kds6gg6x5dgcqy0v6jrcsdbgpgp"))
        (file-name (git-file-name name version))
        (modules '((guix build utils)))
-       ;; Remove some available vendor modules.
-       ;; TODO: Pack all of them and remove vendor directory completely.
        (snippet
-        '(for-each
-          delete-file-recursively
-          (list "vendor/github.com/fatih/color"
-                "vendor/github.com/mitchellh/mapstructure"
-                "vendor/github.com/gobwas/glob"
-                "vendor/github.com/mitchellh/go-homedir"
-                "vendor/github.com/olekukonko/tablewriter"
-                "vendor/github.com/spf13/afero"
-                "vendor/github.com/urfave/cli"
-                "vendor/github.com/yuin/goldmark"
-                "vendor/golang.org/x/net/html"
-                "vendor/gopkg.in/ini.v1"
-                "vendor/gopkg.in/yaml.v2")))))
+        #~(begin
+            ;; Module name has been changed upstream.
+            (substitute* (find-files "." "\\.go$")
+              (("github.com/antonmedv/expr") "github.com/expr-lang/expr"))))))
     (build-system go-build-system)
     (arguments
-     (list #:install-source? #f
-           #:import-path "github.com/errata-ai/vale"))
+     (list
+      #:install-source? #f
+      #:import-path "github.com/errata-ai/vale/cmd/vale"
+      #:unpack-path "github.com/errata-ai/vale"
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Disable tests requring network access: Get
+          ;; "https://raw.githubusercontent.com/errata-ai/styles/master/library.json":
+          ;; dial tcp: lookup raw.githubusercontent.com on [::1]:53:
+          ;; read udp [::1]:52621->[::1]:53: read: connection refused.
+          (add-after 'unpack 'disable-failing-tests
+            (lambda* (#:key tests? unpack-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" unpack-path)
+                (substitute* (find-files "." "\\_test.go$")
+                  (("TestLibrary") "OffTestLibrary")
+                  (("TestLocalComplete") "OffTestLocalComplete")
+                  (("TestLocalDir") "OffTestLocalDir")
+                  (("TestLocalOnlyStyles") "OffTestLocalOnlyStyles")
+                  (("TestLocalZip") "OffTestLocalZip")
+                  (("TestNoPkgFound") "OffTestNoPkgFound")
+                  (("TestV3Pkg") "OffTestV3Pkg")))))
+          ;; FIXME: Pattern embedded: cannot embed directory embedded:
+          ;; contains no embeddable files.
+          ;;
+          ;; This happens due to Golang can't determine the valid directory of
+          ;; the module which is sourced during setup environment phase, but
+          ;; easy resolved after coping to expected directory "vendor" within
+          ;; the current package, see details in Golang source:
+          ;;
+          ;; - URL: <https://github.com/golang/go/blob/>
+          ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
+          ;; - file: src/cmd/go/internal/load/pkg.go#L2059
+          (add-before 'build 'copy-input-to-vendor-directory
+            (lambda* (#:key unpack-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" unpack-path)
+                (mkdir "vendor")
+                (copy-recursively
+                 (string-append
+                  #$(this-package-native-input "go-github-com-jdkato-twine")
+                  "/src/github.com")
+                 "vendor/github.com"))))
+          ;; XXX: Workaround for go-build-system's lack of Go modules
+          ;; support.
+          (replace 'check
+            (lambda* (#:key tests? unpack-path #:allow-other-keys)
+              (when tests?
+                (with-directory-excursion (string-append "src/" unpack-path)
+                  (setenv "HOME" "/tmp")
+                  (invoke "go" "test" "-v" "./...")))))
+          (add-before 'install 'remove-vendor-directory
+            (lambda* (#:key unpack-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" unpack-path)
+                (delete-file-recursively "vendor")))))))
     (native-inputs
-     (list go-github-com-fatih-color
-           go-github-com-mitchellh-mapstructure
+     (list go-github-com-masterminds-sprig-v3
+           go-github-com-adrg-strutil
+           go-github-com-adrg-xdg
+           go-github-com-bmatcuk-doublestar-v4
+           go-github-com-d5-tengo-v2
+           go-github-com-errata-ai-ini
+           go-github-com-errata-ai-regexp2
+           go-github-com-expr-lang-expr
            go-github-com-gobwas-glob
-           ;; go-github-com-jdkato-prose
-           ;; go-github-com-jdkato-regexp
-           go-github-com-mitchellh-go-homedir
+           go-github-com-jdkato-twine
+           go-github-com-karrick-godirwalk
+           go-github-com-mholt-archiver-v3
+           go-github-com-mitchellh-mapstructure
+           go-github-com-niklasfasching-go-org
            go-github-com-olekukonko-tablewriter
-           ;; go-github-com-remeh-sizedwaitgroup
-           go-github-com-spf13-afero
-           go-github-com-urfave-cli
+           go-github-com-otiai10-copy
+           go-github-com-pterm-pterm
+           go-github-com-remeh-sizedwaitgroup
+           go-github-com-spf13-pflag
            go-github-com-yuin-goldmark
+           go-golang-org-x-exp
            go-golang-org-x-net
-           go-gopkg-in-ini-v1
+           go-golang-org-x-sys
            go-gopkg-in-yaml-v2))
     (home-page "https://github.com/errata-ai/vale")
     (synopsis "Fully customizable syntax-aware linter that focuses on your style")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#72189: [PATCH 0/7] Update and unbundle vale - part II
  2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
                   ` (7 preceding siblings ...)
  2024-07-19 19:57 ` [bug#72189] [PATCH 7/7] gnu: vale: Update to 3.4.2 Sharlatan Hellseher
@ 2024-07-22 22:31 ` Sharlatan Hellseher
  8 siblings, 0 replies; 10+ messages in thread
From: Sharlatan Hellseher @ 2024-07-22 22:31 UTC (permalink / raw)
  To: 72189-done

[-- Attachment #1: Type: text/plain, Size: 45 bytes --]


Pushed as ec23b6ec04..31fed85aa8 to master.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-07-22 22:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19 15:52 [bug#72189] [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher
2024-07-19 19:56 ` bug#72191: " Sharlatan Hellseher
2024-07-19 19:57 ` [bug#72189] [PATCH 1/7] gnu: Add go-github-com-niklasfasching-go-org Sharlatan Hellseher
2024-07-19 19:57 ` [bug#72189] [PATCH 2/7] gnu: Add go-github-com-xi2-xz Sharlatan Hellseher
2024-07-19 19:57 ` [bug#72189] [PATCH 3/7] gnu: Add go-github-com-mholt-archiver-v3 Sharlatan Hellseher
2024-07-19 19:57 ` [bug#72189] [PATCH 4/7] gnu: go-github-com-jdkato-twine: Enable tests Sharlatan Hellseher
2024-07-19 19:57 ` [bug#72189] [PATCH 5/7] gnu: go-github-com-spf13-viper: Disable tests Sharlatan Hellseher
2024-07-19 19:57 ` [bug#72189] [PATCH 6/7] gnu: go-github-com-mitchellh-mapstructure: Update to 1.5.0 Sharlatan Hellseher
2024-07-19 19:57 ` [bug#72189] [PATCH 7/7] gnu: vale: Update to 3.4.2 Sharlatan Hellseher
2024-07-22 22:31 ` bug#72189: [PATCH 0/7] Update and unbundle vale - part II Sharlatan Hellseher

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).