diff mbox

[U-Boot,V2] buildman: make board selector argument a regex

Message ID 1381420820-32583-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Stephen Warren Oct. 10, 2013, 4 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

A common use-case is to build all boards for a particular SoC. This can
be achieved by:

./tools/buildman/buildman -b mainline_dev tegra20

However, when the SoC is a member of a family of SoCs, and each SoC has
a different name, it would be even more useful to build all boards for
every SoC in that family. This currently isn't possible since buildman's
board selection command-line arguments are compared to board definitions
using pure string equality.

To enable this, compare using a regex match instead. This matches
MAKEALL's handling of command-line arguments. This enables:

(all Tegra)
./tools/buildman/buildman -b mainline_dev tegra

(all Tegra)
./tools/buildman/buildman -b mainline_dev '^tegra.*$'

(all Tegra20, Tegra30 boards, but not Tegra114)
./tools/buildman/buildman -b mainline_dev 'tegra[23]'

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: Update README to mention new regex matching support. Remove -n from
    command-line examples in the commit description.
---
 tools/buildman/README   | 14 ++++++++++----
 tools/buildman/board.py | 12 +++++++++++-
 2 files changed, 21 insertions(+), 5 deletions(-)

Comments

Simon Glass Oct. 10, 2013, 4:46 p.m. UTC | #1
On Thu, Oct 10, 2013 at 10:00 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> A common use-case is to build all boards for a particular SoC. This can
> be achieved by:
>
> ./tools/buildman/buildman -b mainline_dev tegra20
>
> However, when the SoC is a member of a family of SoCs, and each SoC has
> a different name, it would be even more useful to build all boards for
> every SoC in that family. This currently isn't possible since buildman's
> board selection command-line arguments are compared to board definitions
> using pure string equality.
>
> To enable this, compare using a regex match instead. This matches
> MAKEALL's handling of command-line arguments. This enables:
>
> (all Tegra)
> ./tools/buildman/buildman -b mainline_dev tegra
>
> (all Tegra)
> ./tools/buildman/buildman -b mainline_dev '^tegra.*$'
>
> (all Tegra20, Tegra30 boards, but not Tegra114)
> ./tools/buildman/buildman -b mainline_dev 'tegra[23]'
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Nice README, thanks.

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Nov. 21, 2013, 8:42 p.m. UTC | #2
Applied to u-boot-x86 branch buildpatman, thank you.



On Thu, Oct 10, 2013 at 10:46 AM, Simon Glass <sjg@chromium.org> wrote:

> On Thu, Oct 10, 2013 at 10:00 AM, Stephen Warren <swarren@wwwdotorg.org>
> wrote:
> > From: Stephen Warren <swarren@nvidia.com>
> >
> > A common use-case is to build all boards for a particular SoC. This can
> > be achieved by:
> >
> > ./tools/buildman/buildman -b mainline_dev tegra20
> >
> > However, when the SoC is a member of a family of SoCs, and each SoC has
> > a different name, it would be even more useful to build all boards for
> > every SoC in that family. This currently isn't possible since buildman's
> > board selection command-line arguments are compared to board definitions
> > using pure string equality.
> >
> > To enable this, compare using a regex match instead. This matches
> > MAKEALL's handling of command-line arguments. This enables:
> >
> > (all Tegra)
> > ./tools/buildman/buildman -b mainline_dev tegra
> >
> > (all Tegra)
> > ./tools/buildman/buildman -b mainline_dev '^tegra.*$'
> >
> > (all Tegra20, Tegra30 boards, but not Tegra114)
> > ./tools/buildman/buildman -b mainline_dev 'tegra[23]'
> >
> > Signed-off-by: Stephen Warren <swarren@nvidia.com>
>
> Nice README, thanks.
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
diff mbox

Patch

diff --git a/tools/buildman/README b/tools/buildman/README
index f63f278..8bf907e 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -89,10 +89,16 @@  a few commits or boards, it will be pretty slow. As a tip, if you don't
 plan to use your machine for anything else, you can use -T to increase the
 number of threads beyond the default.
 
-Buildman lets you build all boards, or a subset. Specify the subset using
-the board name, architecture name, SOC name, or anything else in the
-boards.cfg file. So 'at91' will build all AT91 boards (arm), powerpc will
-build all PowerPC boards.
+Buildman lets you build all boards, or a subset. Specify the subset by passing
+command-line arguments that list the desired board name, architecture name,
+SOC name, or anything else in the boards.cfg file. Multiple arguments are
+allowed. Each argument will be interpreted as a regular expression, so
+behaviour is a superset of exact or substring matching. Examples are:
+
+* 'tegra20'      All boards with a Tegra20 SoC
+* 'tegra'        All boards with any Tegra Soc (Tegra20, Tegra30, Tegra114...)
+* '^tegra[23]0$' All boards with either Tegra20 or Tegra30 SoC
+* 'powerpc'      All PowerPC boards
 
 Buildman does not store intermediate object files. It optionally copies
 the binary output into a directory when a build is successful. Size
diff --git a/tools/buildman/board.py b/tools/buildman/board.py
index 1d3db20..5172a47 100644
--- a/tools/buildman/board.py
+++ b/tools/buildman/board.py
@@ -3,6 +3,8 @@ 
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+import re
+
 class Board:
     """A particular board that we can build"""
     def __init__(self, status, arch, cpu, soc, vendor, board_name, target, options):
@@ -135,14 +137,22 @@  class Boards:
             due to each argument, arranged by argument.
         """
         result = {}
+        argres = {}
         for arg in args:
             result[arg] = 0
+            argres[arg] = re.compile(arg)
         result['all'] = 0
 
         for board in self._boards:
             if args:
                 for arg in args:
-                    if arg in board.props:
+                    argre = argres[arg]
+                    match = False
+                    for prop in board.props:
+                        match = argre.match(prop)
+                        if match:
+                            break
+                    if match:
                         if not board.build_it:
                             board.build_it = True
                             result[arg] += 1