[{"id":32564,"web_url":"https://patchwork.libcamera.org/comment/32564/","msgid":"<20241206024113.GA25902@pendragon.ideasonboard.com>","date":"2024-12-06T02:41:13","subject":"Re: [PATCH v5 02/15] yaml: Move yaml_parser.cpp to base","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Milan,\n\nThank you for the patch.\n\nOn Tue, Oct 01, 2024 at 12:27:54PM +0200, Milan Zamazal wrote:\n> Global configuration, which uses the YAML parser, will be in base.  Thus\n> YAML parser must be moved to base too.\n\nThe global configuration file seems quite specific to libcamera to me.\nWhy do you think it should be in base ? Is that maybe because we haven't\nreally defined what base is ?\n\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>  src/libcamera/base/meson.build           | 14 ++++++++++++++\n>  src/libcamera/{ => base}/yaml_parser.cpp |  0\n>  src/libcamera/meson.build                | 14 --------------\n>  3 files changed, 14 insertions(+), 14 deletions(-)\n>  rename src/libcamera/{ => base}/yaml_parser.cpp (100%)\n> \n> diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build\n> index a742dfdfe..94843eb95 100644\n> --- a/src/libcamera/base/meson.build\n> +++ b/src/libcamera/base/meson.build\n> @@ -24,10 +24,12 @@ libcamera_base_internal_sources = files([\n>      'thread.cpp',\n>      'timer.cpp',\n>      'utils.cpp',\n> +    'yaml_parser.cpp',\n>  ])\n>  \n>  libdw = dependency('libdw', required : false)\n>  libunwind = dependency('libunwind', required : false)\n> +libyaml = dependency('yaml-0.1', required : false)\n>  \n>  if cc.has_header_symbol('execinfo.h', 'backtrace')\n>      config_h.set('HAVE_BACKTRACE', 1)\n> @@ -41,11 +43,23 @@ if libunwind.found()\n>      config_h.set('HAVE_UNWIND', 1)\n>  endif\n>  \n> +# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.\n> +if not libyaml.found()\n> +    cmake = import('cmake')\n> +\n> +    libyaml_vars = cmake.subproject_options()\n> +    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})\n> +    libyaml_vars.append_compile_args('c', '-Wno-unused-value')\n> +    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)\n> +    libyaml = libyaml_wrap.dependency('yaml')\n> +endif\n> +\n>  libcamera_base_deps = [\n>      libatomic,\n>      libdw,\n>      libthreads,\n>      libunwind,\n> +    libyaml,\n>  ]\n>  \n>  # Internal components must use the libcamera_base_private dependency to enable\n> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/base/yaml_parser.cpp\n> similarity index 100%\n> rename from src/libcamera/yaml_parser.cpp\n> rename to src/libcamera/base/yaml_parser.cpp\n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index aa9ab0291..736cc496f 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -51,7 +51,6 @@ libcamera_internal_sources = files([\n>      'v4l2_pixelformat.cpp',\n>      'v4l2_subdevice.cpp',\n>      'v4l2_videodevice.cpp',\n> -    'yaml_parser.cpp',\n>  ])\n>  \n>  includes = [\n> @@ -79,7 +78,6 @@ if not cc.has_function('dlopen')\n>      libdl = cc.find_library('dl')\n>  endif\n>  libudev = dependency('libudev', required : get_option('udev'))\n> -libyaml = dependency('yaml-0.1', required : false)\n>  \n>  # Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first.\n>  libcrypto = dependency('gnutls', required : false)\n> @@ -115,17 +113,6 @@ if libudev.found()\n>      ])\n>  endif\n>  \n> -# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.\n> -if not libyaml.found()\n> -    cmake = import('cmake')\n> -\n> -    libyaml_vars = cmake.subproject_options()\n> -    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})\n> -    libyaml_vars.append_compile_args('c', '-Wno-unused-value')\n> -    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)\n> -    libyaml = libyaml_wrap.dependency('yaml')\n> -endif\n> -\n>  control_sources = []\n>  \n>  controls_mode_files = {\n> @@ -185,7 +172,6 @@ libcamera_deps += [\n>      libdl,\n>      liblttng,\n>      libudev,\n> -    libyaml,\n>  ]\n>  \n>  # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DC86FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Dec 2024 02:41:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED38766122;\n\tFri,  6 Dec 2024 03:41:27 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 29102608B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Dec 2024 03:41:26 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CB1EB74C;\n\tFri,  6 Dec 2024 03:40:56 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Nx/s5Y2X\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733452857;\n\tbh=KrmpoySiqgzPHtQK52sVg5so08k6uj2FpWHBYtsSkaM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Nx/s5Y2XTpZjVjqX6jqZSrw6qMor5T0tKeK/VqZs7BuERytXq6RwpAkghwgLy1sDg\n\t9geq9NIspdgqA5efhIHyKdERb8n0eUCC7iieSJvUg21J4IkbaHD6to4aJr0TKpLjZX\n\tFv3W2GWu8XmGjWO5dhwtXAVTqmgaZqaBa1ebb/S0=","Date":"Fri, 6 Dec 2024 04:41:13 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"Re: [PATCH v5 02/15] yaml: Move yaml_parser.cpp to base","Message-ID":"<20241206024113.GA25902@pendragon.ideasonboard.com>","References":"<20241001102810.479285-1-mzamazal@redhat.com>\n\t<20241001102810.479285-3-mzamazal@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241001102810.479285-3-mzamazal@redhat.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":32567,"web_url":"https://patchwork.libcamera.org/comment/32567/","msgid":"<87cyi5xc1k.fsf@redhat.com>","date":"2024-12-06T11:53:43","subject":"Re: [PATCH v5 02/15] yaml: Move yaml_parser.cpp to base","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Laurent,\n\nLaurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> Hi Milan,\n>\n> Thank you for the patch.\n>\n> On Tue, Oct 01, 2024 at 12:27:54PM +0200, Milan Zamazal wrote:\n>> Global configuration, which uses the YAML parser, will be in base.  Thus\n>> YAML parser must be moved to base too.\n>\n> The global configuration file seems quite specific to libcamera to me.\n> Why do you think it should be in base ? \n\nBecause logging is in base and uses the configuration.  If logging\nconfiguration was omitted from the global configuration, the global\nconfiguration could be put elsewhere and also the annoying chicken-egg\nproblem when reading and parsing the configuration while possibly\nlogging about it would be avoided.  But from the user's point of view I\nthink logging should be configurable in the file.\n\n> Is that maybe because we haven't really defined what base is ?\n>\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>  src/libcamera/base/meson.build           | 14 ++++++++++++++\n>>  src/libcamera/{ => base}/yaml_parser.cpp |  0\n>>  src/libcamera/meson.build                | 14 --------------\n>>  3 files changed, 14 insertions(+), 14 deletions(-)\n>>  rename src/libcamera/{ => base}/yaml_parser.cpp (100%)\n>> \n>> diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build\n>> index a742dfdfe..94843eb95 100644\n>> --- a/src/libcamera/base/meson.build\n>> +++ b/src/libcamera/base/meson.build\n>> @@ -24,10 +24,12 @@ libcamera_base_internal_sources = files([\n>>      'thread.cpp',\n>>      'timer.cpp',\n>>      'utils.cpp',\n>> +    'yaml_parser.cpp',\n>>  ])\n>>  \n>>  libdw = dependency('libdw', required : false)\n>>  libunwind = dependency('libunwind', required : false)\n>> +libyaml = dependency('yaml-0.1', required : false)\n>>  \n>>  if cc.has_header_symbol('execinfo.h', 'backtrace')\n>>      config_h.set('HAVE_BACKTRACE', 1)\n>> @@ -41,11 +43,23 @@ if libunwind.found()\n>>      config_h.set('HAVE_UNWIND', 1)\n>>  endif\n>>  \n>> +# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.\n>> +if not libyaml.found()\n>> +    cmake = import('cmake')\n>> +\n>> +    libyaml_vars = cmake.subproject_options()\n>> +    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})\n>> +    libyaml_vars.append_compile_args('c', '-Wno-unused-value')\n>> +    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)\n>> +    libyaml = libyaml_wrap.dependency('yaml')\n>> +endif\n>> +\n>>  libcamera_base_deps = [\n>>      libatomic,\n>>      libdw,\n>>      libthreads,\n>>      libunwind,\n>> +    libyaml,\n>>  ]\n>>  \n>>  # Internal components must use the libcamera_base_private dependency to enable\n>> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/base/yaml_parser.cpp\n>> similarity index 100%\n>> rename from src/libcamera/yaml_parser.cpp\n>> rename to src/libcamera/base/yaml_parser.cpp\n>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n>> index aa9ab0291..736cc496f 100644\n>> --- a/src/libcamera/meson.build\n>> +++ b/src/libcamera/meson.build\n>> @@ -51,7 +51,6 @@ libcamera_internal_sources = files([\n>>      'v4l2_pixelformat.cpp',\n>>      'v4l2_subdevice.cpp',\n>>      'v4l2_videodevice.cpp',\n>> -    'yaml_parser.cpp',\n>>  ])\n>>  \n>>  includes = [\n>> @@ -79,7 +78,6 @@ if not cc.has_function('dlopen')\n>>      libdl = cc.find_library('dl')\n>>  endif\n>>  libudev = dependency('libudev', required : get_option('udev'))\n>> -libyaml = dependency('yaml-0.1', required : false)\n>>  \n>>  # Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first.\n>>  libcrypto = dependency('gnutls', required : false)\n>> @@ -115,17 +113,6 @@ if libudev.found()\n>>      ])\n>>  endif\n>>  \n>> -# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.\n>> -if not libyaml.found()\n>> -    cmake = import('cmake')\n>> -\n>> -    libyaml_vars = cmake.subproject_options()\n>> -    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})\n>> -    libyaml_vars.append_compile_args('c', '-Wno-unused-value')\n>> -    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)\n>> -    libyaml = libyaml_wrap.dependency('yaml')\n>> -endif\n>> -\n>>  control_sources = []\n>>  \n>>  controls_mode_files = {\n>> @@ -185,7 +172,6 @@ libcamera_deps += [\n>>      libdl,\n>>      liblttng,\n>>      libudev,\n>> -    libyaml,\n>>  ]\n>>  \n>>  # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 433EBBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Dec 2024 11:53:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6A6686612E;\n\tFri,  6 Dec 2024 12:53:51 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D1CA618B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Dec 2024 12:53:49 +0100 (CET)","from mail-wm1-f71.google.com (mail-wm1-f71.google.com\n\t[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-262-EQ-lGGRAOnaLlmPNU7z8fg-1; Fri, 06 Dec 2024 06:53:46 -0500","by mail-wm1-f71.google.com with SMTP id\n\t5b1f17b1804b1-434a6483514so299095e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 06 Dec 2024 03:53:46 -0800 (PST)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-434da11935asm55384415e9.37.2024.12.06.03.53.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 06 Dec 2024 03:53:44 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"SZBFaL/B\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1733486028;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=tOv8ka0y/n96lPne6Rwf0uREK1VwYrXOtSjk8FTPoAo=;\n\tb=SZBFaL/Bd0ZwSSVw4EUKyCvmDjPAOsXhlyCxpBBSPhLSPW7nw+SitpLaOhiPKjbFljJtcs\n\t5uW/IsRojWDU6P4kMeDMWV4VdeP/lQjdX3qYxIZNM7BmcGllpkwvak2IizN/Q99Yljon30\n\tOfwSTBFXkmcAVRb5TZI+mLImQuwa8R0=","X-MC-Unique":"EQ-lGGRAOnaLlmPNU7z8fg-1","X-Mimecast-MFC-AGG-ID":"EQ-lGGRAOnaLlmPNU7z8fg","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1733486025; x=1734090825;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=tOv8ka0y/n96lPne6Rwf0uREK1VwYrXOtSjk8FTPoAo=;\n\tb=pMIXM7xPh5NtY+JLAbc/kgFrJqtHJmCiRSHtZrTLR0BlwXK/cHyQsvkahuCJYz1fjw\n\te7pyFyc5QDC17PoPa97kbs3JfygmXf9s5TUEt8cnULAAItfLtwonyTqm1jGzdJ7Q2BC1\n\tqnahMIVYmTSXxBfQt5S7stp3V/P5vUs1lZwjFzo0s2KZAX9POX7Wpi+/Oc4aMWKG+ohN\n\thvFBc3d83mQPPw4kiO7EKoqKmBXSk79Oiuqh9VjWh4/fzb/JJLJb0ri+9nVlIyhslFMd\n\tDkMeN4A9hW0zVTifMp/v+X825pFkUAISXUfofyVQezNpi7efhonxkQNXuzVVnFzs7UD6\n\txnEg==","X-Gm-Message-State":"AOJu0Ywsb9lKdaIvbJTZ2Pm32F6AHTc26g3eErVDfz6UFe1aXI2oD4vg\n\thImr1gJu4JQltr+rJKWeDEkCUoTrq53JaagDG+29OhciAs2TRMUHBh9lS4s6LFKNQYxp+nCugrl\n\t77H+6474K6mtDG3GG0Fhjl1Y34+6GMtmjAEs4DdiRs+BPNAssXOdG2OK2hv1hBVojADasmX5N2v\n\t9r2Bs=","X-Gm-Gg":"ASbGncvNkqd4zvxC8xFU+rXnqKuqD9i08LzgK/IN/vRJgyrnH8+uz7iBCHAy7OTWl4H\n\tdnkD5Uwoo0mDt0LwLCOtfkHD/IEsvOPJVymRyaAhZF4NiLtPpHEfqob9Txjr0bLE5zHzSIC3gWg\n\tlhR0a2rGM4wzv8987vk2OkU9pp4q9MGhod+/ImHOfw3mdqNk7K2h5PTxtVmPPjMukyNBywAltCc\n\t584LK0Ips6Sgp4RXs6Q3j5U0sLboqYNiqZ8DiVcE3T1WssM+bLBSgk4wwNm9ei1v/LCNF4=","X-Received":["by 2002:a05:600c:3145:b0:42c:bb96:340e with SMTP id\n\t5b1f17b1804b1-434ddedbad1mr26109385e9.31.1733486024961; \n\tFri, 06 Dec 2024 03:53:44 -0800 (PST)","by 2002:a05:600c:3145:b0:42c:bb96:340e with SMTP id\n\t5b1f17b1804b1-434ddedbad1mr26109275e9.31.1733486024618; \n\tFri, 06 Dec 2024 03:53:44 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IHfmWEmS9W3vgSJtihqUrvVCse+lpouDo3jTNuADsSnmgFfXvTirCPMXbnzU48PmAFn53d3pg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, Naushir Patuck <naush@raspberrypi.com>","Subject":"Re: [PATCH v5 02/15] yaml: Move yaml_parser.cpp to base","In-Reply-To":"<20241206024113.GA25902@pendragon.ideasonboard.com> (Laurent\n\tPinchart's message of \"Fri, 6 Dec 2024 04:41:13 +0200\")","References":"<20241001102810.479285-1-mzamazal@redhat.com>\n\t<20241001102810.479285-3-mzamazal@redhat.com>\n\t<20241206024113.GA25902@pendragon.ideasonboard.com>","Date":"Fri, 06 Dec 2024 12:53:43 +0100","Message-ID":"<87cyi5xc1k.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"iKzPr3fOP3GEThbxSxnS_pAg1kEZgvsLoTuTL-HcHs8_1733486025","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":32568,"web_url":"https://patchwork.libcamera.org/comment/32568/","msgid":"<20241206120314.GD25902@pendragon.ideasonboard.com>","date":"2024-12-06T12:03:14","subject":"Re: [PATCH v5 02/15] yaml: Move yaml_parser.cpp to base","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Dec 06, 2024 at 12:53:43PM +0100, Milan Zamazal wrote:\n> Laurent Pinchart writes:\n> > On Tue, Oct 01, 2024 at 12:27:54PM +0200, Milan Zamazal wrote:\n> >> Global configuration, which uses the YAML parser, will be in base.  Thus\n> >> YAML parser must be moved to base too.\n> >\n> > The global configuration file seems quite specific to libcamera to me.\n> > Why do you think it should be in base ? \n> \n> Because logging is in base and uses the configuration.  If logging\n> configuration was omitted from the global configuration, the global\n> configuration could be put elsewhere and also the annoying chicken-egg\n> problem when reading and parsing the configuration while possibly\n> logging about it would be avoided.  But from the user's point of view I\n> think logging should be configurable in the file.\n\nThanks for the explanation. I'll have a look at that.\n\n> > Is that maybe because we haven't really defined what base is ?\n> >\n> >> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> >> ---\n> >>  src/libcamera/base/meson.build           | 14 ++++++++++++++\n> >>  src/libcamera/{ => base}/yaml_parser.cpp |  0\n> >>  src/libcamera/meson.build                | 14 --------------\n> >>  3 files changed, 14 insertions(+), 14 deletions(-)\n> >>  rename src/libcamera/{ => base}/yaml_parser.cpp (100%)\n> >> \n> >> diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build\n> >> index a742dfdfe..94843eb95 100644\n> >> --- a/src/libcamera/base/meson.build\n> >> +++ b/src/libcamera/base/meson.build\n> >> @@ -24,10 +24,12 @@ libcamera_base_internal_sources = files([\n> >>      'thread.cpp',\n> >>      'timer.cpp',\n> >>      'utils.cpp',\n> >> +    'yaml_parser.cpp',\n> >>  ])\n> >>  \n> >>  libdw = dependency('libdw', required : false)\n> >>  libunwind = dependency('libunwind', required : false)\n> >> +libyaml = dependency('yaml-0.1', required : false)\n> >>  \n> >>  if cc.has_header_symbol('execinfo.h', 'backtrace')\n> >>      config_h.set('HAVE_BACKTRACE', 1)\n> >> @@ -41,11 +43,23 @@ if libunwind.found()\n> >>      config_h.set('HAVE_UNWIND', 1)\n> >>  endif\n> >>  \n> >> +# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.\n> >> +if not libyaml.found()\n> >> +    cmake = import('cmake')\n> >> +\n> >> +    libyaml_vars = cmake.subproject_options()\n> >> +    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})\n> >> +    libyaml_vars.append_compile_args('c', '-Wno-unused-value')\n> >> +    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)\n> >> +    libyaml = libyaml_wrap.dependency('yaml')\n> >> +endif\n> >> +\n> >>  libcamera_base_deps = [\n> >>      libatomic,\n> >>      libdw,\n> >>      libthreads,\n> >>      libunwind,\n> >> +    libyaml,\n> >>  ]\n> >>  \n> >>  # Internal components must use the libcamera_base_private dependency to enable\n> >> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/base/yaml_parser.cpp\n> >> similarity index 100%\n> >> rename from src/libcamera/yaml_parser.cpp\n> >> rename to src/libcamera/base/yaml_parser.cpp\n> >> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> >> index aa9ab0291..736cc496f 100644\n> >> --- a/src/libcamera/meson.build\n> >> +++ b/src/libcamera/meson.build\n> >> @@ -51,7 +51,6 @@ libcamera_internal_sources = files([\n> >>      'v4l2_pixelformat.cpp',\n> >>      'v4l2_subdevice.cpp',\n> >>      'v4l2_videodevice.cpp',\n> >> -    'yaml_parser.cpp',\n> >>  ])\n> >>  \n> >>  includes = [\n> >> @@ -79,7 +78,6 @@ if not cc.has_function('dlopen')\n> >>      libdl = cc.find_library('dl')\n> >>  endif\n> >>  libudev = dependency('libudev', required : get_option('udev'))\n> >> -libyaml = dependency('yaml-0.1', required : false)\n> >>  \n> >>  # Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first.\n> >>  libcrypto = dependency('gnutls', required : false)\n> >> @@ -115,17 +113,6 @@ if libudev.found()\n> >>      ])\n> >>  endif\n> >>  \n> >> -# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.\n> >> -if not libyaml.found()\n> >> -    cmake = import('cmake')\n> >> -\n> >> -    libyaml_vars = cmake.subproject_options()\n> >> -    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})\n> >> -    libyaml_vars.append_compile_args('c', '-Wno-unused-value')\n> >> -    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)\n> >> -    libyaml = libyaml_wrap.dependency('yaml')\n> >> -endif\n> >> -\n> >>  control_sources = []\n> >>  \n> >>  controls_mode_files = {\n> >> @@ -185,7 +172,6 @@ libcamera_deps += [\n> >>      libdl,\n> >>      liblttng,\n> >>      libudev,\n> >> -    libyaml,\n> >>  ]\n> >>  \n> >>  # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8C720BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Dec 2024 12:03:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BAC2D6612E;\n\tFri,  6 Dec 2024 13:03:29 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 760C1618B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Dec 2024 13:03:28 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B133074C;\n\tFri,  6 Dec 2024 13:02:58 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Qyi1MaAY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733486578;\n\tbh=/emCSMGz8BhjTlh69pDAO2oCD2wyUhTlsBvGTVUpdOk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Qyi1MaAYvtYIxThfOxcQLXDne06gRgjNTlDdGudWNbnctXwD2mr1bBpL5v/2nM1eW\n\tH9dfUiDH+Kn8scQaAePgc2/C4XAXl2Fb1z8s4wx4ItY72Gh+PlxcWA8DpBJLFZk5fx\n\t+KGjqDBSQw+hQcR31hod1MAN8xXhTLzMaC6IOW3s=","Date":"Fri, 6 Dec 2024 14:03:14 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"Re: [PATCH v5 02/15] yaml: Move yaml_parser.cpp to base","Message-ID":"<20241206120314.GD25902@pendragon.ideasonboard.com>","References":"<20241001102810.479285-1-mzamazal@redhat.com>\n\t<20241001102810.479285-3-mzamazal@redhat.com>\n\t<20241206024113.GA25902@pendragon.ideasonboard.com>\n\t<87cyi5xc1k.fsf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<87cyi5xc1k.fsf@redhat.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]