[PATCH v1 4/5] genboardcfg: allow defconfigs in board directory

Simon Glass sjg at chromium.org
Tue Dec 28 09:33:12 CET 2021


Hi Troy,

On Fri, 17 Dec 2021 at 16:02, Troy Kisky <troy.kisky at boundarydevices.com> wrote:
>
> The adds boards whose defconfigs are in the board's directory.
>
> Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
> ---
>  tools/genboardscfg.py | 37 ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 36 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

Please see below

> diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
> index 4ee7aa1f891..60e2fe5cf3e 100755
> --- a/tools/genboardscfg.py
> +++ b/tools/genboardscfg.py
> @@ -37,6 +37,13 @@ COMMENT_BLOCK = '''#
>  ''' % __file__
>
>  ### helper functions ###
> +def find_defconfig_in_board_subdir(f):

Needs a comment as to what it does and what it returns

> +    for (dirpath, dirnames, filenames) in os.walk('board'):
> +        for filename in filenames:
> +            if filename == f:
> +                    return True
> +    return False
> +
>  def try_remove(f):
>      """Remove a file ignoring 'No such file or directory' error."""
>      try:
> @@ -76,6 +83,14 @@ def output_is_new(output):
>              if ctime < os.path.getctime(filepath):
>                  return False
>
> +    for (dirpath, dirnames, filenames) in os.walk('board'):
> +        for filename in fnmatch.filter(filenames, '*'):
> +            if fnmatch.fnmatch(filename, '.*'):
> +                continue
> +            filepath = os.path.join(dirpath, filename)
> +            if ctime < os.path.getctime(filepath):
> +                return False
> +
>      for (dirpath, dirnames, filenames) in os.walk('.'):
>          for filename in filenames:
>              if (fnmatch.fnmatch(filename, '*~') or
> @@ -94,7 +109,8 @@ def output_is_new(output):
>                  continue
>              defconfig = line.split()[6] + '_defconfig'
>              if not os.path.exists(os.path.join(CONFIG_DIR, defconfig)):
> -                return False
> +                if not find_defconfig_in_board_subdir(defconfig):
> +                    return False
>
>      return True
>
> @@ -231,6 +247,12 @@ def scan_defconfigs(jobs=1):
>                  continue
>              all_defconfigs.append(os.path.join(dirpath, filename))
>
> +    for (dirpath, dirnames, filenames) in os.walk('board'):
> +        for filename in fnmatch.filter(filenames, '*_defconfig'):
> +            if fnmatch.fnmatch(filename, '.*'):
> +                continue
> +            all_defconfigs.append(os.path.join(dirpath, filename))
> +
>      total_boards = len(all_defconfigs)
>      processes = []
>      queues = []
> @@ -346,6 +368,19 @@ class MaintainersDatabase:
>                  targets = []
>                  maintainers = []
>                  status = '-'
> +
> +        front, match, rear = file.partition('board/')

Please add a comment about what is going on here

> +        if match:
> +            front, match, rear = file.partition('/MAINTAINERS')
> +            if front:
> +                for (dirpath, dirnames, filenames) in os.walk(front):
> +                    for filename in fnmatch.filter(filenames, '*_defconfig'):
> +                        if fnmatch.fnmatch(filename, '.*'):
> +                            continue
> +                        front, match, rear = filename.rpartition('_defconfig')
> +                        if match and not rear:
> +                            targets.append(front)
> +
>          if targets:
>              for target in targets:
>                  self.database[target] = (status, maintainers)
> --
> 2.32.0
>

Regards,
Simon


More information about the U-Boot mailing list