[PATCH 0/6] gnu: Add go-github-com-tdewolff-hasher.

  • Done
  • quality assurance status badge
Details
3 participants
  • Hilton Chain
  • Ludovic Courtès
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Hilton Chain
Severity
normal
H
H
Hilton Chain wrote on 10 Aug 2023 13:40
(address . guix-patches@gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
cover.1691666406.git.hako@ultrarare.space
Hello Guix!

I learned about there're pre-generated files in
go-github-com-tdewolff-parse-v2 and go-github-com-tdewolff-minify-v2 when
looking through #61946.

So this patchset adds go-github-com-tdewolff-hasher, which is the generator,
and uses it to generate relevant files for those two packages.

Thanks

Hilton Chain (6):
gnu: Add go-github-com-dgryski-go-metro.
gnu: Add go-github-com-dgryski-go-mph.
gnu: Add go-github-com-cespare-mph.
gnu: Add go-github-com-tdewolff-hasher.
gnu: go-github-com-tdewolff-parse-v2: Regenerate hash.
gnu: go-github-com-tdewolff-minify-v2: Regenerate hash.

gnu/packages/golang.scm | 131 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 127 insertions(+), 4 deletions(-)


base-commit: 90e34d25d5e7c14b7f3293a78f3cdad676c0d035
--
2.41.0
H
H
Hilton Chain wrote on 10 Aug 2023 13:43
[PATCH 1/6] gnu: Add go-github-com-dgryski-go-metro.
(address . 65204@debbugs.gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
ee3482b0b96a72f766cf141fce1eb87faeb75253.1691666406.git.hako@ultrarare.space
* gnu/packages/golang.scm (go-github-com-dgryski-go-metro): New variable.
---
gnu/packages/golang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index ea6aadbe80..88c77db5f8 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -5246,6 +5246,30 @@ (define-public go-github-com-ayufan-golang-kardianos-service
SysVinit, and more.")
(license license:zlib))))
+(define-public go-github-com-dgryski-go-metro
+ (package
+ (name "go-github-com-dgryski-go-metro")
+ (version "0.0.0-20211217172704-adc40b04c140")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dgryski/go-metro")
+ (commit (go-version->git-ref version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "16y5vc5qf7aipi8basqza8l939hlmp7wqsv4y6gsqac3sp9ziqyj"))))
+ (build-system go-build-system)
+ (arguments
+ (list #:import-path "github.com/dgryski/go-metro"))
+ (home-page "https://github.com/dgryski/go-metro")
+ (synopsis "Go translation of MetroHash")
+ (description
+ "This package provides a Go translation of the
+@url{https://github.com/jandrewrogers/MetroHash, reference C++ code for
+MetroHash}, a high quality, high performance hash algorithm.")
+ (license license:expat)))
+
(define-public go-github-com-docker-distribution
(let ((commit "325b0804fef3a66309d962357aac3c2ce3f4d329")
(revision "0"))
--
2.41.0
H
H
Hilton Chain wrote on 10 Aug 2023 13:43
[PATCH 2/6] gnu: Add go-github-com-dgryski-go-mph.
(address . 65204@debbugs.gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
ce4f49c456d45dedff9861a1ed0e18f52486f6e0.1691666406.git.hako@ultrarare.space
* gnu/packages/golang.scm (go-github-com-dgryski-go-mph): New variable.
---
gnu/packages/golang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 88c77db5f8..016695239e 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -5270,6 +5270,30 @@ (define-public go-github-com-dgryski-go-metro
MetroHash}, a high quality, high performance hash algorithm.")
(license license:expat)))
+(define-public go-github-com-dgryski-go-mph
+ (package
+ (name "go-github-com-dgryski-go-mph")
+ (version "0.0.0-20211217222804-81a8625fb7ed")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dgryski/go-mph")
+ (commit (go-version->git-ref version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "10q8l4jdzqf54bnnxka2jk6qzayri3ijv51knn1n0iimfric8w9g"))))
+ (build-system go-build-system)
+ (arguments
+ (list #:import-path "github.com/dgryski/go-mph"))
+ (propagated-inputs
+ (list go-github-com-dgryski-go-metro))
+ (home-page "https://github.com/dgryski/go-mph")
+ (synopsis "Go minimal perfect hash function")
+ (description
+ "This package implements a hash/displace minimal perfect hash function.")
+ (license license:expat)))
+
(define-public go-github-com-docker-distribution
(let ((commit "325b0804fef3a66309d962357aac3c2ce3f4d329")
(revision "0"))
--
2.41.0
H
H
Hilton Chain wrote on 10 Aug 2023 13:43
[PATCH 3/6] gnu: Add go-github-com-cespare-mph.
(address . 65204@debbugs.gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
31b5c43166205aa47e587abcc0ebd0a091d03dc2.1691666406.git.hako@ultrarare.space
* gnu/packages/golang.scm (go-github-com-cespare-mph): New variable.
---
gnu/packages/golang.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (36 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 016695239e..b84e4c7ba7 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -7324,6 +7324,29 @@ (define-public go-github-com-cention-sany-utf7
encoding in Go.")
(license license:bsd-3)))
+(define-public go-github-com-cespare-mph
+ (package
+ (name "go-github-com-cespare-mph")
+ (version "0.1.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cespare/mph")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0mvd6bkvf3i3555kqkkr3k9jd4c25scjq4xad35sxpny8f72nbg1"))))
+ (build-system go-build-system)
+ (arguments
+ (list #:import-path "github.com/cespare/mph"))
+ (home-page "https://github.com/cespare/mph")
+ (synopsis "Minimal perfect hashing in Go")
+ (description
+ "@code{mph} is a Go package that implements a minimal perfect hash table
+over strings.")
+ (license license:expat)))
+
(define-public go-github-com-gdamore-tcell
(let ((commit "aaadc574a6ed8dc3abe56036ca130dcee1ee6b6e")
(version "1.1.2")
--
2.41.0
H
H
Hilton Chain wrote on 10 Aug 2023 13:43
[PATCH 4/6] gnu: Add go-github-com-tdewolff-hasher.
(address . 65204@debbugs.gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
be799a1fa2dcd7d4fe109618193bd880c5ff8800.1691666406.git.hako@ultrarare.space
* gnu/packages/golang.scm (go-github-com-tdewolff-hasher): New variable.
---
gnu/packages/golang.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index b84e4c7ba7..21562a135f 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -3403,6 +3403,32 @@ (define-public go-github-com-saracen-walker
(description "The @code{walker} function is a faster, parallel version, of
@code{filepath.Walk}")))
+(define-public go-github-com-tdewolff-hasher
+ (package
+ (name "go-github-com-tdewolff-hasher")
+ (version "0.0.0-20210521220142-bc97f602bca2")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tdewolff/hasher")
+ (commit (go-version->git-ref version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "12dmxpmdy2z7c2z7qv2mv2aq4hyvjncb6fzr0ymg3y5bfjvl4dcw"))))
+ (build-system go-build-system)
+ (arguments
+ (list #:import-path "github.com/tdewolff/hasher"))
+ (native-inputs
+ (list go-github-com-cespare-mph
+ go-github-com-dgryski-go-mph))
+ (home-page "https://github.com/tdewolff/hasher")
+ (synopsis "Go known-keys fast-lookup map generator")
+ (description
+ "Hasher is a tool to automate the creation of methods and tables for a
+@code{string} to @code{uint32} mapper.")
+ (license license:bsd-3)))
+
(define-public go-github-com-tdewolff-minify-v2
(package
(name "go-github-com-tdewolff-minify-v2")
--
2.41.0
H
H
Hilton Chain wrote on 10 Aug 2023 13:43
[PATCH 5/6] gnu: go-github-com-tdewolff-parse-v2: Regenerate hash.
(address . 65204@debbugs.gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
5fc910a54b6027a6cdbe7fe2fabf476b73861489.1691666406.git.hako@ultrarare.space
* gnu/packages/golang.scm (go-github-com-tdewolff-parse-v2)[#:phases]: Add
phase 'regenerate-hash.
[native-inputs]: Add go-github-com-tdewolff-hasher.
---
gnu/packages/golang.scm | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 21562a135f..4360fccc0a 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -3471,9 +3471,22 @@ (define-public go-github-com-tdewolff-parse-v2
"1dqki9ima079k9a3l72igmx5dml8qsl9z8rzw8a433f4gjhlv320"))))
(build-system go-build-system)
(arguments
- (list #:import-path "github.com/tdewolff/parse/v2"))
+ (list #:import-path "github.com/tdewolff/parse/v2"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'regenerate-hash
+ (lambda* (#:key import-path #:allow-other-keys)
+ (for-each
+ (lambda (dir)
+ (with-directory-excursion
+ (format #f "src/~a/~a" import-path dir)
+ (make-file-writable "hash.go")
+ (format #t "Generating `hash.go' for ~a...~%" dir)
+ (invoke "go" "generate")))
+ '("css" "html")))))))
(native-inputs
- (list go-github-com-tdewolff-test))
+ (list go-github-com-tdewolff-hasher
+ go-github-com-tdewolff-test))
(home-page "https://github.com/tdewolff/parse")
(synopsis "Go parsers for web formats")
(description
--
2.41.0
H
H
Hilton Chain wrote on 10 Aug 2023 13:43
[PATCH 6/6] gnu: go-github-com-tdewolff-minify-v2: Regenerate hash.
(address . 65204@debbugs.gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
f2db10a94e7294f8c3c6ecd0022fc01b0edf962c.1691666406.git.hako@ultrarare.space
* gnu/packages/golang.scm (go-github-com-tdewolff-minify-v2)[#:phases]: Add
phase 'regenerate-hash.
[native-inputs]: Add go-github-com-tdewolff-hasher.
---
gnu/packages/golang.scm | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 4360fccc0a..0cac1e0149 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -3444,11 +3444,24 @@ (define-public go-github-com-tdewolff-minify-v2
"0h006wpfkl0ls0skqxblwcanrhmphgq5q0ii26l2ayh7s99cgmy3"))))
(build-system go-build-system)
(arguments
- (list #:import-path "github.com/tdewolff/minify/v2"))
+ (list #:import-path "github.com/tdewolff/minify/v2"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'regenerate-hash
+ (lambda* (#:key import-path #:allow-other-keys)
+ (for-each
+ (lambda (dir)
+ (with-directory-excursion
+ (format #f "src/~a/~a" import-path dir)
+ (make-file-writable "hash.go")
+ (format #t "Generating `hash.go' for ~a...~%" dir)
+ (invoke "go" "generate")))
+ '("css" "html" "svg")))))))
(propagated-inputs
(list go-github-com-tdewolff-parse-v2))
(native-inputs
- (list go-github-com-tdewolff-test))
+ (list go-github-com-tdewolff-hasher
+ go-github-com-tdewolff-test))
(home-page "https://go.tacodewolff.nl/minify")
(synopsis "Go minifiers for web formats")
(description
--
2.41.0
L
L
Ludovic Courtès wrote on 21 Aug 2023 16:03
Re: bug#65204: [PATCH 0/6] gnu: Add go-github-com-tdewolff-hasher.
(name . Hilton Chain)(address . hako@ultrarare.space)(address . 65204@debbugs.gnu.org)
87r0nwa3ww.fsf_-_@gnu.org
Hi,

Hilton Chain <hako@ultrarare.space> skribis:

Toggle quote (4 lines)
> * gnu/packages/golang.scm (go-github-com-tdewolff-parse-v2)[#:phases]: Add
> phase 'regenerate-hash.
> [native-inputs]: Add go-github-com-tdewolff-hasher.

[...]

Toggle quote (13 lines)
> + (list #:import-path "github.com/tdewolff/parse/v2"
> + #:phases
> + #~(modify-phases %standard-phases
> + (add-after 'unpack 'regenerate-hash
> + (lambda* (#:key import-path #:allow-other-keys)
> + (for-each
> + (lambda (dir)
> + (with-directory-excursion
> + (format #f "src/~a/~a" import-path dir)
> + (make-file-writable "hash.go")
> + (format #t "Generating `hash.go' for ~a...~%" dir)
> + (invoke "go" "generate")))

Maybe you can remove ‘hash.go’ in a snippet, for good measure, and add a
comment clarifying that it’s a generated file.

Otherwise the patch series LGTM!

Ludo’.
H
H
Hilton Chain wrote on 21 Aug 2023 17:20
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 65204@debbugs.gnu.org)
877cpozakf.wl-hako@ultrarare.space
Hi Ludo,
On Mon, 21 Aug 2023 22:03:27 +0800,
Ludovic Courtès wrote:
Toggle quote (24 lines)
>
> > * gnu/packages/golang.scm (go-github-com-tdewolff-parse-v2)[#:phases]: Add
> > phase 'regenerate-hash.
> > [native-inputs]: Add go-github-com-tdewolff-hasher.
>
> [...]
>
> > + (list #:import-path "github.com/tdewolff/parse/v2"
> > + #:phases
> > + #~(modify-phases %standard-phases
> > + (add-after 'unpack 'regenerate-hash
> > + (lambda* (#:key import-path #:allow-other-keys)
> > + (for-each
> > + (lambda (dir)
> > + (with-directory-excursion
> > + (format #f "src/~a/~a" import-path dir)
> > + (make-file-writable "hash.go")
> > + (format #t "Generating `hash.go' for ~a...~%" dir)
> > + (invoke "go" "generate")))
>
> Maybe you can remove ‘hash.go’ in a snippet, for good measure, and add a
> comment clarifying that it’s a generated file.
>
> Otherwise the patch series LGTM!
Source data to generate the hash is also written in `hash.go', so it's
not possible to remove it.
Thanks
M
M
Maxim Cournoyer wrote on 6 Sep 2023 07:28
(name . Hilton Chain)(address . hako@ultrarare.space)(address . 65204-done@debbugs.gnu.org)
87o7if7tuw.fsf@gmail.com
Hi,

Hilton Chain <hako@ultrarare.space> writes:

Toggle quote (9 lines)
> Hello Guix!
>
> I learned about there're pre-generated files in
> go-github-com-tdewolff-parse-v2 and go-github-com-tdewolff-minify-v2 when
> looking through #61946.
>
> So this patchset adds go-github-com-tdewolff-hasher, which is the generator,
> and uses it to generate relevant files for those two packages.

Great! Installed.

--
Thanks,
Maxim
Closed
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 65204
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