unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: Leo Famulari <leo@famulari.name>
Cc: guix-devel@gnu.org
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	[thread overview]
Message-ID: <87bmmzh1qu.fsf@elephly.net> (raw)
In-Reply-To: <87d17fh5b6.fsf@elephly.net>


Ricardo Wurmus <rekado@elephly.net> 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	other threads:[~2017-08-28 20:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 18:51 [go-build-system] How to access properties or keys of a package on the build side? Leo Famulari
2017-08-28 19:15 ` Ricardo Wurmus
2017-08-28 20:32   ` Ricardo Wurmus [this message]
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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmmzh1qu.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=guix-devel@gnu.org \
    --cc=leo@famulari.name \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).