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: Fri, 01 Sep 2017 22:58:30 +0200 Message-ID: <87pobaw2yx.fsf@elephly.net> References: <20170828185144.GA24652@jasmine.lan> <87d17fh5b6.fsf@elephly.net> <87bmmzh1qu.fsf@elephly.net> <20170901171557.GA24977@jasmine.lan> 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]:50003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnt1U-0005lm-D1 for guix-devel@gnu.org; Fri, 01 Sep 2017 16:58:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnt1R-0002XL-BB for guix-devel@gnu.org; Fri, 01 Sep 2017 16:58:40 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21144) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnt1R-0002Wi-4D for guix-devel@gnu.org; Fri, 01 Sep 2017 16:58:37 -0400 In-reply-to: <20170901171557.GA24977@jasmine.lan> 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 Leo Famulari writes: > On Mon, Aug 28, 2017 at 10:32:41PM +0200, Ricardo Wurmus wrote: >> >> 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--- > > I didn't get very far in this direction before deciding to try another > technique. But wouldn't this not work on the build side, since (guix > packages) is not available there? It would work because you’re executing this on the host side and paste the result into the S-expression that is the value of the “arguments” field. -- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net