Skip to contentSkip to conversation

dt-bindings: Add a minimum version check for dtschema

PATCH Superseded Rob Herring 2 participants 2 messages Apr 16, 2020 – Apr 17, 2020 Device tree bindings

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: Add a minimum version check for dtschema

The dtschema package must be somewhat up to date as the tools and meta-schema checks are still evolving. Implement a version check, so this can be enforced. This will help ensure new schema submissions get checked against the latest meta-schemas.

Cc Masahiro Yamada <[email protected]>
---
 Documentation/devicetree/bindings/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/Makefile +10 -0
index 1df680d07461..9f2e64e29d79 100644
@@ -3,6 +3,16 @@ DT_DOC_CHECKER ?= dt-doc-validate
 DT_EXTRACT_EX ?= dt-extract-example
 DT_MK_SCHEMA ?= dt-mk-schema
 
+DT_SCHEMA_MIN_VERSION = 2020.04
+ifeq (1,$(shell \
+	printf "%s\n" \
+		$(DT_SCHEMA_MIN_VERSION) \
+		$$($(DT_DOC_CHECKER) --version 2>/dev/null || echo 0) | sort -VC; \
+		echo $$? \
+	))
+$(error dtschema minimum version is v$(DT_SCHEMA_MIN_VERSION))
+endif
+
 quiet_cmd_chk_binding = CHKDT   $(patsubst $(srctree)/%,%,$<)
       cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
                         $(DT_EXTRACT_EX) $< > $@
Signature · 1 line
2.20.1
#1 lore raw
Quoted 9 lines · Rob Herring

The dtschema package must be somewhat up to date as the tools and meta-schema checks are still evolving. Implement a version check, so this can be enforced. This will help ensure new schema submissions get checked against the latest meta-schemas.

Cc Masahiro Yamada <[email protected]>

---

You cannot check this in the parse stage.

Without the latest dt-schema tools,
you cannot do even 'make clean'. This is odd.

$ make clean
Documentation/devicetree/bindings/Makefile:13: *** dtschema minimum
version is v2020.04.  Stop.
make[1]: *** [scripts/Makefile.clean:66:
Documentation/devicetree/bindings] Error 2
make: *** [Makefile:1729: _clean_Documentation] Error 2

How about adding a phony target to check the version?

PHONY += check_dtschema_version
check_dtschema_version:
( Do something to check tool version)

quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<)

      cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
                        $(DT_EXTRACT_EX) $< > $@

$(obj)/%.example.dts: $(src)/%.yaml check_dtschema_version FORCE $(call if_changed,chk_binding)

Quoted 25 lines
 Documentation/devicetree/bindings/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/Makefile +10 -1
index 1df680d07461..9f2e64e29d79 100644
@@ -3,6 +3,16 @@ DT_DOC_CHECKER ?= dt-doc-validate
 DT_EXTRACT_EX ?= dt-extract-example
 DT_MK_SCHEMA ?= dt-mk-schema
 
+DT_SCHEMA_MIN_VERSION = 2020.04
+ifeq (1,$(shell \
+       printf "%s\n" \
+               $(DT_SCHEMA_MIN_VERSION) \
+               $$($(DT_DOC_CHECKER) --version 2>/dev/null || echo 0) | sort -VC; \
+               echo $$? \
+       ))
+$(error dtschema minimum version is v$(DT_SCHEMA_MIN_VERSION))
+endif
+
 quiet_cmd_chk_binding = CHKDT   $(patsubst $(srctree)/%,%,$<)
       cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
                         $(DT_EXTRACT_EX) $< > $@
--
Quoted 2 lines

2.20.1

--
Best Regards
Masahiro Yamada