Skip to contentSkip to conversation

dt-bindings: Add a help message when dtschema tools are missing

PATCH In review Rob Herring 2 participants 4 messages Oct 26, 2021 – Oct 27, 2021 Device tree bindings

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: Add a help message when dtschema tools are missing

The dtschema version check works, but is not that clear when dtschema is neither installed nor in the PATH. Add a separate check and message if dt-doc-validate is not found.

Cc Luca Ceresoli <[email protected]>
Cc Masahiro Yamada <[email protected]>
---
 Documentation/devicetree/bindings/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/Makefile +4 -0
index 8d6d912c6a6a..001b4f62b741 100644
@@ -9,6 +9,10 @@ DT_SCHEMA_MIN_VERSION = 2021.2.1
 
 PHONY += check_dtschema_version
 check_dtschema_version:
+	@which $(DT_DOC_CHECKER) >/dev/null || \
+		{ echo "Error: '$(DT_DOC_CHECKER)' not found!" \
+		"\nEnsure dtschema python package is installed and in your PATH." \
+		"\nCurrent PATH is:\n$$PATH\n" >&2; false; }
 	@{ echo $(DT_SCHEMA_MIN_VERSION); \
 	$(DT_DOC_CHECKER) --version 2>/dev/null || echo 0; } | sort -Vc >/dev/null || \
 	{ echo "ERROR: dtschema minimum version is v$(DT_SCHEMA_MIN_VERSION)" >&2; false; }
Signature · 1 line
2.32.0
#1 lore raw

Hi Rob,

thanks for this patch!

Quoted 2 lines · Rob Herring

The dtschema version check works, but is not that clear when dtschema is neither installed nor in the PATH. Add a separate check and message if

Nit: I think it should say "either not installed or not in the PATH".

Quoted 14 lines

dt-doc-validate is not found.

Cc Luca Ceresoli <[email protected]>
Cc Masahiro Yamada <[email protected]>
---
 Documentation/devicetree/bindings/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/Makefile +0 -0
index 8d6d912c6a6a..001b4f62b741 100644

Documentation/devicetree/bindings/Makefile DT_SCHEMA_MIN_VERSION = 2021.2.1 · line 15

Quoted 7 lines
Documentation/devicetree/bindings/Makefile +4 -0
@@ -9,6 +9,10 @@ DT_SCHEMA_MIN_VERSION = 2021.2.1
 
 PHONY += check_dtschema_version
 check_dtschema_version:
+	@which $(DT_DOC_CHECKER) >/dev/null || \
+		{ echo "Error: '$(DT_DOC_CHECKER)' not found!" \
+		"\nEnsure dtschema python package is installed and in your PATH." \
+		"\nCurrent PATH is:\n$$PATH\n" >&2; false; }

You need 'echo -e' for the '\n'.

Otherwise looks and works well.

Signature · 1 line
Luca
author maintainer
#2 lore raw
Quoted 10 lines · Luca Ceresoli

Hi Rob,

thanks for this patch!

Quoted 2 lines · Rob Herring

The dtschema version check works, but is not that clear when dtschema is neither installed nor in the PATH. Add a separate check and message if

Nit: I think it should say "either not installed or not in the PATH".

Right.

Quoted 16 lines
Quoted 16 lines

dt-doc-validate is not found.

Cc Luca Ceresoli <[email protected]>
Cc Masahiro Yamada <[email protected]>
---
 Documentation/devicetree/bindings/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/Makefile +0 -0
index 8d6d912c6a6a..001b4f62b741 100644
@@ -9,6 +9,10 @@ DT_SCHEMA_MIN_VERSION = 2021.2.1
 
Quoted 8 lines

Documentation/devicetree/bindings/Makefile DT_SCHEMA_MIN_VERSION = 2021.2.1 · line 15

Quoted 6 lines
Documentation/devicetree/bindings/Makefile +4 -0
 PHONY += check_dtschema_version
 check_dtschema_version:
+     @which $(DT_DOC_CHECKER) >/dev/null || \
+             { echo "Error: '$(DT_DOC_CHECKER)' not found!" \
+             "\nEnsure dtschema python package is installed and in your PATH." \
+             "\nCurrent PATH is:\n$$PATH\n" >&2; false; }

You need 'echo -e' for the '\n'.

Except dash will just print '-e' and interpret the newlines...

I changed it like this:

@which $(DT_DOC_CHECKER) >/dev/null || \
{ echo "Error: '$(DT_DOC_CHECKER)' not found!" >&2; \
echo "Ensure dtschema python package is installed and in your PATH." >&2; \
echo "Current PATH is:" >&2; \
echo "$$PATH" >&2; false; }

Rob

#3 lore raw

Hi,

Quoted 39 lines · Rob Herring
Quoted 10 lines · Luca Ceresoli

Hi Rob,

thanks for this patch!

Quoted 2 lines · Rob Herring

The dtschema version check works, but is not that clear when dtschema is neither installed nor in the PATH. Add a separate check and message if

Nit: I think it should say "either not installed or not in the PATH".

Right.

Quoted 16 lines
Quoted 16 lines

dt-doc-validate is not found.

Cc Luca Ceresoli <[email protected]>
Cc Masahiro Yamada <[email protected]>
---
 Documentation/devicetree/bindings/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/Makefile +0 -0
index 8d6d912c6a6a..001b4f62b741 100644
@@ -9,6 +9,10 @@ DT_SCHEMA_MIN_VERSION = 2021.2.1
 
Quoted 8 lines

Documentation/devicetree/bindings/Makefile DT_SCHEMA_MIN_VERSION = 2021.2.1 · line 15

Quoted 6 lines
Documentation/devicetree/bindings/Makefile +4 -0
 PHONY += check_dtschema_version
 check_dtschema_version:
+     @which $(DT_DOC_CHECKER) >/dev/null || \
+             { echo "Error: '$(DT_DOC_CHECKER)' not found!" \
+             "\nEnsure dtschema python package is installed and in your PATH." \
+             "\nCurrent PATH is:\n$$PATH\n" >&2; false; }

You need 'echo -e' for the '\n'.

Quoted 1 line

Except dash will just print '-e' and interpret the newlines...

Oh dear, I always forget about dash...

Quoted 7 lines

I changed it like this:

@which $(DT_DOC_CHECKER) >/dev/null || \
{ echo "Error: '$(DT_DOC_CHECKER)' not found!" >&2; \
echo "Ensure dtschema python package is installed and in your PATH." >&2; \
echo "Current PATH is:" >&2; \
echo "$$PATH" >&2; false; }

Either that or 'printf', which IIRC is more portable, including with \n. But in this simple case I find multiple 'echo's more readable than one printf with '\n's.

Signature · 1 line
Luca