All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Buildroot List <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH v2 2/5] utils/genrandconfig: remove support for toolchain CSV
Date: Sun, 18 Aug 2024 12:13:54 +0200	[thread overview]
Message-ID: <ZsHJYituMwcHRyBg@landeda> (raw)
In-Reply-To: <20240818090346.947914-3-thomas.petazzoni@bootlin.com>

Thomas, All,

On 2024-08-18 11:03 +0200, Thomas Petazzoni via buildroot spake thusly:
> Now that the support for generating a fully random configuration has
> been well-tested, the whole mechanism based on a toolchain CSV isn't
> really useful anymore, so let's drop it to simplify the logic.

As discussed on IRC, the autobuilder code still uses
--{,no-}toolchains-csv, so dopping those flags would instaly break the
autobuilders.

So, I've kept them and docuemnted them to be legacy.

Applied to master, thanks.

Regards,
Yann E. MORIN.

> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  utils/genrandconfig | 99 +--------------------------------------------
>  1 file changed, 2 insertions(+), 97 deletions(-)
> 
> diff --git a/utils/genrandconfig b/utils/genrandconfig
> index cefc3dca12..ee094824fd 100755
> --- a/utils/genrandconfig
> +++ b/utils/genrandconfig
> @@ -20,7 +20,6 @@
>  
>  from binascii import hexlify
>  import asyncio
> -import csv
>  import os
>  from random import randint
>  import sys
> @@ -100,73 +99,6 @@ class SystemInfo:
>          return not missing_requirements
>  
>  
> -def get_toolchain_configs(toolchains_csv, buildrootdir):
> -    """Fetch and return the possible toolchain configurations
> -
> -    This function returns an array of toolchain configurations. Each
> -    toolchain configuration is itself an array of lines of the defconfig.
> -    """
> -
> -    with open(toolchains_csv) as r:
> -        # filter empty lines and comments
> -        lines = [t for t in r.readlines() if len(t.strip()) > 0 and t[0] != '#']
> -        toolchains = lines
> -    configs = []
> -
> -    (_, _, _, _, hostarch) = os.uname()
> -    # ~2015 distros report x86 when on a 32bit install
> -    if hostarch == 'i686' or hostarch == 'i386' or hostarch == 'x86':
> -        hostarch = 'x86'
> -
> -    for row in csv.reader(toolchains):
> -        config = {}
> -        configfile = row[0]
> -        config_hostarch = row[1]
> -        keep = False
> -
> -        # Keep all toolchain configs that work regardless of the host
> -        # architecture
> -        if config_hostarch == "any":
> -            keep = True
> -
> -        # Keep all toolchain configs that can work on the current host
> -        # architecture
> -        if hostarch == config_hostarch:
> -            keep = True
> -
> -        # Assume that x86 32 bits toolchains work on x86_64 build
> -        # machines
> -        if hostarch == 'x86_64' and config_hostarch == "x86":
> -            keep = True
> -
> -        if not keep:
> -            continue
> -
> -        if not os.path.isabs(configfile):
> -            configfile = os.path.join(buildrootdir, configfile)
> -
> -        with open(configfile) as r:
> -            config = r.readlines()
> -        configs.append(config)
> -    return configs
> -
> -
> -async def is_toolchain_usable(configfile, config):
> -    """Check if the toolchain is actually usable."""
> -
> -    with open(configfile) as configf:
> -        configlines = configf.readlines()
> -
> -    # Check that the toolchain configuration is still present
> -    for toolchainline in config:
> -        if toolchainline not in configlines:
> -            print("WARN: toolchain can't be used", file=sys.stderr)
> -            print("      Missing: %s" % toolchainline.strip(), file=sys.stderr)
> -            return False
> -
> -    return True
> -
> -
>  async def fixup_config(sysinfo, configfile):
>      """Finalize the configuration and reject any problematic combinations
>  
> @@ -581,24 +513,11 @@ async def fixup_config(sysinfo, configfile):
>  
>  async def gen_config(args):
>      """Generate a new random configuration
> -
> -    This function generates the configuration, by choosing a random
> -    toolchain configuration and then generating a random selection of
> -    packages.
>      """
>  
>      sysinfo = SystemInfo()
>  
> -    if args.toolchains_csv:
> -        # Select a random toolchain configuration
> -        configs = get_toolchain_configs(args.toolchains_csv, args.buildrootdir)
> -
> -        i = randint(0, len(configs) - 1)
> -        toolchainconfig = configs[i]
> -    else:
> -        toolchainconfig = []
> -
> -    configlines = list(toolchainconfig)
> +    configlines = list()
>  
>      # Combine with the minimal configuration
>      minimalconfigfile = os.path.join(args.buildrootdir,
> @@ -658,9 +577,6 @@ async def gen_config(args):
>      if ret:
>          return ret
>  
> -    if not await is_toolchain_usable(configfile, toolchainconfig):
> -        return 2
> -
>      # Now, generate the random selection of packages, and fixup
>      # things if needed.
>      # Safe-guard, in case we can not quickly come to a valid
> @@ -676,7 +592,7 @@ async def gen_config(args):
>              "make", "O=%s" % args.outputdir, "-C", args.buildrootdir,
>              "KCONFIG_SEED=0x%s" % hexlify(os.urandom(4)).decode("ascii").upper(),
>              "KCONFIG_PROBABILITY=%d" % randint(1, 20),
> -            "randpackageconfig" if args.toolchains_csv else "randconfig")
> +            "randconfig")
>          ret = await proc.wait()
>          if ret:
>              return ret
> @@ -711,17 +627,6 @@ if __name__ == '__main__':
>                          help="Buildroot directory (relative to current directory)",
>                          type=str, default='.')
>  
> -    toolchains_csv = parser.add_mutually_exclusive_group(required=False)
> -    toolchains_csv.add_argument("--toolchains-csv",
> -                                dest="toolchains_csv",
> -                                help="Path of the toolchain configuration file",
> -                                type=str)
> -    toolchains_csv.add_argument("--no-toolchains-csv",
> -                                dest="toolchains_csv",
> -                                help="Generate random toolchain configuration",
> -                                action='store_false')
> -    parser.set_defaults(toolchains_csv="support/config-fragments/autobuild/toolchain-configs.csv")
> -
>      args = parser.parse_args()
>  
>      # We need the absolute path to use with O=, because the relative
> -- 
> 2.46.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-08-18 10:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-18  9:03 [Buildroot] [PATCH v2 0/5] Misc utils/genrandconfig improvements Thomas Petazzoni via buildroot
2024-08-18  9:03 ` [Buildroot] [PATCH v2 1/5] utils/genrandconfig: remove fixups related to untested CT-NG toolchains Thomas Petazzoni via buildroot
2024-08-18  9:03 ` [Buildroot] [PATCH v2 2/5] utils/genrandconfig: remove support for toolchain CSV Thomas Petazzoni via buildroot
2024-08-18 10:13   ` Yann E. MORIN [this message]
2024-08-18  9:03 ` [Buildroot] [PATCH v2 3/5] utils/genrandconfig: rework fine-tuning logic Thomas Petazzoni via buildroot
2024-08-18  9:03 ` [Buildroot] [PATCH v2 4/5] utils/genrandconfig: do not use BR2_BACKUP_SITE for some builds Thomas Petazzoni via buildroot
2024-08-18  9:03 ` [Buildroot] [PATCH v2 5/5] utils/genrandconfig: improve logging Thomas Petazzoni via buildroot
2024-08-18 10:12 ` [Buildroot] [PATCH v2 0/5] Misc utils/genrandconfig improvements Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZsHJYituMwcHRyBg@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.