diff mbox series

[v2] tools: add libyaml

Message ID 20200729234919.3084077-1-mail@aparcar.org
State Superseded
Headers show
Series [v2] tools: add libyaml | expand

Commit Message

Paul Spooren July 29, 2020, 11:49 p.m. UTC
libyaml is used to process YAML files, a popular human readable
configuration format. If available during compilation, the
device-tree-compiler (dtc) will enable YAML as export format.

The exported YAML files can be validated using dt-schema[0].

Once available this can be used within a CI to reduce human resources
spent on reviewing DTS files.

[0]: https://github.com/robherring/dt-schema

Signed-off-by: Paul Spooren <mail@aparcar.org>
---
v2:
* Use autotools as upstream doesn't fully support CMake
* Add MIT license

 tools/Makefile         |  2 +-
 tools/libyaml/Makefile | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 tools/libyaml/Makefile

Comments

Daniel Golle July 30, 2020, 12:03 a.m. UTC | #1
On Wed, Jul 29, 2020 at 01:49:20PM -1000, Paul Spooren wrote:
> libyaml is used to process YAML files, a popular human readable
> configuration format. If available during compilation, the
> device-tree-compiler (dtc) will enable YAML as export format.
> 
> The exported YAML files can be validated using dt-schema[0].
> 
> Once available this can be used within a CI to reduce human resources
> spent on reviewing DTS files.
... and it will allow us to verify DTB bindings against the yaml
schema format now enforced upstream for mandatory binding
documentation. 
Try `make dt_binding_check` in a kernel tree with libyaml available.
(and also try `make dtbs_check`)

patch now looks good.
> 
> [0]: https://github.com/robherring/dt-schema
> 
> Signed-off-by: Paul Spooren <mail@aparcar.org>
Acked-by: Daniel Golle <daniel@makrotopia.org>

> ---
> v2:
> * Use autotools as upstream doesn't fully support CMake
> * Add MIT license
> 
>  tools/Makefile         |  2 +-
>  tools/libyaml/Makefile | 25 +++++++++++++++++++++++++
>  2 files changed, 26 insertions(+), 1 deletion(-)
>  create mode 100644 tools/libyaml/Makefile
> 
> diff --git a/tools/Makefile b/tools/Makefile
> index 9bae09ece6..96de762772 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -26,7 +26,7 @@ tools-y += m4 libtool autoconf autoconf-archive automake flex bison pkgconf mkli
>  tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
>  tools-y += firmware-utils patch-image quilt padjffs2
>  tools-y += mm-macros missing-macros cmake bc findutils gengetopt patchelf
> -tools-y += mtools dosfstools libressl
> +tools-y += mtools dosfstools libressl libyaml
>  tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
>  tools-$(CONFIG_TARGET_x86) += qemu
>  tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
> diff --git a/tools/libyaml/Makefile b/tools/libyaml/Makefile
> new file mode 100644
> index 0000000000..9a7fc8a334
> --- /dev/null
> +++ b/tools/libyaml/Makefile
> @@ -0,0 +1,25 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# Copyright (C) 2020 Paul Spooren <mail@aparcar.org>
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=libyaml
> +PKG_VERSION:=0.2.5
> +PKG_HASH:=fa240dbf262be053f3898006d502d514936c818e422afdcf33921c63bed9bf2e
> +PKG_RELEASE:=1
> +PKG_LICENSE:=MIT
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> +PKG_SOURCE_URL:=https://codeload.github.com/yaml/libyaml/tar.gz/$(PKG_VERSION)?
> +
> +HOST_BUILD_PARALLEL:=1
> +HOST_FIXUP:=autoreconf
> +
> +include $(INCLUDE_DIR)/host-build.mk
> +
> +$(eval $(call HostBuild))
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Rosen Penev July 30, 2020, 12:43 a.m. UTC | #2
On Wed, Jul 29, 2020 at 4:53 PM Paul Spooren <mail@aparcar.org> wrote:
>
> libyaml is used to process YAML files, a popular human readable
> configuration format. If available during compilation, the
> device-tree-compiler (dtc) will enable YAML as export format.
>
> The exported YAML files can be validated using dt-schema[0].
>
> Once available this can be used within a CI to reduce human resources
> spent on reviewing DTS files.
>
> [0]: https://github.com/robherring/dt-schema
>
> Signed-off-by: Paul Spooren <mail@aparcar.org>
For most of my comments, please reference
https://github.com/openwrt/packages/blob/master/libs/yaml/Makefile

