sharlatan pushed a commit to branch go-team
in repository guix.
commit 0006ae3f09ded76122afa972a3018836d3e5ba62
Author: Sharlatan Hellseher <[email protected]>
AuthorDate: Thu Feb 20 13:50:10 2025 +0000
gnu: go-github-com-libp2p-go-libp2p-asn-util: Generate network list.
* gnu/packages/golang-web.scm (go-github-com-libp2p-go-libp2p-asn-util)
[source] <snippet>: Delete generated network list file.
[arguments] <phases>: Add 'generate-sorted-network-list.
[native-inputs]: Add specification-ip2asn-v6.
Change-Id: Iab9e3c4329fd9a894bafab98d2f274d7f9bb0dad
---
gnu/packages/golang-web.scm | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/golang-web.scm b/gnu/packages/golang-web.scm
index 12fd1fe92c..ab908122b6 100644
--- a/gnu/packages/golang-web.scm
+++ b/gnu/packages/golang-web.scm
@@ -73,6 +73,7 @@
#:use-module (gnu packages golang-xyz)
#:use-module (gnu packages ipfs)
#:use-module (gnu packages prometheus)
+ #:use-module (gnu packages specifications)
#:use-module (gnu packages tls)
#:use-module (gnu packages web))
@@ -5030,13 +5031,29 @@ faster (and only does simple bandwidth metrics).")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "1c94sq43bl1kp04lllcfrfyiy5z3zcfz0s65sm1vgb2s40zrwpr7"))))
+ (base32 "1c94sq43bl1kp04lllcfrfyiy5z3zcfz0s65sm1vgb2s40zrwpr7"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Delete generated binary file.
+ (delete-file "sorted-network-list.bin")))))
(build-system go-build-system)
(arguments
(list
- #:import-path "github.com/libp2p/go-libp2p-asn-util"))
+ #:import-path "github.com/libp2p/go-libp2p-asn-util"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'generate-sorted-network-list
+ (lambda* (#:key import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ (setenv "ASN_IPV6_FILE"
+ (string-append
+ #$(this-package-native-input
"specification-ip2asn-v6")
+ "/share/data/ip2asn-v6.tsv"))
+ (invoke "go" "run" "./generate/")))))))
(native-inputs
- (list go-github-com-stretchr-testify))
+ (list go-github-com-stretchr-testify
+ specification-ip2asn-v6))
(propagated-inputs
(list go-golang-org-x-exp))
(home-page "https://github.com/libp2p/go-libp2p-asn-util")