Skip to contentSkip to conversation

docs/manual: add note about spurious errors duing make printvars

PATCH New Martin Kepplinger 5 participants 11 messages Mar 12, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/manual: add note about spurious errors duing make printvars

Add a note about errors we currently have, as discussed in
http://lists.busybox.net/pipermail/buildroot/2019-March/244212.html

---
 docs/manual/make-tips.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
docs/manual/make-tips.txt +10 -0
index ea1d825bef..475de4ffa7 100644
@@ -131,3 +131,13 @@ The output of quoted variables can be reused in shell scripts, for example:
  $ echo $BUSYBOX_DEPENDENCIES
  skeleton toolchain
 ----
+
+Note that when using +make printvars+ you might see spurious errors like
+the following. Please help reviewing our Makefile macros and variables
+in order to fix this:
+
+----
+/bin/bash: support/dependencies/check-host-.sh: no such file or directory
+/bin/bash: -c: line 0: syntax error: ')' unexpected
+/bin/bash: -c: line 0: `set -e; TMP="$(mktemp)"; if () >/dev/null 2>&1; then echo ""; else echo ""; fi;
+----
Signature · 9 lines
2.20.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3616 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190312/e2e0dfb4/attachment.bin>
#1 lore raw

PATCH 1/1 docs/manual: add note about spurious errors duing make printvars

Quoted 13 lines · Martin Kepplinger

Add a note about errors we currently have, as discussed in
http://lists.busybox.net/pipermail/buildroot/2019-March/244212.html

---
 docs/manual/make-tips.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
docs/manual/make-tips.txt +0 -0
index ea1d825bef..475de4ffa7 100644

docs/manual/make-tips.txt The output of quoted variables can be reused in shell scripts, for example: · line 137

Quoted 7 lines
docs/manual/make-tips.txt +4 -0
@@ -131,3 +131,13 @@ The output of quoted variables can be reused in shell scripts, for example:
  $ echo $BUSYBOX_DEPENDENCIES
  skeleton toolchain
 ----
+
+Note that when using +make printvars+ you might see spurious errors like
+the following. Please help reviewing our Makefile macros and variables
+in order to fix this:

I thought the conclusion of that thread is that there is no way to fix it? The
only reasonable way is to filter out macros from the .VARS. E.g. defining PRINTVARS_FILTER and for each macro definition, append to that list.

However, I'm not even convinced that we really want to do that. It is adding
significant complexity for little gain.

Instead, I'm more inclined to remove the possibility of running printvars
without explicit VARS=. If you really want, you can still get all variables with VARS=%.

Regards,
Arnout

Quoted 13 lines
docs/manual/make-tips.txt +6 -0
+
+----
+/bin/bash: support/dependencies/check-host-.sh: no such file or directory
+/bin/bash: -c: line 0: syntax error: ')' unexpected
+/bin/bash: -c: line 0: `set -e; TMP="$(mktemp)"; if () >/dev/null 2>&1; then echo ""; else echo ""; fi;
+----

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw

PATCH 1/1 docs/manual: add note about spurious errors duing make printvars

Arnout, All,

On 2019-03-12 13:33 +0100, Arnout Vandecappelle spake thusly:

Quoted 26 lines · Martin Kepplinger
Quoted 13 lines

Add a note about errors we currently have, as discussed in
http://lists.busybox.net/pipermail/buildroot/2019-March/244212.html

---
 docs/manual/make-tips.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
docs/manual/make-tips.txt +0 -0
index ea1d825bef..475de4ffa7 100644

docs/manual/make-tips.txt The output of quoted variables can be reused in shell scripts, for example: · line 137

Quoted 7 lines
docs/manual/make-tips.txt +4 -0
@@ -131,3 +131,13 @@ The output of quoted variables can be reused in shell scripts, for example:
  $ echo $BUSYBOX_DEPENDENCIES
  skeleton toolchain
 ----
+
+Note that when using +make printvars+ you might see spurious errors like
+the following. Please help reviewing our Makefile macros and variables
+in order to fix this:

I thought the conclusion of that thread is that there is no way to fix it? The
only reasonable way is to filter out macros from the .VARS. E.g. defining PRINTVARS_FILTER and for each macro definition, append to that list.

Quoted 6 lines

However, I'm not even convinced that we really want to do that. It is adding
significant complexity for little gain.

Instead, I'm more inclined to remove the possibility of running printvars
without explicit VARS=. If you really want, you can still get all variables with VARS=%.

I'd like the ability to extract many unrelated variables, but not all of them either, so maybe we can accept that VARS is a sapce-separated list of patterns to extract, ?-la:

    make -s printvars VARS="VAR_1 VAR_2 PAT_1_% PAT_2_%"

which would make it faster and more reliable to extract a subset of the variables, without the need to filter them out of the whole printvars, nor with the overhead (a few seconds) of calling make for each one.

I think I know someone that will work on that soon. ;-)

Regards,
Yann E. MORIN.

Signature · 21 lines
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
| +33 534.541.179 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
|      yann.morin (at) orange.com      |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
#3 lore raw

