Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 1 | # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """Sysroot controller.""" |
| 6 | |
Michael Mortensen | 4ccfb08 | 2020-01-22 16:24:03 -0700 | [diff] [blame] | 7 | import os |
| 8 | |
Alex Klein | 6b499df | 2020-11-19 14:26:56 -0700 | [diff] [blame] | 9 | from chromite.api.gen.chromiumos import common_pb2 |
Alex Klein | 8cb365a | 2019-05-15 16:24:53 -0600 | [diff] [blame] | 10 | from chromite.api import controller |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 11 | from chromite.api import faux |
Alex Klein | 2b23672 | 2019-06-19 15:44:26 -0600 | [diff] [blame] | 12 | from chromite.api import validate |
Alex Klein | a9d500b | 2019-04-22 15:37:51 -0600 | [diff] [blame] | 13 | from chromite.api.controller import controller_util |
Will Bradley | 7e5b8c1 | 2019-07-30 12:44:15 -0600 | [diff] [blame] | 14 | from chromite.api.metrics import deserialize_metrics_log |
LaMont Jones | feffd1b | 2020-08-05 18:24:59 -0600 | [diff] [blame] | 15 | from chromite.lib import binpkg |
George Engelbrecht | c9a8e81 | 2021-06-16 18:14:17 -0600 | [diff] [blame] | 16 | from chromite.lib import build_target_lib |
| 17 | from chromite.lib import chroot_lib |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 18 | from chromite.lib import cros_build_lib |
Alex Klein | a9d6460 | 2019-05-17 14:55:37 -0600 | [diff] [blame] | 19 | from chromite.lib import cros_logging as logging |
Michael Mortensen | 798ee19 | 2020-01-17 13:04:43 -0700 | [diff] [blame] | 20 | from chromite.lib import goma_lib |
Michael Mortensen | 3f6b4bd | 2020-02-07 14:16:43 -0700 | [diff] [blame] | 21 | from chromite.lib import osutils |
Alex Klein | a9d6460 | 2019-05-17 14:55:37 -0600 | [diff] [blame] | 22 | from chromite.lib import portage_util |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 23 | from chromite.lib import sysroot_lib |
| 24 | from chromite.service import sysroot |
Will Bradley | 7e5b8c1 | 2019-07-30 12:44:15 -0600 | [diff] [blame] | 25 | from chromite.utils import metrics |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 26 | |
| 27 | _ACCEPTED_LICENSES = '@CHROMEOS' |
| 28 | |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 29 | |
George Engelbrecht | c9a8e81 | 2021-06-16 18:14:17 -0600 | [diff] [blame] | 30 | def ExampleGetResponse(): |
| 31 | """Give an example response to assemble upstream in caller artifacts.""" |
| 32 | uabs = common_pb2.UploadedArtifactsByService |
| 33 | cabs = common_pb2.ArtifactsByService |
| 34 | return uabs.Sysroot(artifacts=[ |
| 35 | uabs.Sysroot.ArtifactPaths( |
| 36 | artifact_type=cabs.Sysroot.ArtifactType.DEBUG_SYMBOLS, |
| 37 | paths=[ |
| 38 | common_pb2.Path( |
| 39 | path='/tmp/debug.tgz', location=common_pb2.Path.OUTSIDE) |
| 40 | ], |
| 41 | ), |
| 42 | uabs.Sysroot.ArtifactPaths( |
| 43 | artifact_type=cabs.Sysroot.ArtifactType.BREAKPAD_DEBUG_SYMBOLS, |
| 44 | paths=[ |
| 45 | common_pb2.Path( |
| 46 | path='/tmp/debug_breakpad.tar.xz', |
| 47 | location=common_pb2.Path.OUTSIDE) |
| 48 | ]) |
| 49 | ]) |
| 50 | |
| 51 | |
| 52 | def GetArtifacts(in_proto: common_pb2.ArtifactsByService.Sysroot, |
| 53 | chroot: chroot_lib.Chroot, sysroot_class: sysroot_lib.Sysroot, |
| 54 | build_target: build_target_lib.BuildTarget, output_dir: str) -> list: |
| 55 | """Builds and copies sysroot artifacts to specified output_dir. |
| 56 | |
| 57 | Copies sysroot artifacts to output_dir, returning a list of (output_dir: str) |
| 58 | paths to the desired files. |
| 59 | |
| 60 | Args: |
| 61 | in_proto: Proto request defining reqs. |
| 62 | chroot: The chroot class used for these artifacts. |
| 63 | sysroot_class: The sysroot class used for these artifacts. |
| 64 | build_target: The build target used for these artifacts. |
| 65 | output_dir: The path to write artifacts to. |
| 66 | |
| 67 | Returns: |
| 68 | A list of dictionary mappings of ArtifactType to list of paths. |
| 69 | """ |
| 70 | generated = [] |
| 71 | for output_artifact in in_proto.output_artifacts: |
Pi-Hsun Shih | 8d9c8e4 | 2021-06-30 03:27:28 +0000 | [diff] [blame] | 72 | if (in_proto.ArtifactType.BREAKPAD_DEBUG_SYMBOLS |
| 73 | in output_artifact.artifact_types): |
| 74 | result_path = sysroot.BundleBreakpadSymbols(chroot, sysroot_class, |
| 75 | build_target, output_dir) |
| 76 | if result_path: |
| 77 | generated.append({ |
| 78 | 'paths': [result_path], |
| 79 | 'type': in_proto.ArtifactType.BREAKPAD_DEBUG_SYMBOLS, |
| 80 | }) |
| 81 | if in_proto.ArtifactType.DEBUG_SYMBOLS in output_artifact.artifact_types: |
| 82 | result_path = sysroot.BundleDebugSymbols(chroot, sysroot_class, |
| 83 | build_target, output_dir) |
| 84 | if result_path: |
| 85 | generated.append({ |
| 86 | 'paths': [result_path], |
| 87 | 'type': in_proto.ArtifactType.DEBUG_SYMBOLS, |
| 88 | }) |
George Engelbrecht | c9a8e81 | 2021-06-16 18:14:17 -0600 | [diff] [blame] | 89 | return generated |
| 90 | |
| 91 | |
| 92 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 93 | @faux.all_empty |
Alex Klein | 2b23672 | 2019-06-19 15:44:26 -0600 | [diff] [blame] | 94 | @validate.require('build_target.name') |
Alex Klein | 231d2da | 2019-07-22 16:44:45 -0600 | [diff] [blame] | 95 | @validate.validation_complete |
| 96 | def Create(input_proto, output_proto, _config): |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 97 | """Create or replace a sysroot.""" |
| 98 | update_chroot = not input_proto.flags.chroot_current |
| 99 | replace_sysroot = input_proto.flags.replace |
| 100 | |
Alex Klein | 26e472b | 2020-03-10 14:35:01 -0600 | [diff] [blame] | 101 | build_target = controller_util.ParseBuildTarget(input_proto.build_target, |
| 102 | input_proto.profile) |
LaMont Jones | feffd1b | 2020-08-05 18:24:59 -0600 | [diff] [blame] | 103 | package_indexes = [ |
| 104 | binpkg.PackageIndexInfo.from_protobuf(x) |
| 105 | for x in input_proto.package_indexes |
| 106 | ] |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 107 | run_configs = sysroot.SetupBoardRunConfig( |
LaMont Jones | feffd1b | 2020-08-05 18:24:59 -0600 | [diff] [blame] | 108 | force=replace_sysroot, upgrade_chroot=update_chroot, |
| 109 | package_indexes=package_indexes) |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 110 | |
| 111 | try: |
| 112 | created = sysroot.Create(build_target, run_configs, |
| 113 | accept_licenses=_ACCEPTED_LICENSES) |
| 114 | except sysroot.Error as e: |
Mike Frysinger | 6b5c3cd | 2019-08-27 16:51:00 -0400 | [diff] [blame] | 115 | cros_build_lib.Die(e) |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 116 | |
| 117 | output_proto.sysroot.path = created.path |
Alex Klein | 26e472b | 2020-03-10 14:35:01 -0600 | [diff] [blame] | 118 | output_proto.sysroot.build_target.name = build_target.name |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 119 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 120 | return controller.RETURN_CODE_SUCCESS |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 121 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 122 | |
Michael Mortensen | 98592f6 | 2019-09-27 13:34:18 -0600 | [diff] [blame] | 123 | @faux.all_empty |
| 124 | @validate.require('build_target.name') |
| 125 | @validate.validation_complete |
| 126 | def CreateSimpleChromeSysroot(input_proto, output_proto, _config): |
| 127 | """Create a sysroot for SimpleChrome to use.""" |
| 128 | build_target_name = input_proto.build_target.name |
| 129 | use_flags = input_proto.use_flags |
| 130 | |
| 131 | sysroot_tar_path = sysroot.CreateSimpleChromeSysroot(build_target_name, |
| 132 | use_flags) |
| 133 | # By assigning this Path variable to the tar path, the tar file will be |
| 134 | # copied out to the input_proto's ResultPath location. |
| 135 | output_proto.sysroot_archive.path = sysroot_tar_path |
Alex Klein | 6b499df | 2020-11-19 14:26:56 -0700 | [diff] [blame] | 136 | output_proto.sysroot_archive.location = common_pb2.Path.INSIDE |
Michael Mortensen | 98592f6 | 2019-09-27 13:34:18 -0600 | [diff] [blame] | 137 | |
| 138 | return controller.RETURN_CODE_SUCCESS |
| 139 | |
| 140 | |
Michael Mortensen | 3f6b4bd | 2020-02-07 14:16:43 -0700 | [diff] [blame] | 141 | @faux.all_empty |
| 142 | @validate.require('build_target.name', 'packages') |
Alex Klein | 45b7343 | 2020-09-23 13:51:20 -0600 | [diff] [blame] | 143 | @validate.require_each('packages', ['category', 'package_name']) |
Michael Mortensen | 3f6b4bd | 2020-02-07 14:16:43 -0700 | [diff] [blame] | 144 | @validate.validation_complete |
| 145 | def GenerateArchive(input_proto, output_proto, _config): |
| 146 | """Generate a sysroot. Typically used by informational builders.""" |
| 147 | build_target_name = input_proto.build_target.name |
| 148 | pkg_list = [] |
| 149 | for package in input_proto.packages: |
| 150 | pkg_list.append('%s/%s' % (package.category, package.package_name)) |
| 151 | |
| 152 | with osutils.TempDir(delete=False) as temp_output_dir: |
| 153 | sysroot_tar_path = sysroot.GenerateArchive(temp_output_dir, |
| 154 | build_target_name, |
| 155 | pkg_list) |
| 156 | |
| 157 | # By assigning this Path variable to the tar path, the tar file will be |
| 158 | # copied out to the input_proto's ResultPath location. |
| 159 | output_proto.sysroot_archive.path = sysroot_tar_path |
Alex Klein | 6b499df | 2020-11-19 14:26:56 -0700 | [diff] [blame] | 160 | output_proto.sysroot_archive.location = common_pb2.Path.INSIDE |
Michael Mortensen | 3f6b4bd | 2020-02-07 14:16:43 -0700 | [diff] [blame] | 161 | |
| 162 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 163 | def _MockFailedPackagesResponse(_input_proto, output_proto, _config): |
| 164 | """Mock error response that populates failed packages.""" |
| 165 | pkg = output_proto.failed_packages.add() |
| 166 | pkg.package_name = 'package' |
| 167 | pkg.category = 'category' |
| 168 | pkg.version = '1.0.0_rc-r1' |
| 169 | |
| 170 | pkg2 = output_proto.failed_packages.add() |
| 171 | pkg2.package_name = 'bar' |
| 172 | pkg2.category = 'foo' |
| 173 | pkg2.version = '3.7-r99' |
| 174 | |
| 175 | |
| 176 | @faux.empty_success |
| 177 | @faux.error(_MockFailedPackagesResponse) |
Alex Klein | 2b23672 | 2019-06-19 15:44:26 -0600 | [diff] [blame] | 178 | @validate.require('sysroot.path', 'sysroot.build_target.name') |
Alex Klein | 231d2da | 2019-07-22 16:44:45 -0600 | [diff] [blame] | 179 | @validate.exists('sysroot.path') |
| 180 | @validate.validation_complete |
| 181 | def InstallToolchain(input_proto, output_proto, _config): |
Alex Klein | 2b23672 | 2019-06-19 15:44:26 -0600 | [diff] [blame] | 182 | """Install the toolchain into a sysroot.""" |
Chris McDonald | 68faa2a | 2020-01-13 12:23:05 -0700 | [diff] [blame] | 183 | compile_source = ( |
| 184 | input_proto.flags.compile_source or input_proto.flags.toolchain_changed) |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 185 | |
| 186 | sysroot_path = input_proto.sysroot.path |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 187 | |
Alex Klein | 26e472b | 2020-03-10 14:35:01 -0600 | [diff] [blame] | 188 | build_target = controller_util.ParseBuildTarget( |
| 189 | input_proto.sysroot.build_target) |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 190 | target_sysroot = sysroot_lib.Sysroot(sysroot_path) |
Alex Klein | 6682ae1 | 2019-06-25 13:50:32 -0600 | [diff] [blame] | 191 | run_configs = sysroot.SetupBoardRunConfig(usepkg=not compile_source) |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 192 | |
Alex Klein | a9d6460 | 2019-05-17 14:55:37 -0600 | [diff] [blame] | 193 | _LogBinhost(build_target.name) |
| 194 | |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 195 | try: |
| 196 | sysroot.InstallToolchain(build_target, target_sysroot, run_configs) |
| 197 | except sysroot_lib.ToolchainInstallError as e: |
| 198 | # Error installing - populate the failed package info. |
| 199 | for package in e.failed_toolchain_info: |
| 200 | package_info = output_proto.failed_packages.add() |
Alex Klein | a9d500b | 2019-04-22 15:37:51 -0600 | [diff] [blame] | 201 | controller_util.CPVToPackageInfo(package, package_info) |
Alex Klein | da35fcf | 2019-03-07 16:01:15 -0700 | [diff] [blame] | 202 | |
Alex Klein | 8cb365a | 2019-05-15 16:24:53 -0600 | [diff] [blame] | 203 | return controller.RETURN_CODE_UNSUCCESSFUL_RESPONSE_AVAILABLE |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 204 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 205 | return controller.RETURN_CODE_SUCCESS |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 206 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 207 | |
| 208 | @faux.empty_success |
| 209 | @faux.error(_MockFailedPackagesResponse) |
Alex Klein | 566d80e | 2019-09-24 12:27:58 -0600 | [diff] [blame] | 210 | @validate.require('sysroot.build_target.name') |
| 211 | @validate.exists('sysroot.path') |
Alex Klein | 45b7343 | 2020-09-23 13:51:20 -0600 | [diff] [blame] | 212 | @validate.require_each('packages', ['category', 'package_name']) |
| 213 | @validate.require_each('use_flags', ['flag']) |
Alex Klein | 231d2da | 2019-07-22 16:44:45 -0600 | [diff] [blame] | 214 | @validate.validation_complete |
Will Bradley | 7e5b8c1 | 2019-07-30 12:44:15 -0600 | [diff] [blame] | 215 | @metrics.collect_metrics |
Alex Klein | 231d2da | 2019-07-22 16:44:45 -0600 | [diff] [blame] | 216 | def InstallPackages(input_proto, output_proto, _config): |
Alex Klein | 2b23672 | 2019-06-19 15:44:26 -0600 | [diff] [blame] | 217 | """Install packages into a sysroot, building as necessary and permitted.""" |
Chris McDonald | 68faa2a | 2020-01-13 12:23:05 -0700 | [diff] [blame] | 218 | compile_source = ( |
| 219 | input_proto.flags.compile_source or input_proto.flags.toolchain_changed) |
LaMont Jones | 6dc755b | 2020-07-17 12:06:29 -0600 | [diff] [blame] | 220 | # Testing if Goma will support unknown compilers now. |
| 221 | use_goma = input_proto.flags.use_goma |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 222 | |
Alex Klein | 566d80e | 2019-09-24 12:27:58 -0600 | [diff] [blame] | 223 | target_sysroot = sysroot_lib.Sysroot(input_proto.sysroot.path) |
| 224 | build_target = controller_util.ParseBuildTarget( |
| 225 | input_proto.sysroot.build_target) |
Alex Klein | ca572ee | 2020-09-03 10:47:14 -0600 | [diff] [blame] | 226 | |
| 227 | # Get the package atom for each specified package. The field is optional, so |
| 228 | # error only when we cannot parse an atom for each of the given packages. |
| 229 | packages = [controller_util.PackageInfoToCPV(x).cp |
Mike Frysinger | 66ce413 | 2019-07-17 22:52:52 -0400 | [diff] [blame] | 230 | for x in input_proto.packages] |
Alex Klein | ca572ee | 2020-09-03 10:47:14 -0600 | [diff] [blame] | 231 | |
LaMont Jones | feffd1b | 2020-08-05 18:24:59 -0600 | [diff] [blame] | 232 | package_indexes = [ |
| 233 | binpkg.PackageIndexInfo.from_protobuf(x) |
| 234 | for x in input_proto.package_indexes |
| 235 | ] |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 236 | |
Navil Perez | 5766d1b | 2021-05-26 17:38:15 +0000 | [diff] [blame] | 237 | # Calculate which packages would have been merged, but don't install anything. |
| 238 | dryrun = input_proto.flags.dryrun |
| 239 | |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 240 | if not target_sysroot.IsToolchainInstalled(): |
| 241 | cros_build_lib.Die('Toolchain must first be installed.') |
| 242 | |
Alex Klein | a9d6460 | 2019-05-17 14:55:37 -0600 | [diff] [blame] | 243 | _LogBinhost(build_target.name) |
| 244 | |
Alex Klein | be0bae4 | 2019-05-06 13:01:49 -0600 | [diff] [blame] | 245 | use_flags = [u.flag for u in input_proto.use_flags] |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 246 | build_packages_config = sysroot.BuildPackagesRunConfig( |
Alex Klein | 566d80e | 2019-09-24 12:27:58 -0600 | [diff] [blame] | 247 | usepkg=not compile_source, |
| 248 | install_debug_symbols=True, |
| 249 | packages=packages, |
LaMont Jones | feffd1b | 2020-08-05 18:24:59 -0600 | [diff] [blame] | 250 | package_indexes=package_indexes, |
Alex Klein | 566d80e | 2019-09-24 12:27:58 -0600 | [diff] [blame] | 251 | use_flags=use_flags, |
Alex Klein | 5b94048 | 2019-12-26 10:38:39 -0700 | [diff] [blame] | 252 | use_goma=use_goma, |
Alex Klein | eb76da7 | 2021-03-19 10:43:09 -0600 | [diff] [blame] | 253 | incremental_build=False, |
Navil Perez | 5766d1b | 2021-05-26 17:38:15 +0000 | [diff] [blame] | 254 | setup_board=False, |
| 255 | dryrun=dryrun) |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 256 | |
| 257 | try: |
| 258 | sysroot.BuildPackages(build_target, target_sysroot, build_packages_config) |
| 259 | except sysroot_lib.PackageInstallError as e: |
Alex Klein | 2557b4f | 2019-07-11 14:34:00 -0600 | [diff] [blame] | 260 | if not e.failed_packages: |
| 261 | # No packages to report, so just exit with an error code. |
| 262 | return controller.RETURN_CODE_COMPLETED_UNSUCCESSFULLY |
| 263 | |
| 264 | # We need to report the failed packages. |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 265 | for package in e.failed_packages: |
| 266 | package_info = output_proto.failed_packages.add() |
Alex Klein | a9d500b | 2019-04-22 15:37:51 -0600 | [diff] [blame] | 267 | controller_util.CPVToPackageInfo(package, package_info) |
Alex Klein | d4e1e42 | 2019-03-18 16:00:41 -0600 | [diff] [blame] | 268 | |
Alex Klein | 8cb365a | 2019-05-15 16:24:53 -0600 | [diff] [blame] | 269 | return controller.RETURN_CODE_UNSUCCESSFUL_RESPONSE_AVAILABLE |
Alex Klein | a9d6460 | 2019-05-17 14:55:37 -0600 | [diff] [blame] | 270 | |
Navil Perez | 5766d1b | 2021-05-26 17:38:15 +0000 | [diff] [blame] | 271 | # Return without populating the response if it is a dryrun. |
| 272 | if dryrun: |
| 273 | return controller.RETURN_CODE_SUCCESS |
| 274 | |
Michael Mortensen | 798ee19 | 2020-01-17 13:04:43 -0700 | [diff] [blame] | 275 | # Copy goma logs to specified directory if there is a goma_config and |
| 276 | # it contains a log_dir to store artifacts. |
| 277 | if input_proto.goma_config.log_dir.dir: |
Michael Mortensen | 4ccfb08 | 2020-01-22 16:24:03 -0700 | [diff] [blame] | 278 | # Get the goma log directory based on the GLOG_log_dir env variable. |
| 279 | # TODO(crbug.com/1045001): Replace environment variable with query to |
| 280 | # goma object after goma refactoring allows this. |
| 281 | log_source_dir = os.getenv('GLOG_log_dir') |
| 282 | if not log_source_dir: |
| 283 | cros_build_lib.Die('GLOG_log_dir must be defined.') |
Michael Mortensen | 798ee19 | 2020-01-17 13:04:43 -0700 | [diff] [blame] | 284 | archiver = goma_lib.LogsArchiver( |
Michael Mortensen | 4ccfb08 | 2020-01-22 16:24:03 -0700 | [diff] [blame] | 285 | log_source_dir, |
Michael Mortensen | 798ee19 | 2020-01-17 13:04:43 -0700 | [diff] [blame] | 286 | dest_dir=input_proto.goma_config.log_dir.dir, |
| 287 | stats_file=input_proto.goma_config.stats_file, |
| 288 | counterz_file=input_proto.goma_config.counterz_file) |
| 289 | archiver_tuple = archiver.Archive() |
| 290 | if archiver_tuple.stats_file: |
| 291 | output_proto.goma_artifacts.stats_file = archiver_tuple.stats_file |
| 292 | if archiver_tuple.counterz_file: |
Michael Mortensen | 1c7439c | 2020-01-24 14:43:19 -0700 | [diff] [blame] | 293 | output_proto.goma_artifacts.counterz_file = archiver_tuple.counterz_file |
Michael Mortensen | 798ee19 | 2020-01-17 13:04:43 -0700 | [diff] [blame] | 294 | output_proto.goma_artifacts.log_files[:] = archiver_tuple.log_files |
| 295 | |
Will Bradley | 7e5b8c1 | 2019-07-30 12:44:15 -0600 | [diff] [blame] | 296 | # Read metric events log and pipe them into output_proto.events. |
Alex Klein | 566d80e | 2019-09-24 12:27:58 -0600 | [diff] [blame] | 297 | deserialize_metrics_log(output_proto.events, prefix=build_target.name) |
Will Bradley | 7e5b8c1 | 2019-07-30 12:44:15 -0600 | [diff] [blame] | 298 | |
Alex Klein | a9d6460 | 2019-05-17 14:55:37 -0600 | [diff] [blame] | 299 | |
| 300 | def _LogBinhost(board): |
| 301 | """Log the portage binhost for the given board.""" |
| 302 | binhost = portage_util.PortageqEnvvar('PORTAGE_BINHOST', board=board, |
| 303 | allow_undefined=True) |
| 304 | if not binhost: |
| 305 | logging.warning('Portage Binhost not found.') |
| 306 | else: |
| 307 | logging.info('Portage Binhost: %s', binhost) |