From d580f6ae81bbb2b0dab347779cfcaf36069535e1 Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Fri, 13 Sep 2024 14:48:49 +0100 Subject: gnu: go-github-com-dgraph-io-badger: Fix build. * gnu/packages/golang-xyz.scm (go-github-com-dgraph-io-badger): Fix build. [arguments]: <#:phases>: Add 'fix-embed-files; remove 'disable-failing-tests in favor of "-skip" test option. Change-Id: Ib4d91509a0c6a83c8108a47ae2bd6254df53b430 --- gnu/packages/golang-xyz.scm | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm index e9c6001a10..d8767a9ba5 100644 --- a/gnu/packages/golang-xyz.scm +++ b/gnu/packages/golang-xyz.scm @@ -2077,6 +2077,25 @@ encoding/decoding. It has no dependencies.") #:import-path "github.com/dgraph-io/badger" #:phases #~(modify-phases %standard-phases + ;; 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: + ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454 + ;; - file: src/cmd/go/internal/load/pkg.go#L2059 + (add-after 'unpack '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)$"))))) (add-after 'unpack 'patch-failing-tests (lambda* (#:key unpack-path tests? #:allow-other-keys) (with-directory-excursion (string-append "src/" unpack-path) @@ -2087,18 +2106,14 @@ encoding/decoding. It has no dependencies.") ;; See: . (("\"testing\"") (string-append "\"testing\"\n\"fmt\"")) (("string") "fmt.Sprint"))))) - (add-after 'patch-failing-tests 'disable-failing-tests - (lambda* (#:key tests? import-path #:allow-other-keys) - (with-directory-excursion (string-append "src/" import-path) - (substitute* (find-files "." "\\_test.go$") - (("TestBuildKeyValueSizeHistogram") - "OffTestBuildKeyValueSizeHistogram"))))) ;; XXX: Replace when go-build-system supports nested path. (replace 'check (lambda* (#:key import-path tests? #:allow-other-keys) (when tests? (with-directory-excursion (string-append "src/" import-path) - (invoke "go" "test" "-v" "./...")))))))) + (invoke "go" "test" "-v" + "-skip" "TestBuildKeyValueSizeHistogram" + "./..." )))))))) (native-inputs (list go-github-com-stretchr-testify)) (propagated-inputs -- cgit v1.2.3