blob: c4df25ea4a9d0b84e3c5f5d86e0ed6dabb198a40 [file] [log] [blame]
Paul Fagerburg3b534f92019-11-07 15:05:22 -07001#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
Paul Fagerburge868e832020-01-22 17:14:04 -07003"""Create a new variant of an existing reference board
Paul Fagerburg3b534f92019-11-07 15:05:22 -07004
5This program will call all of the scripts that create the various pieces
6of a new variant. For example to create a new variant of the hatch base
7board, the following scripts are called:
8
Paul Fagerburgbab5dde2020-01-10 15:10:29 -07009* third_party/coreboot/util/mainboard/google/create_coreboot_variant.sh
Paul Fagerburg3b534f92019-11-07 15:05:22 -070010* platform/dev/contrib/variant/create_coreboot_config.sh
11* private-overlays/baseboard-hatch-private/sys-boot/
12 * coreboot-private-files-hatch/files/add_fitimage.sh
13 * coreboot-private-files-hatch/asset_generation/gen_fit_image.sh
14 * Outside the chroot, because it uses WINE to run the FIT tools
15* platform/dev/contrib/variant/create_initial_ec_image.sh
16* platform/dev/contrib/variant/add_variant_to_yaml.sh
17* private-overlays/overlay-hatch-private/chromeos-base/
18 * chromeos-config-bsp-hatch-private/add_variant.sh
19
20Once the scripts are done, the following repos have changes
21
22* third_party/coreboot
23* third_party/chromiumos-overlay
24* private-overlays/baseboard-hatch-private
25* platform/ec
26* private-overlays/overlay-hatch-private
27* overlays
28
Paul Fagerburge868e832020-01-22 17:14:04 -070029The program has support for multiple reference boards, so the repos, directories,
30and scripts above can change depending on what the reference board is.
Paul Fagerburgbab5dde2020-01-10 15:10:29 -070031
32Copyright 2020 The Chromium OS Authors. All rights reserved.
Paul Fagerburg3b534f92019-11-07 15:05:22 -070033Use of this source code is governed by a BSD-style license that can be
34found in the LICENSE file.
35"""
36
37from __future__ import print_function
38import argparse
Paul Fagerburgbab5dde2020-01-10 15:10:29 -070039import importlib
Paul Fagerburg3b534f92019-11-07 15:05:22 -070040import logging
41import os
42import re
43import shutil
44import subprocess
45import sys
Paul Fagerburg1d043c32020-02-03 08:57:08 -070046from chromite.lib import git
Paul Fagerburgbab5dde2020-01-10 15:10:29 -070047import step_names
Paul Fagerburg3b534f92019-11-07 15:05:22 -070048import variant_status
49
50
51def main():
Paul Fagerburge868e832020-01-22 17:14:04 -070052 """Create a new variant of an existing reference board
Paul Fagerburg3b534f92019-11-07 15:05:22 -070053
54 This program automates the creation of a new variant of an existing
Paul Fagerburge868e832020-01-22 17:14:04 -070055 reference board by calling various scripts that copy the reference board,
56 modify files for the new variant, stage commits, and upload to gerrit.
Paul Fagerburg3b534f92019-11-07 15:05:22 -070057
58 Note that one of the following is required:
59 * --continue
60 * --board=BOARD --variant=VARIANT [--bug=BUG]
61 """
62 board, variant, bug, continue_flag = get_args()
63
64 if not check_flags(board, variant, bug, continue_flag):
65 return False
66
67 status = get_status(board, variant, bug, continue_flag)
68 if status is None:
69 return False
70
71 status.load()
72
Paul Fagerburgbab5dde2020-01-10 15:10:29 -070073 while status.step is not None:
Paul Fagerburg3b534f92019-11-07 15:05:22 -070074 status.save()
Paul Fagerburgbab5dde2020-01-10 15:10:29 -070075 if not perform_step(status):
76 logging.debug('perform_step returned False; exiting ...')
Paul Fagerburg3b534f92019-11-07 15:05:22 -070077 return False
78
Paul Fagerburgbab5dde2020-01-10 15:10:29 -070079 move_to_next_step(status)
Paul Fagerburg3b534f92019-11-07 15:05:22 -070080
81 return True
82
83
84def get_args():
85 """Parse the command-line arguments
86
87 There doesn't appear to be a way to specify that --continue is
88 mutually exclusive with --board, --variant, and --bug. As a result,
89 all arguments are optional, and another function will apply the logic
90 to check if there is an illegal combination of arguments.
91
92 Returns a list of:
Paul Fagerburge868e832020-01-22 17:14:04 -070093 board Name of the reference board
Paul Fagerburg3b534f92019-11-07 15:05:22 -070094 variant Name of the variant being created
95 bug Text for bug number, if any ('None' otherwise)
96 continue_flag Flag if --continue was specified
97 """
98 parser = argparse.ArgumentParser(
99 description=main.__doc__,
100 formatter_class=argparse.RawTextHelpFormatter)
Paul Fagerburge868e832020-01-22 17:14:04 -0700101 parser.add_argument('--board', type=str, help='Name of the reference board')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700102 parser.add_argument(
103 '--variant', type=str, help='Name of the new variant to create')
104 parser.add_argument(
105 '--bug', type=str, help='Bug number to reference in commits')
106 parser.add_argument(
107 '--continue', action='store_true',
108 dest='continue_flag', help='Continue the process from where it paused')
109 parser.add_argument(
110 '--verbose', action='store_true',
111 dest='verbose_flag', help='Enable verbose output of progress')
112 args = parser.parse_args()
113
114 if args.verbose_flag:
115 logging.basicConfig(level=logging.DEBUG)
116 else:
117 logging.basicConfig(level=logging.INFO)
118
119 board = args.board
120 if board is not None:
121 board = board.lower()
122
123 variant = args.variant
124 if variant is not None:
125 variant = variant.lower()
126
127 bug = args.bug or 'None'
128
129 return (board, variant, bug, args.continue_flag)
130
131
132def check_flags(board, variant, bug, continue_flag):
133 """Check the flags to ensure no invalid combinations
134
135 We allow any of the following:
136 --continue
137 --board=board_name --variant=variant_name
138 --board=board_name --variant=variant_name --bug=bug_text
139
140 The argument parser does have the functionality to represent the
141 combination of --board and --variant as a single mutually-exclusive
142 argument, so we have to use this function to do the checking.
143
144 Params:
Paul Fagerburge868e832020-01-22 17:14:04 -0700145 board Name of the reference board
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700146 variant Name of the variant being created
147 bug Text for bug number, if any ('None' otherwise)
148 continue_flag Flag if --continue was specified
149
150 Returns:
151 True if the arguments are acceptable, False otherwise
152 """
153 if continue_flag:
154 if board is not None or variant is not None:
155 logging.error('--continue cannot have other options')
156 return False
157
158 if bug != 'None':
159 logging.error('--continue cannot have other options')
160 return False
161 else:
162 if board is None:
163 logging.error('--board must be specified')
164 return False
165
166 if variant is None:
167 logging.error('--variant must be specified')
168 return False
169
170 return True
171
172
173def file_exists(filepath, filename):
174 """Determine if a path and file exists
175
176 Params:
177 filepath Path where build outputs should be found, e.g.
178 /build/hatch/firmware
179 filename File that should exist in that path, e.g.
180 image-sushi.bin
181
182 Returns:
183 True if file exists in that path, False otherwise
184 """
185 fullname = os.path.join(filepath, filename)
186 return os.path.exists(fullname) and os.path.isfile(fullname)
187
188
189def get_status(board, variant, bug, continue_flag):
190 """Create the status file or get the previous status
191
192 This program can stop at several places as we have to wait for CLs
193 to work through CQ or be upstreamed into the chromiumos tree, so just
194 like a git cherry-pick, there is a --continue option to pick up where
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700195 you left off by reading a specially-named status file.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700196
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700197 If --continue is specified, the status file must exist.
198 If the status file exists, then --continue must be specified.
199 When --continue is specified, we read the status file and return
200 with the contents.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700201
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700202 If the status file does not exist, we will create the state file with
203 the board, variant, and (optional) bug details.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700204
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700205 To decouple the list of boards supported from this main program, we
Paul Fagerburge868e832020-01-22 17:14:04 -0700206 try to import a module with the same name as the reference board,
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700207 so --board=hatch means that we import hatch.py. If we can't import
Paul Fagerburge868e832020-01-22 17:14:04 -0700208 the file, then we don't support that reference board.
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700209
210 The board-specific module will set several variables, which we will
211 copy into the object that we return.
212
Paul Fagerburge868e832020-01-22 17:14:04 -0700213 * base - the name of the base board, such as Hatch, Volteer, or Zork.
214 This can be different from the reference board, e.g. the Trembyle
215 reference board in the Zork project.
Paul Fagerburg4d343452020-01-24 15:23:53 -0700216 * coreboot_dir - base directory for coreboot, usually third_party/coreboot
217 but could differ for processors that use a private repo
218 * cb_config_dir - base directory for coreboot configs, usually
219 third_party/chromiumos-overlay/sys-boot/coreboot/files/configs but
220 could differ for processors that use a private repo
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700221 * step_list - list of steps (named in step_names.py) to run in sequence
Paul Fagerburge868e832020-01-22 17:14:04 -0700222 to create the new variant of the reference board
223 * fsp - package name for FSP. This may be None, depending on the
224 processor on the reference board
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700225 * fitimage_pkg - package name for the fitimage
226 * fitimage_dir - directory for fitimage; prepend '~/trunk/src/' in chroot,
227 prepend '~/chromiumos/src' outside the chroot
228 * workon_pkgs - list of packages to cros_workon
229 * emerge_cmd - the emerge command, e.g. 'emerge-hatch'
230 * emerge_pkgs - list of packages to emerge
231 * yaml_emerge_pkgs - list of packages to emerge just to build the yaml
232 * private_yaml_dir - directory for the private yaml file
233
234 Additionally, the following fields will be set:
235
Paul Fagerburge868e832020-01-22 17:14:04 -0700236 * board - the name of the reference board, e.g. 'hatch'
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700237 * variant - the name of the variant, e.g. 'sushi'
238 * bug - optional text for a bug ID, used in the git commit messages.
239 Could be 'None' (as text, not the python None), or something like
240 'b:12345' for buganizer, or 'chromium:12345'
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700241 * step - internal state tracking, what step of the variant creation
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700242 we are at.
243 * yaml_file - internal, just the name of the file where all this data
244 gets saved.
245
246 These data might come from the status file (because we read it), or
247 they might be the initial values after we created the file (because
248 it did not already exist).
249
250 Params:
Paul Fagerburge868e832020-01-22 17:14:04 -0700251 board Name of the reference board
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700252 variant Name of the variant being created
253 bug Text for bug number, if any ('None' otherwise)
254 continue_flag Flag if --continue was specified
255
256 Returns:
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700257 variant_status object with all the data mentioned above
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700258 """
259 status = variant_status.variant_status()
260 if continue_flag:
261 if not status.yaml_file_exists():
262 logging.error(
263 'new_variant is not in progress; nothing to --continue')
264 return None
265 else:
266 if status.yaml_file_exists():
267 logging.error(
268 'new_variant already in progress; did you forget --continue?')
269 return None
270
271 status.board = board
272 status.variant = variant
273 status.bug = bug
Paul Fagerburgdd3e9c32020-01-07 14:00:35 -0700274
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700275 # We're just starting out, so load the appropriate module and copy
276 # all the data from it.
277 try:
278 module = importlib.import_module(board)
279 except ImportError:
Paul Fagerburge868e832020-01-22 17:14:04 -0700280 print('Unsupported board "' + board + '"')
Paul Fagerburgdd3e9c32020-01-07 14:00:35 -0700281 sys.exit(1)
282
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700283 # pylint: disable=bad-whitespace
284 # Allow extra spaces around = so that we can line things up nicely
Paul Fagerburge868e832020-01-22 17:14:04 -0700285 status.base = module.base
Paul Fagerburg4d343452020-01-24 15:23:53 -0700286 status.coreboot_dir = module.coreboot_dir
287 status.cb_config_dir = module.cb_config_dir
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700288 status.emerge_cmd = module.emerge_cmd
289 status.emerge_pkgs = module.emerge_pkgs
290 status.fitimage_dir = module.fitimage_dir
291 status.fitimage_pkg = module.fitimage_pkg
Paul Fagerburg55dabf42020-01-27 15:30:09 -0700292 status.fitimage_cmd = module.fitimage_cmd
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700293 status.fsp = module.fsp
294 status.private_yaml_dir = module.private_yaml_dir
295 status.step_list = module.step_list
296 status.workon_pkgs = module.workon_pkgs
297 status.yaml_emerge_pkgs = module.yaml_emerge_pkgs
298 # pylint: enable=bad-whitespace
Paul Fagerburgdd3e9c32020-01-07 14:00:35 -0700299
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700300 # Start at the first entry in the step list
301 status.step = status.step_list[0]
Paul Fagerburgdd3e9c32020-01-07 14:00:35 -0700302
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700303 # Start a blank map for tracking CL data
304 status.commits = {}
305
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700306 status.save()
307
308 return status
309
310
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700311def perform_step(status):
312 """Call the appropriate function for the current step
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700313
314 Params:
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700315 status variant_status object tracking our board, variant, etc.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700316
317 Returns:
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700318 True if the step succeeded, False if it failed
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700319 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700320 # Function to call based on the step
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700321 dispatch = {
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700322 step_names.CB_VARIANT: create_coreboot_variant,
323 step_names.CB_CONFIG: create_coreboot_config,
Paul Fagerburg2fd23f42020-02-07 14:04:48 -0700324 step_names.CRAS_CONFIG: copy_cras_config,
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700325 step_names.ADD_FIT: add_fitimage,
326 step_names.GEN_FIT: gen_fit_image_outside_chroot,
327 step_names.COMMIT_FIT: commit_fitimage,
328 step_names.EC_IMAGE: create_initial_ec_image,
329 step_names.EC_BUILDALL: ec_buildall,
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700330 step_names.ADD_PUB_YAML: add_variant_to_public_yaml,
331 step_names.ADD_PRIV_YAML: add_variant_to_private_yaml,
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700332 step_names.BUILD_YAML: build_yaml,
333 step_names.EMERGE: emerge_all,
334 step_names.PUSH: push_coreboot,
335 step_names.UPLOAD: upload_CLs,
336 step_names.FIND: find_coreboot_upstream,
337 step_names.CQ_DEPEND: add_cq_depends,
338 step_names.CLEAN_UP: clean_up,
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700339 }
340
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700341 if status.step not in dispatch:
342 logging.error('Unknown step "%s", aborting...', status.step)
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700343 sys.exit(1)
344
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700345 return dispatch[status.step](status)
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700346
347
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700348def move_to_next_step(status):
349 """Move to the next step in the list
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700350
351 Params:
352 status variant_status object tracking our board, variant, etc.
353 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700354 if status.step not in status.step_list:
355 logging.error('Unknown step "%s", aborting...', status.step)
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700356 sys.exit(1)
357
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700358 idx = status.step_list.index(status.step)
359 if idx == len(status.step_list)-1:
360 status.step = None
Paul Fagerburgdd3e9c32020-01-07 14:00:35 -0700361 else:
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700362 status.step = status.step_list[idx+1]
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700363
364
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700365def run_process(args, cwd=None, env=None, capture_output=False):
366 """Run a process, log debug messages, return text output of process
367
368 The capture_output parameter allows us to capture the output when we
369 care about it (and not sending it to the screen), or ignoring it when
370 we don't care, and letting the user see the output so they know that
371 the build is still running, etc.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700372
373 Params:
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700374 args List of the command and its params
375 cwd If not None, cd to this directory before running
376 env Environment to use for execution; if needed, get
377 os.environ.copy() and add variables. If None, just
378 use the current environment
379 capture_output True if we should capture the stdout, false
380 if we just care about success or not.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700381
382 Returns:
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700383 If capture_output == True, we return the text output from running
384 the subprocess as a list of lines, or None if the process failed.
385 If capture_output == False, we return a True if it successed, or
386 None if the process failed.
387
388 The caller can evaluate as a bool, because bool(None) == False, and
389 bool() of a non-empty list is True, or the caller can use the returned
390 text for further processing.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700391 """
392 logging.debug('Run %s', str(args))
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700393 try:
394 if capture_output:
395 output = subprocess.check_output(args, cwd=cwd, env=env,
396 stderr=subprocess.STDOUT)
397 else:
398 subprocess.run(args, cwd=cwd, env=env, check=True)
399 # Just something to decode so we don't get an empty list
400 output = b'True'
401
402 logging.debug('process returns 0')
403 # Convert from byte string to ASCII
404 decoded = output.decode('utf-8')
405 # Split into array of individual lines
406 lines = decoded.split('\n')
407 return lines
408 except subprocess.CalledProcessError as err:
409 logging.debug('process returns %s', str(err.returncode))
410 return None
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700411
412
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700413def get_git_commit_data(cwd):
414 """Get the branch name and change id of the current commit
415
416 Params:
417 cwd The current working directory, where we want to get the
418 branch name and change id
419
420 Returns:
421 Map with 'dir', 'branch_name' and 'change_id' keys. The 'dir'
422 key maps to the value of os.path.expanduser(cwd)
423 """
424 cwd = os.path.expanduser(cwd)
425 logging.debug('get_git_commit_data(%s)', cwd)
426
427 branch_name = git.GetCurrentBranch(cwd)
428 if branch_name is None:
429 logging.error('Cannot determine git branch name in %s; exiting', cwd)
430 sys.exit(1)
431 logging.debug('git current branch is %s', branch_name)
432
433 change_id = git.GetChangeId(cwd)
434 if change_id is None:
435 logging.error('Cannot determine Change-Id in %s; exiting', cwd)
436 sys.exit(1)
437 logging.debug('git Change-Id is %s', change_id)
438
439 return {
440 'dir': cwd,
441 'branch_name': branch_name,
442 'change_id': change_id
443 }
444
445
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700446def cros_workon(status, action):
447 """Call cros_workon for all the 9999 ebuilds we'll be touching
448
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700449 Params:
450 status variant_status object tracking our board, variant, etc.
451 action 'start' or 'stop'
452
453 Returns:
454 True if the call to cros_workon was successful, False if failed
455 """
456
457 # Build up the command from all the packages in the list
Paul Fagerburge868e832020-01-22 17:14:04 -0700458 workon_cmd = ['cros_workon', '--board=' + status.base, action] + status.workon_pkgs
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700459 return bool(run_process(workon_cmd))
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700460
461
462def create_coreboot_variant(status):
Paul Fagerburge868e832020-01-22 17:14:04 -0700463 """Create source files for a new variant of the reference board in coreboot
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700464
465 This function calls create_coreboot_variant.sh to set up a new variant
Paul Fagerburge868e832020-01-22 17:14:04 -0700466 of the reference board.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700467
468 Params:
469 status variant_status object tracking our board, variant, etc.
470
471 Returns:
472 True if everything succeeded, False if something failed
473 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700474 logging.info('Running step create_coreboot_variant')
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700475 cb_src_dir = os.path.join(os.path.expanduser('~/trunk/src/'),
476 status.coreboot_dir)
477 create_coreboot_variant_sh = os.path.join(cb_src_dir,
Paul Fagerburg7b516d72019-12-20 13:13:41 -0700478 'util/mainboard/google/create_coreboot_variant.sh')
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700479 rc = bool(run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700480 [create_coreboot_variant_sh,
Paul Fagerburge868e832020-01-22 17:14:04 -0700481 status.base,
Paul Fagerburgabb15622020-02-07 15:41:29 -0700482 status.board,
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700483 status.variant,
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700484 status.bug]))
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700485 if rc:
486 status.commits['cb_variant'] = get_git_commit_data(cb_src_dir)
487 return rc
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700488
489
490def create_coreboot_config(status):
491 """Create a coreboot configuration for a new variant
492
493 This function calls create_coreboot_config.sh, which will make a copy
494 of coreboot.${BOARD} into coreboot.${VARIANT}.
495
496 Params:
497 status variant_status object tracking our board, variant, etc.
498
499 Returns:
500 True if the script and test build succeeded, False if something failed
501 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700502 logging.info('Running step create_coreboot_config')
Paul Fagerburg4d343452020-01-24 15:23:53 -0700503 environ = os.environ.copy()
504 if status.cb_config_dir is not None:
505 environ['CB_CONFIG_DIR'] = status.cb_config_dir
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700506 create_coreboot_config_sh = os.path.expanduser(
507 '~/trunk/src/platform/dev/contrib/variant/create_coreboot_config.sh')
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700508 rc = bool(run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700509 [create_coreboot_config_sh,
Paul Fagerburge868e832020-01-22 17:14:04 -0700510 status.base,
511 status.board,
512 status.variant,
Paul Fagerburg4d343452020-01-24 15:23:53 -0700513 status.bug], env=environ))
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700514 if rc:
515 # Use status.cb_config_dir if defined, or if not, use
516 # '~/trunk/src/third_party/chromiumos-overlay'
517 if status.cb_config_dir is not None:
518 cb_config_dir = os.path.join('~/trunk/src/', status.cb_config_dir)
519 else:
520 cb_config_dir = '~/trunk/src/third_party/chromiumos-overlay'
521 status.commits['cb_config'] = get_git_commit_data(cb_config_dir)
522 return rc
Paul Fagerburge868e832020-01-22 17:14:04 -0700523
524
Paul Fagerburg2fd23f42020-02-07 14:04:48 -0700525def copy_cras_config(status):
526 """Copy the cras config for a new variant
527
528 This is only necessary for the Zork baseboard right now.
529 This function calls copy_cras_config.sh, which will copy the
530 cras config in
531 overlays/overlay-${BASE}/chromeos-base/chromeos-bsp-${BASE}/files/cras-config/${BASE}
532 to .../${VARIANT}
533
534 Params:
535 status variant_status object tracking our board, variant, etc.
536
537 Returns:
538 True if the script and test build succeeded, False if something failed
539 """
540 logging.info('Running step copy_cras_config')
541 copy_cras_config_sh = os.path.expanduser(
542 '~/trunk/src/platform/dev/contrib/variant/copy_cras_config.sh')
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700543 rc = bool(run_process(
Paul Fagerburg2fd23f42020-02-07 14:04:48 -0700544 [copy_cras_config_sh,
545 status.base,
546 status.board,
547 status.variant,
548 status.bug]))
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700549 if rc:
550 status.commits['copy_cras_config'] = get_git_commit_data('~/trunk/src/overlays')
551 return rc
Paul Fagerburg2fd23f42020-02-07 14:04:48 -0700552
553
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700554def add_fitimage(status):
555 """Add the source files for a fitimage for the new variant
556
557 This function calls add_fitimage.sh to create a new XSL file for the
Paul Fagerburge868e832020-01-22 17:14:04 -0700558 variant's fitimage, which can override settings from the reference board's
559 XSL. When this is done, the user will have to build the fitimage by running
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700560 gen_fit_image.sh outside of the chroot (and outside of this program's
561 control) because gen_fit_image.sh uses WINE, which is not installed in
562 the chroot. (There is a linux version of FIT, but it requires Open GL,
563 which is also not installed in the chroot.)
564
565 Params:
566 status variant_status object tracking our board, variant, etc.
567
568 Returns:
569 True if the script succeeded, False otherwise
570 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700571 logging.info('Running step add_fitimage')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700572 add_fitimage_sh = os.path.expanduser(os.path.join(
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700573 '~/trunk/src', status.fitimage_dir, 'files/add_fitimage.sh'))
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700574 rc = bool(run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700575 [add_fitimage_sh,
576 status.variant,
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700577 status.bug]))
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700578 if rc:
579 fitimage_dir = os.path.join('~/trunk/src', status.fitimage_dir)
580 status.commits['fitimage'] = get_git_commit_data(fitimage_dir)
581 return rc
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700582
583
584def gen_fit_image_outside_chroot(status):
585 """Tell the user to run gen_fit_image.sh outside the chroot
586
587 As noted for add_Fitimage(), gen_fit_image.sh cannot run inside the
588 chroot. This function tells the user to run gen_fit_image.sh in
589 their normal environment, and then come back (--continue) when that
590 is done.
591
592 Params:
593 status variant_status object tracking our board, variant, etc.
594
595 Returns:
596 True
597 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700598 logging.info('Running step gen_fit_image_outside_chroot')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700599 fit_image_files = check_fit_image_files(status)
600 # If the list is empty, then `not` of the list is True, so the files
601 # we need are all present and we can continue.
602 if not fit_image_files:
603 return True
604
605 logging.info('The following files need to be generated:')
606 for filename in fit_image_files:
607 logging.info('* %s', filename)
608 logging.info('The fitimage sources are ready for gen_fit_image.sh to process.')
609 logging.info('gen_fit_image.sh cannot run inside the chroot. Please open a new terminal')
610 logging.info('window, change to the directory where gen_fit_image.sh is located, and run')
Paul Fagerburg55dabf42020-01-27 15:30:09 -0700611 logging.info(status.fitimage_cmd, status.variant)
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700612 logging.info('Then re-start this program with --continue.')
613 logging.info('If your chroot is based in ~/chromiumos, then the folder you want is')
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700614 logging.info('~/chromiumos/src/%s/asset_generation', status.fitimage_dir)
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700615 return False
616
617
618def check_fit_image_files(status):
619 """Check if the fitimage has been generated
620
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700621 This function is not called directly as a step, and so it doesn't need
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700622 to produce any error messages to the user (except with --verbose).
623 gen_fit_image_outside_chroot will call this function to see if the
624 fitimage files exist, and if not, then that function will print the
625 message about how the user needs to run gen_fit_image.sh outside the
626 chroot.
627
628 Params:
629 status variant_status object tracking our board, variant, etc.
630
631 Returns:
632 List of files that *DO NOT* exist and need to be created, [] if
633 all files are present.
634 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700635 outputs_dir = os.path.expanduser(os.path.join(
636 '~/trunk/src', status.fitimage_dir, 'asset_generation/outputs'))
637 logging.debug('outputs_dir = "%s"', outputs_dir)
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700638
639 files = []
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700640 if not file_exists(outputs_dir, 'fitimage-' + status.variant + '.bin'):
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700641 files.append('fitimage-' + status.variant + '.bin')
642
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700643 if not file_exists(outputs_dir,
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700644 'fitimage-' + status.variant + '-versions.txt'):
645 files.append('fitimage-' + status.variant + '-versions.txt')
646
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700647 if not file_exists(outputs_dir, 'fit.log'):
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700648 files.append('fit.log')
649
650 return files
651
652
653def move_fitimage_file(fitimage_dir, filename):
654 """Move fitimage files from create-place to commit-place
655
656 commit_fitimage needs to move the fitimage files from the place where
657 they were created to a different directory in the tree. This utility
658 function handles joining paths and calling a file move function.
659
660 Params:
661 fitimage_dir Directory where the fitimage files are
662 filename Name of the file being moved
663
664 Returns:
665 True if the move succeeded, False if it failed
666 """
667 src_dir = os.path.join(fitimage_dir, 'asset_generation/outputs')
668 src = os.path.join(src_dir, filename)
669 dest_dir = os.path.join(fitimage_dir, 'files')
670 dest = os.path.join(dest_dir, filename)
671 # If src does not exist and dest does, the move is already done => success!
672 if not file_exists(src_dir, filename) and file_exists(dest_dir, filename):
673 logging.debug('move "%s", "%s" unnecessary because dest exists and'
674 ' src does not exist', src, dest)
675 return True
676
677 logging.debug('move "%s", "%s"', src, dest)
678 return shutil.move(src, dest)
679
680
681def commit_fitimage(status):
682 """Move the fitimage files and add them to a git commit
683
684 This function moves the fitimage binary and -versions files from
685 asset_generation/outputs to files/ and then adds those files and
686 fit.log to the existing git commit.
687
688 Params:
689 status variant_status object tracking our board, variant, etc.
690
691 Returns:
692 True if the copy, git add, and git commit --amend all succeeded.
693 False if something failed.
694 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700695 logging.info('Running step commit_fitimage')
696 fitimage_dir = os.path.expanduser(os.path.join('~/trunk/src', status.fitimage_dir))
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700697 logging.debug('fitimage_dir = "%s"', fitimage_dir)
698
699 # The copy operation will check that the source file exists, so no
700 # need to check separately.
701 if not move_fitimage_file(fitimage_dir,
702 'fitimage-' + status.variant + '.bin'):
703 logging.error('Moving fitimage binary failed')
704 return False
705
706 if not move_fitimage_file(fitimage_dir,
707 'fitimage-' + status.variant + '-versions.txt'):
708 logging.error('Moving fitimage versions.txt failed')
709 return False
710
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700711 # TODO(pfagerburg) volteer also needs files/blobs/descriptor-${VARIANT}.bin
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700712 if not bool(run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700713 ['git', 'add',
714 'asset_generation/outputs/fit.log',
715 'files/fitimage-' + status.variant + '.bin',
716 'files/fitimage-' + status.variant + '-versions.txt'
717 ],
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700718 cwd=fitimage_dir)):
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700719 return False
720
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700721 return bool(run_process(['git', 'commit', '--amend', '--no-edit'],
722 cwd=fitimage_dir))
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700723
724
725def create_initial_ec_image(status):
Paul Fagerburge868e832020-01-22 17:14:04 -0700726 """Create an EC image for the variant as a clone of the reference board
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700727
728 This function calls create_initial_ec_image.sh, which will clone the
Paul Fagerburge868e832020-01-22 17:14:04 -0700729 reference board to create the variant. The shell script will build the
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700730 EC code for the variant, but the repo upload hook insists that we
731 have done a `make buildall` before it will allow an upload, so this
732 function does the buildall.
733
734 Params:
735 status variant_status object tracking our board, variant, etc.
736
737 Returns:
738 True if the script and test build succeeded, False if something failed
739 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700740 logging.info('Running step create_initial_ec_image')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700741 create_initial_ec_image_sh = os.path.expanduser(
742 '~/trunk/src/platform/dev/contrib/variant/create_initial_ec_image.sh')
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700743 if not bool(run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700744 [create_initial_ec_image_sh,
745 status.board,
746 status.variant,
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700747 status.bug])):
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700748 return False
749
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700750 ec_src_dir = os.path.expanduser('~/trunk/src/platform/ec/board')
751 # No need to `if rc:` because we already tested the run_process result above
752 status.commits['ec_image'] = get_git_commit_data(ec_src_dir)
753
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700754 # create_initial_ec_image.sh will build the ec.bin for this variant
755 # if successful.
756 ec = os.path.expanduser('~/trunk/src/platform/ec')
757 logging.debug('ec = "%s"', ec)
758 ec_bin = 'build/' + status.variant + '/ec.bin'
759 logging.debug('ec.bin = "%s"', ec_bin)
760
761 return file_exists(ec, ec_bin)
762
763
764def ec_buildall(status):
765 """Do a make buildall -j for the EC, which is required for repo upload
766
767 The upload hook checks to ensure that the entire EC codebase builds
768 without error, so we have to run make buildall -j before uploading.
769
770 Params:
771 status variant_status object tracking our board, variant, etc.
772
773 Returns:
774 True if the script and test build succeeded, False if something failed
775 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700776 logging.info('Running step ec_buildall')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700777 del status # unused parameter
778 ec = os.path.expanduser('~/trunk/src/platform/ec')
779 logging.debug('ec = "%s"', ec)
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700780 return bool(run_process(['make', 'buildall', '-j'], cwd=ec))
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700781
782
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700783def add_variant_to_public_yaml(status):
784 """Add the new variant to the public model.yaml file
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700785
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700786 This function calls add_variant_to_yaml.sh to add the new variant to
787 the public model.yaml file.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700788
789 Params:
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700790 status variant_status object tracking our board, variant, etc.
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700791
792 Returns:
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700793 True if the script succeeded, False is something failed
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700794 """
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700795 logging.info('Running step add_variant_to_public_yaml')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700796 add_variant_to_yaml_sh = os.path.expanduser(
797 '~/trunk/src/platform/dev/contrib/variant/add_variant_to_yaml.sh')
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700798 rc = bool(run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700799 [add_variant_to_yaml_sh,
Paul Fagerburge868e832020-01-22 17:14:04 -0700800 status.base,
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700801 status.variant,
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700802 status.bug]))
803 if rc:
804 status.commits['public_yaml'] = get_git_commit_data('~/trunk/src/overlays')
805 return rc
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700806
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700807
808def add_variant_to_private_yaml(status):
809 """Add the new variant to the private model.yaml file
810
811 This function calls add_variant.sh to add the new variant to
812 the private model.yaml file.
813
814 Params:
815 status variant_status object tracking our board, variant, etc.
816
817 Returns:
818 True if the script succeeded, False is something failed
819 """
820 logging.info('Running step add_variant_to_private_yaml')
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700821 add_variant_sh = os.path.expanduser(os.path.join(status.private_yaml_dir, 'add_variant.sh'))
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700822 rc = bool(run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700823 [add_variant_sh,
824 status.variant,
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700825 status.bug]))
Paul Fagerburg1d043c32020-02-03 08:57:08 -0700826 if rc:
827 status.commits['private_yaml'] = get_git_commit_data(status.private_yaml_dir)
828 return rc
829
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700830
831
832def build_yaml(status):
833 """Build config files from the yaml files
834
835 This function builds the yaml files into the JSON and C code that
836 mosys and other tools use, then verifies that the new variant's name
837 shows up in all of the output files.
838
839 Params:
840 status variant_status object tracking our board, variant, etc.
841
842 Returns:
843 True if the scripts and build succeeded, False is something failed
844 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700845 logging.info('Running step build_yaml')
846 if not bool(run_process([status.emerge_cmd] + status.yaml_emerge_pkgs)):
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700847 return False
848
849 # Check generated files for occurences of the variant name.
850 # Each file should have at least one occurence, so use `grep -c` to
851 # count the occurrences of the variant name in each file.
852 # The results will be something like this:
853 # config.json:10
854 # yaml/config.c:6
855 # yaml/config.yaml:27
856 # yaml/model.yaml:6
857 # yaml/private-model.yaml:10
858 # If the variant name doesn't show up in the file, then the count
859 # will be 0, so we would see, e.g.
860 # config.json:0
Paul Fagerburge868e832020-01-22 17:14:04 -0700861 # Note that we leave out yaml/model.yaml (the public one) because for
862 # some boards, there is nothing in the public yaml file.
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700863 # We gather the output from grep, then look for any of the strings
864 # ending in :0. If none of them match, then we're good, but if even
865 # one of them ends with :0 then there was a problem with generating
866 # the files from the yaml.
Paul Fagerburge868e832020-01-22 17:14:04 -0700867 chromeos_config = '/build/' + status.base + '/usr/share/chromeos-config'
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700868 logging.debug('chromeos_config = "%s"', chromeos_config)
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700869 grep = run_process(
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700870 ['grep',
Paul Fagerburge868e832020-01-22 17:14:04 -0700871 '-ci',
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700872 status.variant,
873 'config.json',
874 'yaml/config.c',
875 'yaml/config.yaml',
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700876 'yaml/private-model.yaml'], cwd=chromeos_config, capture_output=True)
877
878 if grep is None:
879 return False
880
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700881 return not bool([s for s in grep if re.search(r':0$', s)])
882
883
884def emerge_all(status):
885 """Build the coreboot BIOS and EC code for the new variant
886
887 Params:
888 status variant_status object tracking our board, variant, etc.
889
890 Returns:
891 True if the build succeeded, False if something failed
892 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700893 logging.info('Running step emerge_all')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700894 cros_workon(status, 'start')
895 environ = os.environ.copy()
896 environ['FW_NAME'] = status.variant
897 # Build up the command for emerge from all the packages in the list
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700898 emerge_cmd_and_params = [status.emerge_cmd] + status.emerge_pkgs
899 if not bool(run_process(emerge_cmd_and_params, env=environ)):
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700900 return False
901
902 cros_workon(status, 'stop')
Paul Fagerburge868e832020-01-22 17:14:04 -0700903 build_path = '/build/' + status.base + '/firmware'
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700904 logging.debug('build_path = "%s"', build_path)
905 if not file_exists(build_path, 'image-' + status.variant + '.bin'):
906 logging.error('emerge failed because image-%s.bin does not exist',
907 status.variant)
908 return False
909
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700910 if not file_exists(build_path, 'image-' + status.variant + '.serial.bin'):
911 logging.error('emerge failed because image-%s.serial.bin does not exist',
912 status.variant)
913 return False
914
915 return True
916
917
918def push_coreboot(status):
919 """Push the coreboot CL to coreboot.org
920
921 Params:
922 status variant_status object tracking our board, variant, etc.
923
924 Returns:
925 True if the build succeeded, False if something failed
926 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700927 logging.info('Running step push_coreboot')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700928 del status # unused parameter
929 logging.error('TODO (pfagerburg): implement push_coreboot')
930 return True
931
932
933def upload_CLs(status):
934 """Upload all CLs to chromiumos
935
936 Params:
937 status variant_status object tracking our board, variant, etc.
938
939 Returns:
940 True if the build succeeded, False if something failed
941 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700942 logging.info('Running step upload_CLs')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700943 del status # unused parameter
944 logging.error('TODO (pfagerburg): implement upload_CLs')
945 return True
946
947
948def find_coreboot_upstream(status):
949 """Find the coreboot CL after it has been upstreamed to chromiumos
950
951 Params:
952 status variant_status object tracking our board, variant, etc.
953
954 Returns:
955 True if the build succeeded, False if something failed
956 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700957 logging.info('Running step find_coreboot_upstream')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700958 del status # unused parameter
959 logging.error('TODO (pfagerburg): implement find_coreboot_upstream')
960 return True
961
962
963def add_cq_depends(status):
964 """Add Cq-Depends to all of the CLs in chromiumos
965
966 The CL in coreboot needs to be pushed to coreboot.org, get merged,
967 and then get upstreamed into the chromiumos tree before the other
968 CLs can cq-depend on it and pass CQ.
969
970 Params:
971 status variant_status object tracking our board, variant, etc.
972
973 Returns:
974 True if the build succeeded, False if something failed
975 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700976 logging.info('Running step add_cq_depends')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700977 del status # unused parameter
978 logging.error('TODO (pfagerburg): implement add_cq_depends')
979 return True
980
981
982def clean_up(status):
983 """Final clean-up, including delete the status file
984
985 Params:
986 status variant_status object tracking our board, variant, etc.
987
988 Returns:
989 True
990 """
Paul Fagerburgbab5dde2020-01-10 15:10:29 -0700991 logging.info('Running step clean_up')
Paul Fagerburg3b534f92019-11-07 15:05:22 -0700992 status.rm()
993 return True
994
995
996if __name__ == '__main__':
997 sys.exit(not int(main()))