guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [go-build-system] How to access properties or keys of a package on t


From: Ricardo Wurmus
Subject: Re: [go-build-system] How to access properties or keys of a package on the build side?
Date: Mon, 28 Aug 2017 21:15:41 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Leo Famulari <address@hidden> writes:

> 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)
> ------
[…]
>
> 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.

Instead of recording this information in the input labels (which I
consider rather inelegant) you could put the key in the properties
field.  In the build phase of another package you can access it like
this:

   (arguments
     `(#:phases …
       (lambda _
         …
         ,(assoc-ref (package-properties the-package) 'the-key)
         …
         )…))

You could also access the arguments of another package with
“package-arguments”.  Using the “properties” field isn’t pretty because
it is a free form alist.

You can use “find-tail” to jump to the keyword in “arguments” and then
pick the following value.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]