Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] core: enhance printvars
Date: Tue, 31 Jan 2017 18:31:06 +0100	[thread overview]
Message-ID: <20170131173106.GA3534@free.fr> (raw)
In-Reply-To: <CAAXf6LUwymo-EZXVjeyjiuuaFnXSirYr4o9krs0Xkxv64=oBiQ@mail.gmail.com>

Thomas, All,

On 2017-01-31 11:12 +0100, Thomas De Schampheleire spake thusly:
> On Sat, Jan 28, 2017 at 11:19 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > Currently, the output of printvars copntains the name of the variable,
> > its expanded value and its un-expanded value.
> >
> > However, most of the time, we need the actual, expanded value, so it can
> > be re-used from a (non-Buildroot) infrastructure script, like a
> > post-build script, or a build-farm driver (e.g. a Jenkins job...)
> >
> > Add two options that a user may set to change the output of printvars:
> >   - RAW_VARS, if set, will drop the unexpanded value
> >   - QUOTED_VARS, if set, will quote the expanded value
> >
> > So that it can be used as such:
> >
> >     $ make -s printvars VARS=BUSYBOX_VERSION RAW_VARS=1 QUOTED_VARS=1
> >     BUSYBOX_VERSION='1.26.2'
> >
> > And it is even possible to directly evaluate it in a shell script:
> >
> >     eval $(make -s printvars VARS=BUSYBOX_VERSION RAW_VARS=1 QUOTED_VARS=1)
> >
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 5e4bc92..67a9b5d 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -934,7 +934,7 @@ printvars:
> >                 $(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
> >                 $(if $(filter-out environment% default automatic, \
> >                                 $(origin $V)), \
> > -               $(info $V=$($V) ($(value $V)))))
> > +               $(info $V=$(if $(QUOTED_VARS),')$($V)$(if $(QUOTED_VARS),')$(if $(RAW_VARS),, ($(value $V))))))
> >
> >  clean:
> >         rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
> > --
> > 2.7.4
> 
> 
> Very nice, I've been needing this a few times before too.
> 
> I do think we should document the new flags QUOTED_VARS and RAW_VARS
> somewhere (and in general 'printvars' itself). Perhaps here:
> http://buildroot.uclibc.org/downloads/manual/manual.html#make-tips ?

Damned, I forgot to document it, indeed...

I was instead thinking of documenting it in the output of 'make help'.

But both there and in the manual seems OK for me. I'll do.

> Regarding naming (I realize, these are nits): RAW sounds like somehow
> opposite of QUOTED. What about using PLAIN rather than RAW ?
> An alternative is to change the default behavior to be raw/plain, and
> add a VERBOSE option to display also the unexpanded value.

Well, I prefer not to change the current behaviour.

If others prefer we change the current behaviour, so be it. I'll wait
for more feedback.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2017-01-31 17:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-28 22:19 [Buildroot] [PATCH] core: enhance printvars Yann E. MORIN
2017-01-31 10:12 ` Thomas De Schampheleire
2017-01-31 17:31   ` Yann E. MORIN [this message]
2017-02-02 21:41     ` Arnout Vandecappelle
2017-03-26 21:42 ` Thomas Petazzoni

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

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

  git send-email \
    --in-reply-to=20170131173106.GA3534@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox