devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: Add a minimum version check for dtschema
@ 2020-04-16 18:54 Rob Herring
  2020-04-17  2:58 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring @ 2020-04-16 18:54 UTC (permalink / raw)
  To: devicetree; +Cc: linux-kernel, Masahiro Yamada

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 <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
index 1df680d07461..9f2e64e29d79 100644
--- a/Documentation/devicetree/bindings/Makefile
+++ b/Documentation/devicetree/bindings/Makefile
@@ -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) $< > $@
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dt-bindings: Add a minimum version check for dtschema
  2020-04-16 18:54 [PATCH] dt-bindings: Add a minimum version check for dtschema Rob Herring
@ 2020-04-17  2:58 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2020-04-17  2:58 UTC (permalink / raw)
  To: Rob Herring; +Cc: DTML, Linux Kernel Mailing List

On Fri, Apr 17, 2020 at 3:54 AM Rob Herring <robh@kernel.org> wrote:
>
> 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 <masahiroy@kernel.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---


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)




>  Documentation/devicetree/bindings/Makefile | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
> index 1df680d07461..9f2e64e29d79 100644
> --- a/Documentation/devicetree/bindings/Makefile
> +++ b/Documentation/devicetree/bindings/Makefile
> @@ -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) $< > $@
> --
> 2.20.1
>


--
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-17  2:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-16 18:54 [PATCH] dt-bindings: Add a minimum version check for dtschema Rob Herring
2020-04-17  2:58 ` Masahiro Yamada

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 NNTP newsgroup(s).