diff options
author | Sharlatan Hellseher <sharlatanus@gmail.com> | 2024-09-16 10:46:00 +0100 |
---|---|---|
committer | Sharlatan Hellseher <sharlatanus@gmail.com> | 2024-11-09 21:33:50 +0000 |
commit | 45f74470378daca81d007fc6726053290e2e1ac2 (patch) | |
tree | b67763cd788d85e0296c97b0a89f4381c254c77d | |
parent | 68fdb70d2dd1eece1fa813c2dee29e596926cd76 (diff) | |
download | guix-45f74470378daca81d007fc6726053290e2e1ac2.tar.gz guix-45f74470378daca81d007fc6726053290e2e1ac2.zip |
gnu: go-github-com-prometheus-common-sigv4: Update to 0.1.0, fix build.
Fix the build as seen in <https://ci.guix.gnu.org/build/5804380/log/raw>.
* gnu/packages/prometheus.scm (go-github-com-prometheus-common-sigv4): Update to 0.1.0.
[source]: Remove all submodules and keep the sources just for
<github.com/prometheus/common/sigv4>.
[origin]: Apply new style for "go-version->git-ref" using <#:subdir> key
parameter.
[arguments]: <#:phases>: Remove 'override-prometheus-common; add
'fix-embed-files.
Change-Id: I69a37690baafbfca1a2e33ebdea957456a96b0e8
-rw-r--r-- | gnu/packages/prometheus.scm | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/gnu/packages/prometheus.scm b/gnu/packages/prometheus.scm index 9786cf7007..533a922d0b 100644 --- a/gnu/packages/prometheus.scm +++ b/gnu/packages/prometheus.scm @@ -351,16 +351,39 @@ metrics.") (define-public go-github-com-prometheus-common-sigv4 (package (name "go-github-com-prometheus-common-sigv4") - (version "0.55.0") + (version "0.1.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/prometheus/common") - (commit (string-append "v" version)))) + (commit (go-version->git-ref version + #:subdir "sigv4")))) (file-name (git-file-name name version)) (sha256 - (base32 "0bsbxil7qz8rhckhv0844nmn38g7i7347cjv5m6na47hbdpi0rqh")))) + (base32 "08sdhxryl1jpy829qki8k2jy773xhrbr9wsk997pxhbbvl634gvb")) + (modules '((guix build utils) + (ice-9 ftw) + (srfi srfi-26))) + (snippet + #~(begin + ;; XXX: 'delete-all-but' is copied from the turbovnc package. + ;; Consider to implement it as re-usable procedure in + ;; guix/build/utils or guix/build-system/go. + (define (delete-all-but directory . preserve) + (define (directory? x) + (and=> (stat x #f) + (compose (cut eq? 'directory <>) stat:type))) + (with-directory-excursion directory + (let* ((pred + (negate (cut member <> (append '("." "..") preserve)))) + (items (scandir "." pred))) + (for-each (lambda (item) + (if (directory? item) + (delete-file-recursively item) + (delete-file item))) + items)))) + (delete-all-but "." "sigv4"))))) (build-system go-build-system) (arguments (list @@ -368,9 +391,24 @@ metrics.") #:unpack-path "github.com/prometheus/common" #:phases #~(modify-phases %standard-phases - (add-before 'unpack 'override-prometheus-common + ;; TODO: Implement it in go-build-system. + ;; + ;; This happens due to Golang can't determine the valid directory of + ;; 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-after 'unpack 'fix-embed-files (lambda _ - (delete-file-recursively "src/github.com/prometheus/common")))))) + (for-each (lambda (file) + (let ((file-store-path (readlink file))) + (delete-file file) + (copy-recursively file-store-path file))) + (find-files "src" ".*(editions_defaults.binpb)$"))))))) (native-inputs (list go-github-com-stretchr-testify)) (propagated-inputs |