I would also like both Makefiles to be as similar as possible. Within
reason of course.
> ---
> v2:
> * Use autotools as upstream doesn't fully support CMake
> * Add MIT license
>
>  tools/Makefile         |  2 +-
>  tools/libyaml/Makefile | 25 +++++++++++++++++++++++++
>  2 files changed, 26 insertions(+), 1 deletion(-)
>  create mode 100644 tools/libyaml/Makefile
>
> diff --git a/tools/Makefile b/tools/Makefile
> index 9bae09ece6..96de762772 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -26,7 +26,7 @@ tools-y += m4 libtool autoconf autoconf-archive automake flex bison pkgconf mkli
>  tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
>  tools-y += firmware-utils patch-image quilt padjffs2
>  tools-y += mm-macros missing-macros cmake bc findutils gengetopt patchelf
> -tools-y += mtools dosfstools libressl
> +tools-y += mtools dosfstools libressl libyaml
>  tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
>  tools-$(CONFIG_TARGET_x86) += qemu
>  tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
> diff --git a/tools/libyaml/Makefile b/tools/libyaml/Makefile
> new file mode 100644
> index 0000000000..9a7fc8a334
> --- /dev/null
> +++ b/tools/libyaml/Makefile
> @@ -0,0 +1,25 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# Copyright (C) 2020 Paul Spooren <mail@aparcar.org>
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=libyaml
> +PKG_VERSION:=0.2.5
> +PKG_HASH:=fa240dbf262be053f3898006d502d514936c818e422afdcf33921c63bed9bf2e
> +PKG_RELEASE:=1
> +PKG_LICENSE:=MIT
PKG_CPE_ID is useful as well.
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> +PKG_SOURCE_URL:=https://codeload.github.com/yaml/libyaml/tar.gz/$(PKG_VERSION)?
NAK. codeload is not guaranteed to be reproducible. Use the already
generated tarball from
https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz
or from http://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz
> +
> +HOST_BUILD_PARALLEL:=1
> +HOST_FIXUP:=autoreconf
Unnecessary with the tarballs I mentioned.
> +
> +include $(INCLUDE_DIR)/host-build.mk
> +
> +$(eval $(call HostBuild))
> --
> 2.25.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Petr Štetiar July 30, 2020, 12:20 p.m. UTC | #3
Rosen Penev <rosenp@gmail.com> [2020-07-29 17:43:08]:

> I would also like both Makefiles to be as similar as possible. Within
> reason of course.

Why not just have one package in the main tree?
Petr Štetiar July 30, 2020, 1:05 p.m. UTC | #4
Daniel Golle <daniel@makrotopia.org> [2020-07-30 01:03:36]:

Hi,

> ... and it will allow us to verify DTB bindings against the yaml
> schema format now enforced upstream for mandatory binding
> documentation. 

I expect, that this journey is going to be much longer and wont end with just
adding libyaml into the tree. 

Why we can't simply do the same dependency check as kernel does? Why to add
all the dependencies into the tree implicitly?

I mean, if you want to validate stuff, then just install libyaml from your
distro and appropriate dtschema via pip (likely going to change with kernel
versions). libyaml is neither build time or run time dependency.

> Try `make dt_binding_check` in a kernel tree with libyaml available.
> (and also try `make dtbs_check`)

 $ make dt_binding_check
 ERROR: dtschema minimum version is v2020.5
 Documentation/devicetree/bindings/Makefile:10: recipe for target 'check_dtschema_version' failed

-- ynezz
diff mbox series

Patch

diff --git a/tools/Makefile b/tools/Makefile
index 9bae09ece6..96de762772 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -26,7 +26,7 @@  tools-y += m4 libtool autoconf autoconf-archive automake flex bison pkgconf mkli
 tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
 tools-y += firmware-utils patch-image quilt padjffs2
 tools-y += mm-macros missing-macros cmake bc findutils gengetopt patchelf
-tools-y += mtools dosfstools libressl
+tools-y += mtools dosfstools libressl libyaml
 tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
 tools-$(CONFIG_TARGET_x86) += qemu
 tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
diff --git a/tools/libyaml/Makefile b/tools/libyaml/Makefile
new file mode 100644
index 0000000000..9a7fc8a334
--- /dev/null
+++ b/tools/libyaml/Makefile
@@ -0,0 +1,25 @@ 
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) 2020 Paul Spooren <mail@aparcar.org>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libyaml
+PKG_VERSION:=0.2.5
+PKG_HASH:=fa240dbf262be053f3898006d502d514936c818e422afdcf33921c63bed9bf2e
+PKG_RELEASE:=1
+PKG_LICENSE:=MIT
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/yaml/libyaml/tar.gz/$(PKG_VERSION)?
+
+HOST_BUILD_PARALLEL:=1
+HOST_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/host-build.mk
+
+$(eval $(call HostBuild))