[U-Boot] [PATCH v10 09/14] buildman: Implement an option to exclude boards from the build

Simon Glass sjg at chromium.org
Thu Aug 28 17:43:41 CEST 2014


Some boards are known to be broken and it is convenient to be able to
exclude them from the build.

Add an --exclude option to specific boards to exclude. This uses the
same matching rules as the normal 'include' arguments, and is a comma-
separated list of regular expressions.

Suggested-by: York Sun <yorksun at freescale.com>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v10: None
Changes in v9:
- Add new patch to implement --exclude option

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None

 tools/buildman/README      |  7 +++++++
 tools/buildman/board.py    | 31 ++++++++++++++++++++++++-------
 tools/buildman/buildman.py |  3 +++
 tools/buildman/control.py  |  8 +++++++-
 4 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index 68465b4..b8c2bd6 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -114,6 +114,13 @@ the '&' operator to limit the selection:
 * 'freescale & arm sandbox'  All Freescale boards with ARM architecture,
                              plus sandbox
 
+You can also use -x to specifically exclude some boards. For example:
+
+ buildmand arm -x nvidia,freescale,.*ball$
+
+means to build all arm boards except nvidia, freescale and anything ending
+with 'ball'.
+
 It is convenient to use the -n option to see whaat will be built based on
 the subset given.
 
diff --git a/tools/buildman/board.py b/tools/buildman/board.py
index a333287..5d536d5 100644
--- a/tools/buildman/board.py
+++ b/tools/buildman/board.py
@@ -239,13 +239,14 @@ class Boards:
             terms.append(term)
         return terms
 
-    def SelectBoards(self, args):
+    def SelectBoards(self, args, exclude=[]):
         """Mark boards selected based on args
 
         Args:
-            List of strings specifying boards to include, either named, or
-            by their target, architecture, cpu, vendor or soc. If empty, all
-            boards are selected.
+            args: List of strings specifying boards to include, either named,
+                  or by their target, architecture, cpu, vendor or soc. If
+                  empty, all boards are selected.
+            exclude: List of boards to exclude, regardless of 'args'
 
         Returns:
             Dictionary which holds the number of boards which were selected
@@ -258,17 +259,33 @@ class Boards:
         for term in terms:
             result[str(term)] = 0
 
+        exclude_list = []
+        for expr in exclude:
+            exclude_list.append(Expr(expr))
+
         for board in self._boards:
+            matching_term = None
+            build_it = False
             if terms:
                 match = False
                 for term in terms:
                     if term.Matches(board.props):
-                        board.build_it = True
-                        result[str(term)] += 1
-                        result['all'] += 1
+                        matching_term = str(term)
+                        build_it = True
                         break
             else:
+                build_it = True
+
+            # Check that it is not specifically excluded
+            for expr in exclude_list:
+                if expr.Matches(board.props):
+                    build_it = False
+                    break
+
+            if build_it:
                 board.build_it = True
+                if matching_term:
+                    result[matching_term] += 1
                 result['all'] += 1
 
         return result
diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py
index fbd3125..53592e5 100755
--- a/tools/buildman/buildman.py
+++ b/tools/buildman/buildman.py
@@ -117,6 +117,9 @@ parser.add_option('-u', '--show_unknown', action='store_true',
        default=False, help='Show boards with unknown build result')
 parser.add_option('-v', '--verbose', action='store_true',
        default=False, help='Show build results while the build progresses')
+parser.add_option('-x', '--exclude', dest='exclude',
+      type='string', action='append',
+      help='Specify a list of boards to exclude, separated by comma')
 
 parser.usage += """
 
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 239c423..7991c74 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -129,7 +129,13 @@ def DoBuildman(options, args):
 
     boards = board.Boards()
     boards.ReadBoards(os.path.join(options.git, 'boards.cfg'))
-    why_selected = boards.SelectBoards(args)
+
+    exclude = []
+    if options.exclude:
+        for arg in options.exclude:
+            exclude += arg.split(',')
+
+    why_selected = boards.SelectBoards(args, exclude)
     selected = boards.GetSelected()
     if not len(selected):
         sys.exit(col.Color(col.RED, 'No matching boards found'))
-- 
2.1.0.rc2.206.gedb03e5



More information about the U-Boot mailing list