new_variant: improve support for multiple baseboards

Rather than have hard-coded lists, maps, and if statements in the
code for each baseboard supported, move the board-specific code
out into modules names for the baseboard. The main program imports
the code specific to the baseboard to get the list of steps to
perform, packages to cros_workon, packages to emerge, directories
for private overlays, etc. Remove the gradual build-up of `workon`
and `emerge` lists, and instead get those from the yaml file that
is created when we start a new variant.

Change run_process so that it can capture the output or just return
a simple pass/fail (was the return code zero or non-zero?) from
running the process. This allows removing the separate call to
subprocess.check_output (when the program calls out to grep), and
makes it easier to add future functionality that relies on being
able to capture and parse output from external programs.

Update the unit test for variant_status.

Fix a bad string comparison in add_variant_to_yaml.sh

Update copyright years.

BUG=b:146646594
TEST=Create new variants of hatch, volteer, and qwerty.

$ ./new_variant.py --board=hatch --variant=sushi
Hatch will stop mid-way and tell you to run gen_fit_image.sh outside
the chroot. Do that, and then
$ ./new_variant.py --continue
Hatch will continue to generate files and build them, eventually
finishing with success.

$ ./new_variant.py --board=volteer --variant=ripto
Volteer will start, but since not all of the repos are in place yet,
the program will fail when it tries to create the coreboot variant.
This is acceptable.

$ ./new_variant.py --board=qwerty --variant=aoeui
new_variant.py will report that qwerty is unsupported.

Verify that --continue gives an error when ~/.new_variant.yaml does
not exist, and that when it does exist, then specifying --board and
--variant also results in an error.

Change-Id: Ie3a60b74ff2b815ac6b00a9a45c2136954e8aa94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/1995753
Tested-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Jacob Rasmussen <jacobraz@google.com>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
diff --git a/contrib/variant/volteer.py b/contrib/variant/volteer.py
new file mode 100644
index 0000000..6744c80
--- /dev/null
+++ b/contrib/variant/volteer.py
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+"""Define steps, package names, and directories for creating a Volteer variant
+
+Copyright 2020 The Chromium OS Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+"""
+
+from __future__ import print_function
+import step_names
+
+# List of steps (named in step_names.py) to run in sequence to create
+# the new variant of the baseboard
+step_list = [
+    step_names.CB_VARIANT,
+    # TODO(b/147483696)
+    # step_names.CB_CONFIG,
+    step_names.ADD_FIT,
+    step_names.GEN_FIT,
+    step_names.COMMIT_FIT,
+    step_names.EC_IMAGE,
+    step_names.EC_BUILDALL,
+    step_names.ADD_YAML,
+    step_names.BUILD_YAML,
+    step_names.EMERGE,
+    step_names.PUSH,
+    step_names.UPLOAD,
+    step_names.FIND,
+    step_names.CQ_DEPEND,
+    step_names.CLEAN_UP]
+
+# Package name for FSP
+fsp = 'intel-tglfsp'
+
+# Package name for the fitimage
+fitimage_pkg = 'coreboot-private-files-baseboard-volteer'
+
+# Directory for fitimage; append '~/trunk/src/'' in chroot, '~/chromiumos/src' outside
+fitimage_dir = 'private-overlays/baseboard-volteer-private/sys-boot/'\
+    'coreboot-private-files-baseboard-volteer'
+
+# List of packages to cros_workon
+workon_pkgs = ['coreboot', 'libpayload', 'vboot_reference', 'depthcharge', fsp,
+    fitimage_pkg, 'chromeos-ec', 'chromeos-config-bsp-volteer-private']
+
+# The emerge command
+emerge_cmd = 'emerge-volteer'
+
+# List of packages to emerge
+emerge_pkgs = ['coreboot', 'libpayload', 'vboot_reference', 'depthcharge', fsp,
+    fitimage_pkg, 'chromeos-ec', 'chromeos-config-bsp-volteer-private',
+    'chromeos-config', 'chromeos-config-bsp', 'chromeos-config-bsp-volteer',
+    'coreboot-private-files', fitimage_pkg, 'chromeos-bootimage']
+
+# List of packages to emerge just to build the yaml
+yaml_emerge_pkgs = ['chromeos-config-bsp', 'chromeos-config',
+    'chromeos-config-bsp-volteer', 'chromeos-config-bsp-volteer-private']
+
+# Directory for the private yaml file
+private_yaml_dir = '~/trunk/src/private-overlays/overlay-volteer-private/'\
+    'chromeos-base/chromeos-config-bsp-volteer-private'