gnu: go-github-com-prometheus-statsd-exporter: Fix build.

* gnu/packages/prometheus.scm (go-github-com-prometheus-statsd-exporter):
Fix build
[arguments]: <#:phases>: Rework 'copy-input-to-vendor-directory and
'remove-vendor-directory by consolidating and simplifying them into
'fix-embed-files.

Change-Id: I5c255ea17dc9926bf9e2ea9a0a0e662afe9c2e5d
This commit is contained in:
Sharlatan Hellseher 2024-09-13 23:27:36 +01:00
parent 449fa18bf6
commit 90a82e1624
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -516,30 +516,27 @@ (define-public go-github-com-prometheus-statsd-exporter
#:import-path "github.com/prometheus/statsd_exporter"
#:phases
#~(modify-phases %standard-phases
;; FIXME: pattern landing_page.css: cannot embed irregular file
;; landing_page.css
;; TODO: Implement it in go-build-system.
;;
;; 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:
;; the module of embed file which is symlinked during setup
;; environment phase, but easy resolved after coping file from the
;; store to the build directory of 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-prometheus-exporter-toolkit")
"/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")))))))
(add-before 'build 'fix-embed-files
(lambda _
(for-each (lambda (file)
(let ((file-store-path (readlink file)))
(delete-file file)
(copy-recursively file-store-path file)))
(find-files "src" (string-append
".*(editions_defaults.binpb"
"|landing_page.css"
"|landing_page.html)$"))))))))
(native-inputs
(list go-github-com-stvp-go-udp-testing))
(propagated-inputs