diff options
Diffstat (limited to 'gnu/packages/prometheus.scm')
-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 |