PATCH 1/1 docs/manual: add note about spurious errors duing make printvars

Quoted 5 lines · yann.morin at orange.com

I'd like the ability to extract many unrelated variables, but not all of them either, so maybe we can accept that VARS is a sapce-separated list of patterns to extract, ?-la:

    make -s printvars VARS="VAR_1 VAR_2 PAT_1_% PAT_2_%"

This has worked ever since we introduced VARS...

Regards,
Arnout

#4 lore raw

PATCH 1/1 docs/manual: add note about spurious errors duing make printvars

Arnout, All,

On 2019-03-12 14:53 +0100, Arnout Vandecappelle spake thusly:

Quoted 6 lines · yann.morin at orange.com
Quoted 4 lines

I'd like the ability to extract many unrelated variables, but not all of them either, so maybe we can accept that VARS is a sapce-separated list of patterns to extract, ?-la:

    make -s printvars VARS="VAR_1 VAR_2 PAT_1_% PAT_2_%"

This has worked ever since we introduced VARS...

Wooo... I did not even try it, I just assumed from the manual that this was not supported, because we say "the make pattern" (i.e. singular)...

OK, so I know someone that will soon be sending an update to the manual... ;-)
Thanks!

Regards,
Yann E. MORIN.

Signature · 21 lines
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
| +33 534.541.179 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
|      yann.morin (at) orange.com      |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
#5 lore raw

PATCH 1/1 docs/manual: add note about spurious errors duing make printvars

In reply to Arnout Vandecappelle

Arnout, All,

On 2019-03-12 13:33 +0100, Arnout Vandecappelle spake thusly:

Quoted 9 lines · Martin Kepplinger
Quoted 8 lines

Add a note about errors we currently have, as discussed in
http://lists.busybox.net/pipermail/buildroot/2019-March/244212.html

---
 docs/manual/make-tips.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
Quoted 14 lines

docs/manual/make-tips.txt The output of quoted variables can be reused in shell scripts, for example: · line 137

Quoted 12 lines
docs/manual/make-tips.txt +4 -0
index ea1d825bef..475de4ffa7 100644
@@ -131,3 +131,13 @@ The output of quoted variables can be reused in shell scripts, for example:
  $ echo $BUSYBOX_DEPENDENCIES
  skeleton toolchain
 ----
+
+Note that when using +make printvars+ you might see spurious errors like
+the following. Please help reviewing our Makefile macros and variables
+in order to fix this:

I thought the conclusion of that thread is that there is no way to fix it?

Yes, that was my impresion as well. We can document that here may be spurious error messages, but fixing them is not wanted (because it makes the code more complex).

Quoted 6 lines

The
only reasonable way is to filter out macros from the .VARS. E.g. defining PRINTVARS_FILTER and for each macro definition, append to that list.

However, I'm not even convinced that we really want to do that. It is adding
significant complexity for little gain.

Agreed.

Quoted 3 lines

Instead, I'm more inclined to remove the possibility of running printvars
without explicit VARS=. If you really want, you can still get all variables with VARS=%.

Yes, that sounds like a good idea, indeed. +1

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH 1/2 printvars: don't print anything when VARS is not set

Using 'make printvars' for printing all variables is not very useful. E.g. all macros will output some bogus value. In addition, the same can be achieved with 'make -p'.

We can simply remove the condition on $(VARS). If VARS is not set, the filter expression will be empty which matches nothing, so nothing is printed.

Note that the old behaviour can still be achieved with:
make printvars VARS=%

