[{"id":34864,"web_url":"https://patchwork.libcamera.org/comment/34864/","msgid":"<1c5f5700-223b-4955-8e89-712d0c85c692@ideasonboard.com>","date":"2025-07-11T15:28:38","subject":"Re: [PATCH v12 12/12] config: Make configuration directories\n\tconfigurable","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 07. 02. 15:10 keltezéssel, Milan Zamazal írta:\n> A newly introduced LIBCAMERA_CONFIG_DIR environment variable specifies a\n> directory or a list of directories separated by colons where to look for\n> the libcamera configuration file before trying the standard locations.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>   Documentation/runtime_configuration.rst |  5 +++++\n>   src/libcamera/global_configuration.cpp  | 16 +++++++++++-----\n>   2 files changed, 16 insertions(+), 5 deletions(-)\n> \n> diff --git a/Documentation/runtime_configuration.rst b/Documentation/runtime_configuration.rst\n> index 5648db7d7..3146cdba6 100644\n> --- a/Documentation/runtime_configuration.rst\n> +++ b/Documentation/runtime_configuration.rst\n> @@ -19,6 +19,11 @@ order:\n>   - LIBCAMERA_SYSCONF_DIR/configuration.yaml\n>   - /etc/libcamera/configuration.yaml\n>   \n> +If LIBCAMERA_CONFIG_DIR environment variable is non-empty then it\n> +specifies additional directories where to look for the configuration\n> +file, before looking at the standard locations. It can be a single\n> +directory or multiple directories separated by colons.\n> +\n>   The default name of the configuration file, configuration.yaml, can be\n>   overridden in LIBCAMERA_CONFIG_NAME environment variable. The variable\n>   can specify just an alternative configuration file name to be looked up\n> diff --git a/src/libcamera/global_configuration.cpp b/src/libcamera/global_configuration.cpp\n> index efc293422..13305f8c0 100644\n> --- a/src/libcamera/global_configuration.cpp\n> +++ b/src/libcamera/global_configuration.cpp\n> @@ -67,11 +67,6 @@ bool GlobalConfiguration::loadFile(const std::filesystem::path &fileName)\n>   \n>   bool GlobalConfiguration::load()\n>   {\n> -\tconst std::vector<std::filesystem::path> globalConfigurationDirectories = {\n> -\t\tstd::filesystem::path(LIBCAMERA_SYSCONF_DIR),\n> -\t\tstd::filesystem::path(LIBCAMERA_DATA_DIR),\n> -\t};\n> -\n>   \tconst char *libcameraConfigName =\n>   \t\tutils::secure_getenv(\"LIBCAMERA_CONFIG_NAME\");\n>   \tif (!libcameraConfigName)\n> @@ -86,6 +81,17 @@ bool GlobalConfiguration::load()\n>   \tif (configName.empty())\n>   \t\tconfigName = std::filesystem::path(\"configuration.yaml\");\n>   \n> +\tconst char *configDir = utils::secure_getenv(\"LIBCAMERA_CONFIG_DIR\");\n> +\tstd::vector<std::filesystem::path> globalConfigurationDirectories;\n> +\tif (configDir) {\n> +\t\tfor (auto const &path : utils::split(configDir, \":\")) {\n> +\t\t\tif (!path.empty())\n> +\t\t\t\tglobalConfigurationDirectories.push_back(path);\n> +\t\t}\n> +\t}\n> +\tglobalConfigurationDirectories.push_back(LIBCAMERA_SYSCONF_DIR);\n> +\tglobalConfigurationDirectories.push_back(LIBCAMERA_DATA_DIR);\n> +\n>   \tstd::filesystem::path userConfigurationDirectory;\n>   \tconst char *xdgConfigHome = utils::secure_getenv(\"XDG_CONFIG_HOME\");\n>   \tif (xdgConfigHome) {\n\n\n`userConfigurationDirectory` will always have priority. Could you add it to\n`globalConfigurationDirectories` (and maybe rename it to configDirs or such)\nbefore `LIBCAMERA_SYSCONF_DIR` is added? So that things in $LIBCAMERA_CONFIG_DIR\nare always examined first.\n\n\nRegards,\nBarnabás Pőcze","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 4E779C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Jul 2025 15:28:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EFE1B68F1A;\n\tFri, 11 Jul 2025 17:28:40 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D3F2468F15\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Jul 2025 17:28:38 +0200 (CEST)","from [192.168.33.21] (185.221.140.39.nat.pool.zt.hu\n\t[185.221.140.39])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D96C73DC;\n\tFri, 11 Jul 2025 17:28:08 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"JcFJFfFi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752247689;\n\tbh=pNSQ62oClr47oFYUlcesxf3FvQXyRq4mqv7u1W/weqs=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=JcFJFfFi4wG/dHfmbGk9GteX0BwMrJgkC95AHxr/d8pR81ieYNxG+XQx+odbJw/rr\n\ts0RW2Cc4K90P5VCDO2BNCXbXs+asokgv7dmCOWFMnet74+MPvs1QaWgT/8VyVwC4xo\n\tNLxmXGovDCdVP0+mvFy6ZsMzUGL2dyRFas8oYgrI=","Message-ID":"<1c5f5700-223b-4955-8e89-712d0c85c692@ideasonboard.com>","Date":"Fri, 11 Jul 2025 17:28:38 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v12 12/12] config: Make configuration directories\n\tconfigurable","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20250702131032.47654-1-mzamazal@redhat.com>\n\t<20250702131032.47654-13-mzamazal@redhat.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250702131032.47654-13-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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":34869,"web_url":"https://patchwork.libcamera.org/comment/34869/","msgid":"<85wm8ebnkp.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-07-11T18:16:06","subject":"Re: [PATCH v12 12/12] config: Make configuration directories\n\tconfigurable","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Barnabás,\n\nthank you for review.\n\nBarnabás Pőcze <barnabas.pocze@ideasonboard.com> writes:\n\n> Hi\n>\n> 2025. 07. 02. 15:10 keltezéssel, Milan Zamazal írta:\n>> A newly introduced LIBCAMERA_CONFIG_DIR environment variable specifies a\n>> directory or a list of directories separated by colons where to look for\n>> the libcamera configuration file before trying the standard locations.\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>   Documentation/runtime_configuration.rst |  5 +++++\n>>   src/libcamera/global_configuration.cpp  | 16 +++++++++++-----\n>>   2 files changed, 16 insertions(+), 5 deletions(-)\n>> diff --git a/Documentation/runtime_configuration.rst b/Documentation/runtime_configuration.rst\n>> index 5648db7d7..3146cdba6 100644\n>> --- a/Documentation/runtime_configuration.rst\n>> +++ b/Documentation/runtime_configuration.rst\n>> @@ -19,6 +19,11 @@ order:\n>>   - LIBCAMERA_SYSCONF_DIR/configuration.yaml\n>>   - /etc/libcamera/configuration.yaml\n>>   +If LIBCAMERA_CONFIG_DIR environment variable is non-empty then it\n>> +specifies additional directories where to look for the configuration\n>> +file, before looking at the standard locations. It can be a single\n>> +directory or multiple directories separated by colons.\n>> +\n>>   The default name of the configuration file, configuration.yaml, can be\n>>   overridden in LIBCAMERA_CONFIG_NAME environment variable. The variable\n>>   can specify just an alternative configuration file name to be looked up\n>> diff --git a/src/libcamera/global_configuration.cpp b/src/libcamera/global_configuration.cpp\n>> index efc293422..13305f8c0 100644\n>> --- a/src/libcamera/global_configuration.cpp\n>> +++ b/src/libcamera/global_configuration.cpp\n>> @@ -67,11 +67,6 @@ bool GlobalConfiguration::loadFile(const std::filesystem::path &fileName)\n>>     bool GlobalConfiguration::load()\n>>   {\n>> -\tconst std::vector<std::filesystem::path> globalConfigurationDirectories = {\n>> -\t\tstd::filesystem::path(LIBCAMERA_SYSCONF_DIR),\n>> -\t\tstd::filesystem::path(LIBCAMERA_DATA_DIR),\n>> -\t};\n>> -\n>>   \tconst char *libcameraConfigName =\n>>   \t\tutils::secure_getenv(\"LIBCAMERA_CONFIG_NAME\");\n>>   \tif (!libcameraConfigName)\n>> @@ -86,6 +81,17 @@ bool GlobalConfiguration::load()\n>>   \tif (configName.empty())\n>>   \t\tconfigName = std::filesystem::path(\"configuration.yaml\");\n>>   +\tconst char *configDir = utils::secure_getenv(\"LIBCAMERA_CONFIG_DIR\");\n>> +\tstd::vector<std::filesystem::path> globalConfigurationDirectories;\n>> +\tif (configDir) {\n>> +\t\tfor (auto const &path : utils::split(configDir, \":\")) {\n>> +\t\t\tif (!path.empty())\n>> +\t\t\t\tglobalConfigurationDirectories.push_back(path);\n>> +\t\t}\n>> +\t}\n>> +\tglobalConfigurationDirectories.push_back(LIBCAMERA_SYSCONF_DIR);\n>> +\tglobalConfigurationDirectories.push_back(LIBCAMERA_DATA_DIR);\n>> +\n>>   \tstd::filesystem::path userConfigurationDirectory;\n>>   \tconst char *xdgConfigHome = utils::secure_getenv(\"XDG_CONFIG_HOME\");\n>>   \tif (xdgConfigHome) {\n>\n>\n> `userConfigurationDirectory` will always have priority. Could you add it to\n> `globalConfigurationDirectories` (and maybe rename it to configDirs or such)\n> before `LIBCAMERA_SYSCONF_DIR` is added? So that things in $LIBCAMERA_CONFIG_DIR\n> are always examined first.\n\nOK, will do.\n\n> Regards,\n> Barnabás Pőcze","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 B4057C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Jul 2025 18:16:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DDC9268F1E;\n\tFri, 11 Jul 2025 20:16:14 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A46068E30\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Jul 2025 20:16:13 +0200 (CEST)","from mail-wm1-f69.google.com (mail-wm1-f69.google.com\n\t[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-235-jf32QT8QObC7gbX07luU9A-1; Fri, 11 Jul 2025 14:16:09 -0400","by mail-wm1-f69.google.com with SMTP id\n\t5b1f17b1804b1-455e9e09afeso4093455e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Jul 2025 11:16:09 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-454dd540a95sm53929705e9.29.2025.07.11.11.16.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 11 Jul 2025 11:16:07 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"CWjFwwca\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1752257772;\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\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=sufLFe00owQ/nqasbM8NjF/IP1zWQT5PXvtPXZqGkE0=;\n\tb=CWjFwwcazrTpCypZ10jZ07VUioe2XszbWcoAl3aboL/3Pm2/bsD+RtvBwSgwYUlDo7UDxv\n\tESGDJoIFEKF8YIqbSthNQOUDYj406tiglSvPjBEHk11JLdwlRfflKFvENPWl160dL+Jszm\n\tLTMLIl+aiC0dNrwiyUpeC2Yjqb+3DLc=","X-MC-Unique":"jf32QT8QObC7gbX07luU9A-1","X-Mimecast-MFC-AGG-ID":"jf32QT8QObC7gbX07luU9A_1752257768","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1752257768; x=1752862568;\n\th=content-transfer-encoding:mime-version:user-agent:message-id:date\n\t:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=9CLmkvX8II43RLTcbvvwstVgKlJA/1kRaqpjT81Is/4=;\n\tb=MKkBrTyAA+WH8w/fJOwiRReBqf6ckBs5mGbfdttojuiju2GaeMAAh6LOsmw8FQBJyu\n\tNPj2hLRsyShFIHxoTShkAgC2lBZt4DD4wMFrR69MJbWH1P37obk4+p4eZ9T/XT+JjtMc\n\tQbXU8C+UJqQqLZHq2lG0ZWhoJjAhW2RAKsuXn0/uBkiObO+1RJmmoJXwnYIWlCOVb3OW\n\tQjlXfxs5OE2BFYy7DyDxUdqpIAD1xtIvvoDRJUefjNjyQbmjCpEgdygz0gZr7zrDIDJ4\n\tOeU8SpqOOSosfJ+kWAo/C88EDts6wx9NCuSSMYl4HFs7iWtVUHDu0PUHyRFRZ6La7n4R\n\ttYaw==","X-Gm-Message-State":"AOJu0YwtAQDEUdAM4ydimKSWlV9xYJu/C532fpSlNEyW61nyCxZukfuG\n\tzUtp+RQEbaSxEWkXM+BzKtXxeCmJvuCekEnOLvS4AhxfaljzvfN1oM4F9CxkCDRi1WCdIizuMT7\n\t0j/ifuZa7kbx2j9VPMdjTnceyV/aRX4jBkg0h8Scc7c/PHd639tWjnFk4z6hLbaxqFOdBONpC0J\n\to=","X-Gm-Gg":"ASbGnctNfgDlgpj0WbPNQS77dhwGoNmoh10EKr8+rhgRZdWRjLXbu2Qhg8FnayFiAEl\n\tDiSlgAhL0ZafovgliT2/kQNnvhMlYlRs7s4oW5/PkSBtvXITekMsO304Mz7rg4RKthHn0r22osE\n\tU5CS2VVTwSbcxscB9ObhyGNex4wqDMrQ4cXja2uyFK74WklQI5U4XwZs9N8ji0gB9KcYLiLzaaV\n\tCKZ+ZKTrTu64wCUKUjwoVQM//oP5pf8DqYZTZr/P++5V6QVQ9OpLNOxUPud+5i2JMqTSGWlBaDp\n\tGQyuyEfTLzDftNmB+YWMHRosNeFm5B3v+lX0pByuj691bonYm+1oJijOZdDi0eFzW1ouAoptich\n\tKMAazIg/HmXh/rgDc","X-Received":["by 2002:a05:600c:8483:b0:43d:563:6fef with SMTP id\n\t5b1f17b1804b1-455bd879b86mr29740245e9.21.1752257768178; \n\tFri, 11 Jul 2025 11:16:08 -0700 (PDT)","by 2002:a05:600c:8483:b0:43d:563:6fef with SMTP id\n\t5b1f17b1804b1-455bd879b86mr29740055e9.21.1752257767768; \n\tFri, 11 Jul 2025 11:16:07 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IEjCRIkWmwl0fquDt37CAng6wPdg6YFbqJImBnaeVPaDRPX5XRZyTcee39EI7dNnBKOYlhkxA==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>,  Laurent Pinchart\n\t<laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH v12 12/12] config: Make configuration directories\n\tconfigurable","In-Reply-To":"<1c5f5700-223b-4955-8e89-712d0c85c692@ideasonboard.com> (\n\t=?utf-8?b?IkJhcm5hYsOhcyBQxZFjemUiJ3M=?= message of \"Fri,\n\t11 Jul 2025  17:28:38 +0200\")","References":"<20250702131032.47654-1-mzamazal@redhat.com>\n\t<20250702131032.47654-13-mzamazal@redhat.com>\n\t<1c5f5700-223b-4955-8e89-712d0c85c692@ideasonboard.com>","Date":"Fri, 11 Jul 2025 20:16:06 +0200","Message-ID":"<85wm8ebnkp.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"VBKtryK9mk0p1d6fvX08f72LekLk3hl83tN7om7dmBs_1752257768","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>"}}]