[libcamera-devel] [PATCH 2/2] libcamera: Switch internal YAML files to YAML 1.1

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Aug 4 15:21:12 CEST 2022


The python3-yaml package shipped by Debian is based on libyaml 0.2.2,
which doesn't support YAML 1.2. It is documented as such:

    Python3-yaml is a complete YAML 1.1 parser and emitter for Python3.

For some reasons the internal YAML files used to generate format- and
control-related source files still parse correctly, despite the YAML 1.2
directive at the beginning. Still, given that we don't use any feature
of YAML 1.2, and that the tuning data files now use YAML 1.1, switch the
internal YAML files to version 1.1 as well for consistency.

The main drawback of YAML 1.1 is that the unquoted literal strings Yes,
No, On and Off will be parsed as booleans. We need to be careful to
avoid those values in YAML files, until libcamera can switch to YAML 1.2
once more recent versions of libyaml get shipped by the distributions we
want to support.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/libcamera/control_ids.yaml  | 2 +-
 src/libcamera/formats.yaml      | 2 +-
 src/libcamera/property_ids.yaml | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml
index ecab3ae97260..5510feefdfeb 100644
--- a/src/libcamera/control_ids.yaml
+++ b/src/libcamera/control_ids.yaml
@@ -2,7 +2,7 @@
 #
 # Copyright (C) 2019, Google Inc.
 #
-%YAML 1.2
+%YAML 1.1
 ---
 # Unless otherwise stated, all controls are bi-directional, i.e. they can be
 # set through Request::controls() and returned out through Request::metadata().
diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml
index d3fbf5f47211..e586cde1d705 100644
--- a/src/libcamera/formats.yaml
+++ b/src/libcamera/formats.yaml
@@ -2,7 +2,7 @@
 #
 # Copyright (C) 2020, Google Inc.
 #
-%YAML 1.2
+%YAML 1.1
 ---
 formats:
   - R8:
diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml
index 11b7ebdc3105..cb55e0ed2283 100644
--- a/src/libcamera/property_ids.yaml
+++ b/src/libcamera/property_ids.yaml
@@ -2,7 +2,7 @@
 #
 # Copyright (C) 2019, Google Inc.
 #
-%YAML 1.2
+%YAML 1.1
 ---
 controls:
   - Location:
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list