[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[go-build-system] How to access properties or keys of a package on the b
From: |
Leo Famulari |
Subject: |
[go-build-system] How to access properties or keys of a package on the build side? |
Date: |
Mon, 28 Aug 2017 14:51:44 -0400 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
Recently I made some progress on finishing the prototype go-build-system
from Petter [0], and I need some advice.
AFAICT, building a Go program requires the program's Go dependencies to
have a particular filesystem layout, which corresponds to the way these
dependencies are imported by the program's code.
So, a Go build system needs to somehow create a symlink union of the
dependency graph, making the dependencies available at the correct paths
relative to the root of the build environment. AFAICT, we can't figure
these paths out programatically; they must be supplied by the packager
in advance, for example:
------
(arguments
`(#:import-path "github.com/AudriusButkevicius/go-nat-pmp"))
------
Petter's prototype creates the symlink union, but instead of using the
#:import-path key, it instead duplicates the import path while listing a
package's dependencies, like this:
------
(inputs
`(("github.com/AudriusButkevicius/go-nat-pmp"
,golang-github-com-audriusbutkevicius-go-nat-pmp)
------
... putting the import path in the car of the input, and using it as shown
below:
------
(define* (symlinking #:key inputs #:allow-other-keys)
(for-each (lambda (input)
(let ((import-path (car input))
(storepath (cdr input)))
; Don't deal with the compiler or source inputs
(if (and (not (string=? import-path "go"))
(not (string=? import-path "source")))
(begin
(mkdir-p (string-append
"src/"
(string-take import-path
(string-rindex import-path #\/))))
(let ((from (string-append storepath "/src/" import-path))
(to (string-append "src/" import-path)))
(if (file-exists? to) (delete-file-recursively to))
(symlink (string-append
storepath "/src/" import-path)
(string-append
"src/" import-path)))))))
inputs))
------
Are there any examples in the code base of accessing the inputs' keys? That
seems like a better solution to me, but I'm not sure how to achieve it.
[0]
https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00399.html
signature.asc
Description: PGP signature
- [go-build-system] How to access properties or keys of a package on the build side?,
Leo Famulari <=