Message ID | 5fc910a54b6027a6cdbe7fe2fabf476b73861489.1691666406.git.hako@ultrarare.space |
---|---|
State | New |
Headers | show |
Series | gnu: Add go-github-com-tdewolff-hasher. | expand |
Hi, Hilton Chain <hako@ultrarare.space> skribis: > * 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! Ludo’.
Hi Ludo, On Mon, 21 Aug 2023 22:03:27 +0800, Ludovic Courtès wrote: > > > * 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
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