unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Deck Pickard <deck.r.pickard@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] Core sanity and taking build options from environment.
Date: Fri, 28 Nov 2014 22:52:48 +0100	[thread overview]
Message-ID: <87vblzyoun.fsf@inria.fr> (raw)
In-Reply-To: CAJ41eezNiGrwADtd_+fS76m2rQivqwuTz2B2if1RYLt+YLRdtg@mail.gmail.com

Deck Pickard <deck.r.pickard@gmail.com> skribis:

> From 3693753aefc27b5a68a2b762feeebc41320e79ef Mon Sep 17 00:00:00 2001
> From: nebuli <nebu@kipple>
> 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 <nebu@kipple>
> Date: Thu, 27 Nov 2014 23:36:29 +0100
> Subject: [PATCH 2/2] guix: scripts: Add handling of options from GUIX_BUILD
>  environmental variable.

[...]

> --- a/guix/scripts/build.scm
> +++ b/guix/scripts/build.scm
> @@ -401,7 +401,13 @@ arguments with packages that use the specified source."
>  (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:

  • What about $GUIX_BUILD_OPTIONS?  (grep uses $GREP_OPTIONS, for
    reference.)

  • What about factorizing the above ‘args-from-env’ 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).

  • I would leave out the second argument to ‘args-from-env’.  I don’t
    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 form
> +of a list of strings ('char-set:graphic' tokens) suitable for consumption 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 “Invoking guix build”?

WDYT?  Could you send an updated patch?

Thank you,
Ludo’.

  reply	other threads:[~2014-11-28 21:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJ41eezW0KRVu6TBE0UeUVnNgqFSxgwML5p+FDd5h_bH3N_ghg@mail.gmail.com>
2014-11-27 23:13 ` [PATCH] Core sanity and taking build options from environment Deck Pickard
2014-11-28 21:52   ` Ludovic Courtès [this message]
2014-11-28 22:14     ` Andreas Enge
2014-11-30 17:17     ` Deck Pickard
2014-11-30 17:55       ` Ludovic Courtès

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=87vblzyoun.fsf@inria.fr \
    --to=ludo@gnu.org \
    --cc=deck.r.pickard@gmail.com \
    --cc=guix-devel@gnu.org \
    /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).