On Sat, Apr 18, 2020 at 12:42 AM Rob Herring <robh@xxxxxxxxxx> 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@xxxxxxxxxx> > Signed-off-by: Rob Herring <robh@xxxxxxxxxx> > --- > v2: > - Use a build rule for the version check instead > > Documentation/devicetree/bindings/Makefile | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile > index 1df680d07461..daf0dda45a78 100644 > --- a/Documentation/devicetree/bindings/Makefile > +++ b/Documentation/devicetree/bindings/Makefile > @@ -3,11 +3,19 @@ DT_DOC_CHECKER ?= dt-doc-validate > DT_EXTRACT_EX ?= dt-extract-example > DT_MK_SCHEMA ?= dt-mk-schema > > +DT_SCHEMA_MIN_VERSION = 2020.04 Just a nit: You can use 2020.4 if you want to be consistent with the output from 'dt-doc-validate --version' This is not a big deal, though. It is up to you. $ dt-doc-validate --version 2020.4 > + > +PHONY += check_dtschema_version > +check_dtschema_version: > + @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)"; exit 1) 1>&2 > + The ( ... ) run the given command in a sub-shell. { ... } does not spawn a sub-shell, so it is a bit more efficient if you do not have a good reason to run it in a sub-shell. I prefer 'false' instead of 'exit 1' because we do not need to specify the exit code explicitly. 'false' is used in the top Makefile to stop the build. I want to place the '1>&2' close to the error message, and you can omit the redundant '1'. How about this? check_dtschema_version: @{ echo $(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)" >&2; false; } -- Best Regards Masahiro Yamada