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 22:32:41 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Ricardo Wurmus <address@hidden> writes:

> 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.

Here an example:

--8<---------------cut here---------------start------------->8---
(define (assoc-args-ref pkg key)
  "Return the value associated with KEY in the arguments of package PKG,
or #F if there is no such key."
  (let ((ref (find-tail (cut eq? <> key)
                        (package-arguments pkg))))
    (and=> ref second)))

(assoc-args-ref golang-github-com-audriusbutkevicius-go-nat-pmp
                #:import-path)

=> "github.com/AudriusButkevicius/go-nat-pmp"
--8<---------------cut here---------------end--------------->8---


-- 
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]