Update the 'make help' text to match the new behaviour.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index a64196f9c3..6af8923892 100644
@@ -1031,7 +1031,7 @@ $(BUILD_DIR)/.br2-external.in: $(BUILD_DIR)
 printvars:
 	@:
 	$(foreach V, \
-		$(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
+		$(sort $(filter $(VARS),$(.VARIABLES))), \
 		$(if $(filter-out environment% default automatic, \
 				$(origin $V)), \
 		$(if $(QUOTED_VARS),\
@@ -1124,7 +1124,7 @@ help:
 	@echo '  source                 - download all sources needed for offline-build'
 	@echo '  external-deps          - list external packages used'
 	@echo '  legal-info             - generate info about license compliance'
-	@echo '  printvars              - dump all the internal variables'
+	@echo '  printvars              - dump internal variables selected with VARS=...'
 	@echo
 	@echo '  make V=0|1             - 0 => quiet build (default), 1 => verbose build'
 	@echo '  make O=dir             - Locate all output files in "dir", including .config'
Signature · 1 line
2.20.1
#7 lore raw

PATCH 2/2 docs/manual: document new behaviour of 'make printvars'

Add a 'VARS=...' setting to the example. To make it clear that several variables can be specified, use two variables in the first example. Only 2 variables are printed, so the ... is removed.

---
 docs/manual/make-tips.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
docs/manual/make-tips.txt +5 -5
index ea1d825bef..869b6807dd 100644
@@ -80,18 +80,18 @@ to xref:ccache[].
 
 .Dumping the internal make variables:
 
-One can dump all the variables known to make, along with their values:
+One can dump the variables known to make, along with their values:
 
 ----
- $ make -s printvars
- VARIABLE=value_of_variable
- ...
+ $ make -s printvars VARS='VARIABLE1 VARIABLE2'
+ VARIABLE1=value_of_variable
+ VARIABLE2=value_of_variable
 ----
 
 It is possible to tweak the output using some variables:
 
 - +VARS+ will limit the listing to variables which names match the
-  specified make-pattern
+  specified make-patterns - this must be set else nothing is printed
 - +QUOTED_VARS+, if set to +YES+, will single-quote the value
 - +RAW_VARS+, if set to +YES+, will print the unexpanded value
 
Signature · 1 line
2.20.1
#8 lore raw

PATCH 2/2 docs/manual: document new behaviour of 'make printvars'

Arnout, All,

On 2019-03-12 18:55 +0100, Arnout Vandecappelle (Essensium/Mind) spake thusly:

Quoted 6 lines

Add a 'VARS=...' setting to the example. To make it clear that several variables can be specified, use two variables in the first example. Only 2 variables are printed, so the ... is removed.

Regards,
Yann E. MORIN.

Quoted 35 lines
---
 docs/manual/make-tips.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
docs/manual/make-tips.txt +5 -5
index ea1d825bef..869b6807dd 100644
@@ -80,18 +80,18 @@ to xref:ccache[].
 
 .Dumping the internal make variables:
 
-One can dump all the variables known to make, along with their values:
+One can dump the variables known to make, along with their values:
 
 ----
- $ make -s printvars
- VARIABLE=value_of_variable
- ...
+ $ make -s printvars VARS='VARIABLE1 VARIABLE2'
+ VARIABLE1=value_of_variable
+ VARIABLE2=value_of_variable
 ----
 
 It is possible to tweak the output using some variables:
 
 - +VARS+ will limit the listing to variables which names match the
-  specified make-pattern
+  specified make-patterns - this must be set else nothing is printed
 - +QUOTED_VARS+, if set to +YES+, will single-quote the value
 - +RAW_VARS+, if set to +YES+, will print the unexpanded value
 
Signature · 1 line
2.20.1
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH 1/2 printvars: don't print anything when VARS is not set

In reply to Arnout Vandecappelle (Essensium/Mind)

Arnout, All,

On 2019-03-12 18:55 +0100, Arnout Vandecappelle (Essensium/Mind) spake thusly:

Quoted 10 lines

Using 'make printvars' for printing all variables is not very useful. E.g. all macros will output some bogus value. In addition, the same can be achieved with 'make -p'.

We can simply remove the condition on $(VARS). If VARS is not set, the filter expression will be empty which matches nothing, so nothing is printed.

Note that the old behaviour can still be achieved with:
make printvars VARS=%

... with a very minor difference: now, the VARS variable is present when it was not for a simple 'printavrs'.

I also wondered if we should not just error out now when VARS is empty (or unset, which is the same in make), or people used to using printvars and parsing the output, could get confused somehow. But oh well, that case was already broken anyway...

Quoted 4 lines

Update the 'make help' text to match the new behaviour.

Regards,
Yann E. MORIN.

Quoted 29 lines
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index a64196f9c3..6af8923892 100644
@@ -1031,7 +1031,7 @@ $(BUILD_DIR)/.br2-external.in: $(BUILD_DIR)
 printvars:
 	@:
 	$(foreach V, \
-		$(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
+		$(sort $(filter $(VARS),$(.VARIABLES))), \
 		$(if $(filter-out environment% default automatic, \
 				$(origin $V)), \
 		$(if $(QUOTED_VARS),\
@@ -1124,7 +1124,7 @@ help:
 	@echo '  source                 - download all sources needed for offline-build'
 	@echo '  external-deps          - list external packages used'
 	@echo '  legal-info             - generate info about license compliance'
-	@echo '  printvars              - dump all the internal variables'
+	@echo '  printvars              - dump internal variables selected with VARS=...'
 	@echo
 	@echo '  make V=0|1             - 0 => quiet build (default), 1 => verbose build'
 	@echo '  make O=dir             - Locate all output files in "dir", including .config'
Signature · 1 line
2.20.1
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#10 lore raw

PATCH 1/2 printvars: don't print anything when VARS is not set

In reply to Arnout Vandecappelle (Essensium/Mind)
Quoted 11 lines · On Tue, 12 Mar 2019 18:55:34 +0100 "Arnout Vandecappelle (Essensium/Mind)"…

Using 'make printvars' for printing all variables is not very useful. E.g. all macros will output some bogus value. In addition, the same can be achieved with 'make -p'.

We can simply remove the condition on $(VARS). If VARS is not set, the filter expression will be empty which matches nothing, so nothing is printed.

Note that the old behaviour can still be achieved with:
make printvars VARS=%

Quoted 7 lines

Update the 'make help' text to match the new behaviour.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Both applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com