From: Leo Famulari <leo@famulari.name>
To: guix-devel@gnu.org
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 [thread overview]
Message-ID: <20170828185144.GA24652@jasmine.lan> (raw)
[-- Attachment #1: Type: text/plain, Size: 2467 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2017-08-28 18:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-28 18:51 Leo Famulari [this message]
2017-08-28 19:15 ` [go-build-system] How to access properties or keys of a package on the build side? Ricardo Wurmus
2017-08-28 20:32 ` Ricardo Wurmus
2017-08-31 1:01 ` Leo Famulari
2017-09-01 17:15 ` Leo Famulari
2017-09-01 20:58 ` Ricardo Wurmus
-- strict thread matches above, loose matches on Subject: below --
2017-08-29 12:54 Frederick Muriithi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170828185144.GA24652@jasmine.lan \
--to=leo@famulari.name \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.