1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: nncp: Update to 8.11.0.

* gnu/packages/uucp.scm (nncp): Update to 8.11.0.
[source] <snippet>: Remove the most of available sources from "vendor".
Tweak source path to satisfy go.mod import path in go-build-system.
[build-system]: Swap to go-build-system.
[arguments] <phases>: Use default 'configure and 'check; use custom
'build and 'install. Remove 'setup-go-environment, 'go-unpack; add
'fix-paths.
[inputs]: Add go-github-com-arceliar-ironwood,
go-github-com-fsnotify-fsnotify, go-github-com-gologme-log,
go-github-com-yggdrasil-network-yggdrasil-go, go-golang-org-x-sys,
and go-gvisor-dev-gvisor.
[native-inputs]: Remove go.

Co-authored-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
Change-Id: Iacc752c8b10c74db0efafedeb774f51db01af87c
This commit is contained in:
Sharlatan Hellseher
2025-02-16 21:35:05 +00:00
parent 9cb5e26488
commit 0c88ec2560

View File

@@ -1,6 +1,8 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
;;; Copyright © 2025 Sharlatan Hellseher <sharlatanus@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -28,6 +30,7 @@
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix build-system gnu)
#:use-module (guix build-system go))
@@ -67,7 +70,7 @@ between computers.")
(define-public nncp
(package
(name "nncp")
(version "7.5.0")
(version "8.11.0")
(source
(origin
(method url-fetch)
@@ -75,89 +78,88 @@ between computers.")
version ".tar.xz"))
(sha256
(base32
"1r1zgj7gpkdmdm3wf31m0xi8y313kzd4dbyp4r4y8khnp32jvn8l"))
"1wmg6k1nprk9b7vnnly3m6xxyma2l0xamnrq3xwahjhqv6y18hgc"))
(modules '((ice-9 ftw)
(guix build utils)))
(snippet
'(begin
;; Unbundle dependencies.
;; TODO: go.cypherpunks.ru was down at the time of
;; packaging. Unbundle go.cypherpunks dependencies as well once it
;; comes back online.
(for-each (lambda (file)
(unless (member file (list "." ".." "go.cypherpunks.ru"))
(delete-file-recursively (string-append "src/vendor/" file))))
(scandir "src/vendor"))
;; Delete built documentation.
(delete-file "doc/nncp.info")
#t))))
(build-system gnu-build-system)
#~(begin
;; TODO: Find out how to obtain sources for go.cypherpunks.ru and
;; go.cypherpunks.su.
(with-directory-excursion "src/vendor"
(for-each delete-file-recursively
(list "github.com"
"go.uber.org"
"golang.org"
"gvisor.dev"
"lukechampine.com")))
;; The hack to trick go-build-system.
(rename-file "src" "v8")))))
(build-system go-build-system)
(arguments
`(#:modules ((guix build gnu-build-system)
((guix build go-build-system) #:prefix go:)
(guix build utils))
#:imported-modules ,%go-build-system-modules
#:phases
(modify-phases %standard-phases
(add-before 'unpack 'setup-go-environment
(assoc-ref go:%standard-phases 'setup-go-environment))
(add-after 'unpack 'go-unpack
(lambda* (#:key source #:allow-other-keys)
;; Copy source to GOPATH.
(copy-recursively "src" "../src/go.cypherpunks.ru/nncp/v7")
;; Move bundled dependencies to GOPATH.
(for-each (lambda (dependency)
(rename-file (string-append "src/vendor/go.cypherpunks.ru/"
dependency)
(string-append "../src/go.cypherpunks.ru/"
dependency)))
(list "balloon" "recfile"))
;; Delete empty bundled dependencies directory.
(delete-file-recursively "src/vendor")))
(replace 'configure
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(setenv "GO_LDFLAGS" "-trimpath")
;; Set configuration path.
(setenv "CFGPATH" "/etc/nncp.hjson")
;; Set output directories.
(setenv "BINDIR" (string-append out "/bin"))
(setenv "INFODIR" (string-append out "/share/info"))
(setenv "DOCDIR" (string-append out "/share/doc/nncp")))
;; Set absolute store paths to sh and cat.
(substitute* (list "src/pipe.go" "src/toss_test.go")
(("/bin/sh") (which "sh")))
(substitute* "src/toss_test.go"
(("; cat") (string-append "; " (which "cat"))))
;; Remove module flags.
(substitute* (list "bin/default.do" "bin/hjson-cli.do" "test.do")
((" -mod=vendor") "")
((" -m") ""))
;; Use the correct module path. `go list` does not report the
;; correct module path since we have moved the source files.
(substitute* "bin/default.do"
(("^mod=[^\n]*" all) "mod=go.cypherpunks.ru/nncp/v7"))
;; Disable timeout in tests. Tests can take longer than the
;; default timeout on spinning disks.
(substitute* "test.do"
(("test") "test -timeout 0"))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "contrib/do" "-c" "test")))))))
(list
#:install-source? #f
#:import-path "go.cypherpunks.su/nncp/v8"
#:unpack-path "go.cypherpunks.su/nncp"
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-paths
(lambda* (#:key import-path #:allow-other-keys)
(with-directory-excursion (string-append "src/" import-path)
(substitute* (list "pipe.go" "toss_test.go")
(("/bin/sh") (which "sh"))
(("; cat") (format #f "; ~a" (which "cat")))))))
(replace 'build
(lambda arguments
(let ((path-prefix "go.cypherpunks.su/nncp/v8/cmd/"))
(for-each
(lambda (cmd)
(apply (assoc-ref %standard-phases 'build)
`(,@arguments #:import-path
,(string-append path-prefix cmd))))
(list "nncp-ack"
"nncp-bundle"
"nncp-call"
"nncp-caller"
"nncp-cfgdir"
"nncp-cfgenc"
"nncp-cfgmin"
"nncp-cfgnew"
"nncp-check"
"nncp-cronexpr"
"nncp-daemon"
"nncp-exec"
"nncp-file"
"nncp-freq"
"nncp-hash"
"nncp-log"
"nncp-pkt"
"nncp-reass"
"nncp-rm"
"nncp-stat"
"nncp-toss"
"nncp-trns"
"nncp-xfer"))))))))
(inputs
(list go-github-com-davecgh-go-xdr
(list go-github-com-arceliar-ironwood
go-github-com-davecgh-go-xdr
go-github-com-dustin-go-humanize
go-github-com-flynn-noise
go-github-com-fsnotify-fsnotify
go-github-com-gologme-log
go-github-com-gorhill-cronexpr
go-github-com-hjson-hjson-go-v4
go-github-com-klauspost-compress
go-github-com-yggdrasil-network-yggdrasil-go
;; go-go-cypherpunks-ru-balloon ; sourcing from vendor
;; go-go-cypherpunks-su-recfile-v2 ; sourcing from vendor
go-golang-org-x-crypto
go-golang-org-x-net
go-golang-org-x-sys
go-golang-org-x-term
go-gvisor-dev-gvisor
go-lukechampine-com-blake3))
(native-inputs
(list go texinfo))
(list texinfo))
(home-page "http://www.nncpgo.org/")
(synopsis "Store and forward utilities")
(description "NNCP (Node to Node copy) is a collection of utilities