From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <87bmmzh1qu.fsf@elephly.net> References: <20170828185144.GA24652@jasmine.lan> <87d17fh5b6.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmQiK-0004Eq-Lg for guix-devel@gnu.org; Mon, 28 Aug 2017 16:32:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmQiG-0001g0-P1 for guix-devel@gnu.org; Mon, 28 Aug 2017 16:32:52 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dmQiG-0001fa-Hz for guix-devel@gnu.org; Mon, 28 Aug 2017 16:32:48 -0400 In-reply-to: <87d17fh5b6.fsf@elephly.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Leo Famulari Cc: guix-devel@gnu.org Ricardo Wurmus 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