Re: [PATCH 1/2] scripts: add TOML config to container tool

Nicolas Schier <[email protected]>
Newsgroups gmane.linux.kernel.workflows,gmane.linux.documentation,gmane.linux.kernel,gmane.linux.kbuild.devel
Message-ID <apG3hwaPA8f7SJeI@levanger>
On Mon, Aug 24, 2026 at 12:05:47PM +0200, Guillaume Tucker wrote:
> Add support for a TOML configuration file to the scripts/container
> tool.  This improves user experience by not having to keep passing the
> same command line options all the time or overly relying on built-in
> default values.  Include the concept of 'profiles' with different
> named sections in the file to cover various use cases.
> 
> Command line options take precedence over the config file, and values
> defined in profile sections take precedence over the default one.
> 
> Add a -c option to override the location of the .container.toml config
> file which should otherwise be located in the current working
> directory.  If not found, the file is silently ignored as it is not
> strictly required unless the -c option is used.
> 
> Add a -p option to choose a particular profile section in the config
> file rather than the default.
> 
> Signed-off-by: Guillaume Tucker <[email protected]>
> ---
>  scripts/container | 81 ++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 70 insertions(+), 11 deletions(-)
> 
> diff --git a/scripts/container b/scripts/container
> index b05333d8530b..cf126fa13510 100755
> --- a/scripts/container
> +++ b/scripts/container
> @@ -1,17 +1,19 @@
>  #!/usr/bin/env python3
>  # SPDX-License-Identifier: GPL-2.0-only
> -# Copyright (C) 2025 Guillaume Tucker
> +# Copyright (C) 2025-2026 Guillaume Tucker
>  
>  """Containerized builds"""
>  
>  import abc
>  import argparse
> +import dataclasses
>  import logging
>  import os
>  import pathlib
>  import shutil
>  import subprocess
>  import sys
> +import tomllib

Have you seen the comment from sashiko?

| Will this unconditional import of tomllib crash the script on startup for
| users running supported Python versions like 3.9 and 3.10?
| The kernel's baseline requirement allows Python 3.9.x, but tomllib is only
| available starting in Python 3.11.

https://sashiko.dev/#/patchset/15e16f175f59ae666036764eb03c40cdf19809c7.1787896890.git.gtucker@gtucker.io

(and there are some others...)

Kind regards,
Nicolas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.