sharlatan pushed a commit to branch go-team
in repository guix.

commit 866bc948e3d1e52a23bfd261648d3978b1490631
Author: Sharlatan Hellseher <[email protected]>
AuthorDate: Sun Sep 15 11:02:48 2024 +0100

    gnu: go-github-com-go-openapi-loads: Simplify phases.
    
    * gnu/packages/golang-web.scm (go-github-com-go-openapi-loads)
    [arguments]: <#phases>: Swap 'copy-input-to-vendor-directory and
    'remove-vendor-directory to generalized 'fix-embed-files phase.
    
    Change-Id: Id025bdf03b6c2795183d6f6d80d4689b653425d6
---
 gnu/packages/golang-web.scm | 36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/gnu/packages/golang-web.scm b/gnu/packages/golang-web.scm
index c7dcb232e1..9c5f1260cc 100644
--- a/gnu/packages/golang-web.scm
+++ b/gnu/packages/golang-web.scm
@@ -1550,35 +1550,25 @@ prototyped in 
@url{https://github.com/xeipuuv/gojsonreference}.";)
       #:import-path "github.com/go-openapi/loads"
       #:phases
       #~(modify-phases %standard-phases
-          ;; FIXME: pattern schemas/*.json: cannot embed irregular file
-          ;; schemas/jsonschema-draft-04.json
+          ;; 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-go-openapi-spec")
-                  "/src/github.com")
-                 "vendor/github.com")
-                (copy-recursively
-                 (string-append
-                  #$(this-package-input "go-github-com-go-openapi-analysis")
-                  "/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-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"
+                                    
"^(jsonschema-draft-04|schema)\\.json$")))))))
     (native-inputs
      (list go-github-com-stretchr-testify))
     (propagated-inputs

Reply via email to