From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] Core sanity and taking build options from environment. Date: Fri, 28 Nov 2014 22:52:48 +0100 Message-ID: <87vblzyoun.fsf@inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuTTJ-0002jq-Fq for guix-devel@gnu.org; Fri, 28 Nov 2014 16:53:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XuTTA-0003va-EK for guix-devel@gnu.org; Fri, 28 Nov 2014 16:53:01 -0500 Received: from hera.aquilenet.fr ([2a01:474::1]:43103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuTT9-0003vS-W9 for guix-devel@gnu.org; Fri, 28 Nov 2014 16:52:52 -0500 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Deck Pickard Cc: guix-devel@gnu.org Deck Pickard skribis: > From 3693753aefc27b5a68a2b762feeebc41320e79ef Mon Sep 17 00:00:00 2001 > From: nebuli > Date: Wed, 26 Nov 2014 19:51:37 +0100 > Subject: [PATCH 1/2] guix: Default to daemon's default --cores setting of= 1. I think most of the time one would prefer to use all the available cores when building. WDYT? > From fa8738ff2cf48886c9ef8fbacfa806f547f3c3c8 Mon Sep 17 00:00:00 2001 > From: nebuli > Date: Thu, 27 Nov 2014 23:36:29 +0100 > Subject: [PATCH 2/2] guix: scripts: Add handling of options from GUIX_BUI= LD > environmental variable. [...] > --- a/guix/scripts/build.scm > +++ b/guix/scripts/build.scm > @@ -401,7 +401,13 @@ arguments with packages that use the specified sourc= e." > (define (guix-build . args) > (define (parse-options) > ;; Return the alist of option values. > - (args-fold* args %options > + (args-fold* (append args > + (args-from-env "GUIX_BUILD" > + (lambda (var opts) > + (format (current-error-port) > + (_ "guix build: ~a: ~a~= %") > + var opts)))) > + %options This sounds like a good idea. Some suggestions that come to mind: =E2=80=A2 What about $GUIX_BUILD_OPTIONS? (grep uses $GREP_OPTIONS, for reference.) =E2=80=A2 What about factorizing the above =E2=80=98args-from-env=E2=80= =99 call like this: (define (environment-build-options) "Return additional build options passed as environment variables." (args-from-env "GUIX_BUILD_OPTIONS")) This procedure would go in (guix ui). =E2=80=A2 I would leave out the second argument to =E2=80=98args-from-env= =E2=80=99. I don=E2=80=99t think it would be convenient to have that extra line printed every time. > +(define (args-from-env var . rest) > + "Retrieve value of environment variable denoted by string VAR in the f= orm > +of a list of strings ('char-set:graphic' tokens) suitable for consumptio= n by > +the fold-arg family of functions. If VAR is defined, call car of a non-= null s/fold-arg family of functions/'args-fold'/ > +REST on the VAR and result, otherwise return an empty list." > + (let ((env-opts (getenv variable))) > + (if env-opts > + (let ((opts (string-tokenize env-opts char-set:graphic))) > + (and (not (null? rest)) > + (apply (car rest) > + (list variable opts))) > + opts) > + '()))) Please write it like this: (define (arguments-from-environment-variable variable) (let ((env (getenv variable))) ...)) Could you also update guix.texi, near the end of =E2=80=9CInvoking guix bui= ld=E2=80=9D? WDYT? Could you send an updated patch? Thank you, Ludo=E2=80=99.