Commit 3cf4ae6f8672cd10ddba4b18bf82e4d03aeb15e6

Authored by Simon Glass
1 parent f60c9d4f39

buildman: Implement an option to exclude boards from the build

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@freescale.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 4 changed files with 41 additions and 8 deletions Side-by-side Diff

tools/buildman/README
... ... @@ -114,6 +114,13 @@
114 114 * 'freescale & arm sandbox' All Freescale boards with ARM architecture,
115 115 plus sandbox
116 116  
  117 +You can also use -x to specifically exclude some boards. For example:
  118 +
  119 + buildmand arm -x nvidia,freescale,.*ball$
  120 +
  121 +means to build all arm boards except nvidia, freescale and anything ending
  122 +with 'ball'.
  123 +
117 124 It is convenient to use the -n option to see whaat will be built based on
118 125 the subset given.
119 126  
tools/buildman/board.py
... ... @@ -239,13 +239,14 @@
239 239 terms.append(term)
240 240 return terms
241 241  
242   - def SelectBoards(self, args):
  242 + def SelectBoards(self, args, exclude=[]):
243 243 """Mark boards selected based on args
244 244  
245 245 Args:
246   - List of strings specifying boards to include, either named, or
247   - by their target, architecture, cpu, vendor or soc. If empty, all
248   - boards are selected.
  246 + args: List of strings specifying boards to include, either named,
  247 + or by their target, architecture, cpu, vendor or soc. If
  248 + empty, all boards are selected.
  249 + exclude: List of boards to exclude, regardless of 'args'
249 250  
250 251 Returns:
251 252 Dictionary which holds the number of boards which were selected
252 253  
253 254  
254 255  
255 256  
... ... @@ -258,17 +259,33 @@
258 259 for term in terms:
259 260 result[str(term)] = 0
260 261  
  262 + exclude_list = []
  263 + for expr in exclude:
  264 + exclude_list.append(Expr(expr))
  265 +
261 266 for board in self._boards:
  267 + matching_term = None
  268 + build_it = False
262 269 if terms:
263 270 match = False
264 271 for term in terms:
265 272 if term.Matches(board.props):
266   - board.build_it = True
267   - result[str(term)] += 1
268   - result['all'] += 1
  273 + matching_term = str(term)
  274 + build_it = True
269 275 break
270 276 else:
  277 + build_it = True
  278 +
  279 + # Check that it is not specifically excluded
  280 + for expr in exclude_list:
  281 + if expr.Matches(board.props):
  282 + build_it = False
  283 + break
  284 +
  285 + if build_it:
271 286 board.build_it = True
  287 + if matching_term:
  288 + result[matching_term] += 1
272 289 result['all'] += 1
273 290  
274 291 return result
tools/buildman/buildman.py
... ... @@ -117,6 +117,9 @@
117 117 default=False, help='Show boards with unknown build result')
118 118 parser.add_option('-v', '--verbose', action='store_true',
119 119 default=False, help='Show build results while the build progresses')
  120 +parser.add_option('-x', '--exclude', dest='exclude',
  121 + type='string', action='append',
  122 + help='Specify a list of boards to exclude, separated by comma')
120 123  
121 124 parser.usage += """
122 125  
tools/buildman/control.py
... ... @@ -127,7 +127,13 @@
127 127  
128 128 boards = board.Boards()
129 129 boards.ReadBoards(os.path.join(options.git, 'boards.cfg'))
130   - why_selected = boards.SelectBoards(args)
  130 +
  131 + exclude = []
  132 + if options.exclude:
  133 + for arg in options.exclude:
  134 + exclude += arg.split(',')
  135 +
  136 + why_selected = boards.SelectBoards(args, exclude)
131 137 selected = boards.GetSelected()
132 138 if not len(selected):
133 139 sys.exit(col.Color(col.RED, 'No matching boards found'))