Mike Frysinger | f1ba7ad | 2022-09-12 05:42:57 -0400 | [diff] [blame] | 1 | # Copyright 2019 The ChromiumOS Authors |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """SDK chroot operations.""" |
| 6 | |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 7 | import os |
Alex Klein | 0996b46 | 2023-06-15 15:26:37 -0600 | [diff] [blame] | 8 | from typing import Dict, TYPE_CHECKING, Union |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 9 | |
Alex Klein | 231d2da | 2019-07-22 16:44:45 -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 | 231d2da | 2019-07-22 16:44:45 -0600 | [diff] [blame] | 12 | from chromite.api import validate |
Alex Klein | 71a9a1d | 2019-10-28 15:45:10 -0600 | [diff] [blame] | 13 | from chromite.api.controller import controller_util |
Bob Haarman | 0853ce9 | 2022-12-13 18:11:53 +0000 | [diff] [blame] | 14 | from chromite.api.gen.chromiumos import common_pb2 |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 15 | from chromite.lib import cros_build_lib |
| 16 | from chromite.service import sdk |
| 17 | |
| 18 | |
Alex Klein | 0996b46 | 2023-06-15 15:26:37 -0600 | [diff] [blame] | 19 | if TYPE_CHECKING: |
| 20 | from chromite.api import api_config |
| 21 | from chromite.api.gen.chromite.api import sdk_pb2 |
| 22 | |
| 23 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 24 | def _ChrootVersionResponse(_input_proto, output_proto, _config): |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 25 | """Add a fake chroot version to a successful response.""" |
| 26 | output_proto.version.version = 168 |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 27 | |
| 28 | |
Bob Haarman | 171d409 | 2023-01-10 16:44:19 +0000 | [diff] [blame] | 29 | def _BinhostCLs(_input_proto, output_proto, _config): |
| 30 | """Add fake CL identifiers to a successful response.""" |
Bob Haarman | c008260 | 2022-09-20 16:12:43 -0700 | [diff] [blame] | 31 | output_proto.cls = [ |
Bob Haarman | 171d409 | 2023-01-10 16:44:19 +0000 | [diff] [blame] | 32 | "fakecl:1", |
| 33 | "fakecl:2", |
Bob Haarman | c008260 | 2022-09-20 16:12:43 -0700 | [diff] [blame] | 34 | ] |
| 35 | |
| 36 | |
Bob Haarman | 0853ce9 | 2022-12-13 18:11:53 +0000 | [diff] [blame] | 37 | def _BuildSdkTarballResponse(_input_proto, output_proto, _config): |
| 38 | """Populate a fake BuildSdkTarballResponse.""" |
| 39 | output_proto.sdk_tarball_path.path = "/fake/sdk/tarball.tar.gz" |
| 40 | output_proto.sdk_tarball_path.location = common_pb2.Path.OUTSIDE |
| 41 | |
| 42 | |
| 43 | @faux.success(_BuildSdkTarballResponse) |
| 44 | @validate.require("chroot") |
| 45 | @validate.validation_complete |
| 46 | def BuildSdkTarball( |
Alex Klein | 0996b46 | 2023-06-15 15:26:37 -0600 | [diff] [blame] | 47 | input_proto: "sdk_pb2.BuildSdkTarballRequest", |
| 48 | output_proto: "sdk_pb2.BuildSdkTarballResponse", |
Bob Haarman | 0853ce9 | 2022-12-13 18:11:53 +0000 | [diff] [blame] | 49 | _config: "api_config.ApiConfig", |
| 50 | ) -> None: |
| 51 | chroot = controller_util.ParseChroot(input_proto.chroot) |
| 52 | output_proto.sdk_tarball_path.path = str(sdk.BuildSdkTarball(chroot)) |
| 53 | output_proto.sdk_tarball_path.location = common_pb2.Path.OUTSIDE |
| 54 | |
| 55 | |
Greg Edelston | 01ae594 | 2023-01-30 16:26:54 -0700 | [diff] [blame] | 56 | def _CreateManifestFromSdkResponse(_input_proto, output_proto, _config): |
| 57 | """Populate a fake CreateManifestFromSdkResponse.""" |
| 58 | output_proto.manifest_path.path = "/fake/sdk/tarball.tar.gz.Manifest" |
| 59 | output_proto.manifest_path.location = common_pb2.Path.Location.INSIDE |
| 60 | |
| 61 | |
| 62 | @faux.success(_CreateManifestFromSdkResponse) |
| 63 | @validate.require("chroot") |
| 64 | @validate.require("sdk_path") |
| 65 | @validate.require("dest_dir") |
| 66 | @validate.validation_complete |
| 67 | def CreateManifestFromSdk( |
Alex Klein | 0996b46 | 2023-06-15 15:26:37 -0600 | [diff] [blame] | 68 | input_proto: "sdk_pb2.CreateManifestFromSdkRequest", |
| 69 | output_proto: "sdk_pb2.CreateManifestFromSdkResponse", |
Greg Edelston | 01ae594 | 2023-01-30 16:26:54 -0700 | [diff] [blame] | 70 | _config: "api_config.ApiConfig", |
| 71 | ) -> None: |
| 72 | """Create a manifest file showing the ebuilds in an SDK.""" |
| 73 | |
| 74 | def _assert_path_is_absolute(path: str, name: str): |
| 75 | """Raise an exception if the given path is not absolute.""" |
| 76 | if not os.path.isabs(path): |
| 77 | cros_build_lib.Die(f"The {name} must be absolute; got {path}") |
| 78 | |
| 79 | _assert_path_is_absolute(input_proto.chroot.path, "chroot path") |
| 80 | _assert_path_is_absolute(input_proto.sdk_path.path, "SDK path") |
| 81 | _assert_path_is_absolute(input_proto.dest_dir.path, "destination directory") |
| 82 | |
Greg Edelston | 1f5deb6 | 2023-03-31 14:22:08 -0600 | [diff] [blame] | 83 | sdk_path = controller_util.pb2_path_to_pathlib_path( |
Greg Edelston | 01ae594 | 2023-01-30 16:26:54 -0700 | [diff] [blame] | 84 | input_proto.sdk_path, input_proto.chroot |
| 85 | ) |
Greg Edelston | 1f5deb6 | 2023-03-31 14:22:08 -0600 | [diff] [blame] | 86 | dest_dir = controller_util.pb2_path_to_pathlib_path( |
Greg Edelston | 01ae594 | 2023-01-30 16:26:54 -0700 | [diff] [blame] | 87 | input_proto.dest_dir, input_proto.chroot |
| 88 | ) |
| 89 | |
| 90 | manifest_path = sdk.CreateManifestFromSdk(sdk_path, dest_dir) |
| 91 | output_proto.manifest_path.path = str(manifest_path) |
| 92 | output_proto.manifest_path.location = common_pb2.Path.Location.OUTSIDE |
| 93 | |
| 94 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 95 | @faux.success(_ChrootVersionResponse) |
| 96 | @faux.empty_error |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 97 | def Create( |
Alex Klein | 0996b46 | 2023-06-15 15:26:37 -0600 | [diff] [blame] | 98 | input_proto: "sdk_pb2.CreateRequest", |
| 99 | output_proto: "sdk_pb2.CreateResponse", |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 100 | config: "api_config.ApiConfig", |
| 101 | ) -> Union[int, None]: |
| 102 | """Chroot creation, includes support for replacing an existing chroot. |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 103 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 104 | Args: |
Alex Klein | 611dddd | 2022-10-11 17:02:01 -0600 | [diff] [blame] | 105 | input_proto: The input proto. |
| 106 | output_proto: The output proto. |
| 107 | config: The API call config. |
Kevin Shelton | 50dabff | 2022-04-09 11:29:53 -0700 | [diff] [blame] | 108 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 109 | Returns: |
Alex Klein | 611dddd | 2022-10-11 17:02:01 -0600 | [diff] [blame] | 110 | An error code, None otherwise. |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 111 | """ |
| 112 | replace = not input_proto.flags.no_replace |
| 113 | bootstrap = input_proto.flags.bootstrap |
Brian Norris | 67374d8 | 2023-05-01 12:31:12 -0700 | [diff] [blame] | 114 | chroot = controller_util.ParseChroot(input_proto.chroot) |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 115 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 116 | sdk_version = input_proto.sdk_version |
| 117 | skip_chroot_upgrade = input_proto.skip_chroot_upgrade |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 118 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 119 | if config.validate_only: |
| 120 | return controller.RETURN_CODE_VALID_INPUT |
Alex Klein | 231d2da | 2019-07-22 16:44:45 -0600 | [diff] [blame] | 121 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 122 | args = sdk.CreateArguments( |
| 123 | replace=replace, |
| 124 | bootstrap=bootstrap, |
Brian Norris | 67374d8 | 2023-05-01 12:31:12 -0700 | [diff] [blame] | 125 | chroot=chroot, |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 126 | sdk_version=sdk_version, |
| 127 | skip_chroot_upgrade=skip_chroot_upgrade, |
| 128 | ) |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 129 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 130 | version = sdk.Create(args) |
Alex Klein | 19c4cc4 | 2019-02-27 14:47:57 -0700 | [diff] [blame] | 131 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 132 | if version: |
| 133 | output_proto.version.version = version |
| 134 | else: |
| 135 | # This should be very rare, if ever used, but worth noting. |
| 136 | cros_build_lib.Die( |
| 137 | "No chroot version could be found. There was likely an" |
| 138 | "error creating the chroot that was not detected." |
| 139 | ) |
Alex Klein | aa5c417 | 2019-02-27 17:12:20 -0700 | [diff] [blame] | 140 | |
| 141 | |
Alex Klein | 076841b | 2019-08-29 15:19:39 -0600 | [diff] [blame] | 142 | @faux.success(_ChrootVersionResponse) |
| 143 | @faux.empty_error |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 144 | @validate.require_each("toolchain_targets", ["name"]) |
Alex Klein | 231d2da | 2019-07-22 16:44:45 -0600 | [diff] [blame] | 145 | @validate.validation_complete |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 146 | def Update( |
Alex Klein | 0996b46 | 2023-06-15 15:26:37 -0600 | [diff] [blame] | 147 | input_proto: "sdk_pb2.UpdateRequest", |
| 148 | output_proto: "sdk_pb2.UpdateResponse", |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 149 | _config: "api_config.ApiConfig", |
| 150 | ): |
| 151 | """Update the chroot. |
Alex Klein | aa5c417 | 2019-02-27 17:12:20 -0700 | [diff] [blame] | 152 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 153 | Args: |
Alex Klein | 611dddd | 2022-10-11 17:02:01 -0600 | [diff] [blame] | 154 | input_proto: The input proto. |
| 155 | output_proto: The output proto. |
| 156 | _config: The API call config. |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 157 | """ |
| 158 | build_source = input_proto.flags.build_source |
| 159 | targets = [target.name for target in input_proto.toolchain_targets] |
| 160 | toolchain_changed = input_proto.flags.toolchain_changed |
Alex Klein | aa5c417 | 2019-02-27 17:12:20 -0700 | [diff] [blame] | 161 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 162 | args = sdk.UpdateArguments( |
| 163 | build_source=build_source, |
| 164 | toolchain_targets=targets, |
| 165 | toolchain_changed=toolchain_changed, |
| 166 | ) |
Chris McDonald | 68faa2a | 2020-01-13 12:23:05 -0700 | [diff] [blame] | 167 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 168 | version = sdk.Update(args) |
Alex Klein | aa5c417 | 2019-02-27 17:12:20 -0700 | [diff] [blame] | 169 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 170 | if version: |
| 171 | output_proto.version.version = version |
| 172 | else: |
| 173 | # This should be very rare, if ever used, but worth noting. |
| 174 | cros_build_lib.Die( |
| 175 | "No chroot version could be found. There was likely an" |
| 176 | "error creating the chroot that was not detected." |
| 177 | ) |
Alex Klein | 730cf55 | 2019-10-16 11:28:22 -0600 | [diff] [blame] | 178 | |
| 179 | |
| 180 | @faux.all_empty |
Greg Edelston | 6733dc5 | 2023-02-15 15:20:07 -0700 | [diff] [blame] | 181 | @validate.require("binhost_gs_bucket") |
Greg Edelston | 0382ca4 | 2023-05-04 14:00:15 -0600 | [diff] [blame] | 182 | @validate.require("toolchain_tarball_template") |
Greg Edelston | 6733dc5 | 2023-02-15 15:20:07 -0700 | [diff] [blame] | 183 | @validate.validation_complete |
| 184 | def Uprev(input_proto, output_proto, _config): |
Greg Edelston | 40aea81 | 2023-03-27 16:34:35 -0600 | [diff] [blame] | 185 | """Update SDK version file and prebuilt files to point to the latest SDK. |
| 186 | |
| 187 | Files will be changed locally, but not committed. |
| 188 | """ |
| 189 | # If the UprevRequest did not specify a target version, |
| 190 | # check the remote SDK version file on Google Cloud Storage for the latest |
| 191 | # uprev target. |
Greg Edelston | d401e5a | 2023-04-28 15:29:11 -0600 | [diff] [blame] | 192 | target_version = ( |
| 193 | input_proto.version or sdk.get_latest_uprev_target_version() |
| 194 | ) |
Greg Edelston | 40aea81 | 2023-03-27 16:34:35 -0600 | [diff] [blame] | 195 | |
| 196 | # The main uprev logic occurs in service/sdk.py. |
Greg Edelston | d401e5a | 2023-04-28 15:29:11 -0600 | [diff] [blame] | 197 | modified_files = sdk.uprev_sdk_and_prebuilts( |
Greg Edelston | 6733dc5 | 2023-02-15 15:20:07 -0700 | [diff] [blame] | 198 | binhost_gs_bucket=input_proto.binhost_gs_bucket, |
| 199 | version=target_version, |
Greg Edelston | 0382ca4 | 2023-05-04 14:00:15 -0600 | [diff] [blame] | 200 | toolchain_tarball_template=input_proto.toolchain_tarball_template, |
Greg Edelston | 6733dc5 | 2023-02-15 15:20:07 -0700 | [diff] [blame] | 201 | ) |
Greg Edelston | 40aea81 | 2023-03-27 16:34:35 -0600 | [diff] [blame] | 202 | |
| 203 | # Populate the UprevResponse object with the modified files. |
Greg Edelston | 6733dc5 | 2023-02-15 15:20:07 -0700 | [diff] [blame] | 204 | for modified_file in modified_files: |
Greg Edelston | 40aea81 | 2023-03-27 16:34:35 -0600 | [diff] [blame] | 205 | proto_path = output_proto.modified_files.add() |
| 206 | proto_path.path = str(modified_file) |
| 207 | proto_path.location = common_pb2.Path.OUTSIDE |
Greg Edelston | 6733dc5 | 2023-02-15 15:20:07 -0700 | [diff] [blame] | 208 | output_proto.version = target_version |
| 209 | |
| 210 | |
| 211 | @faux.all_empty |
Alex Klein | 730cf55 | 2019-10-16 11:28:22 -0600 | [diff] [blame] | 212 | @validate.validation_complete |
| 213 | def Delete(input_proto, _output_proto, _config): |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 214 | """Delete a chroot.""" |
| 215 | chroot = controller_util.ParseChroot(input_proto.chroot) |
| 216 | sdk.Delete(chroot, force=True) |
Chris McDonald | 53ad544 | 2020-01-17 14:11:55 -0700 | [diff] [blame] | 217 | |
| 218 | |
| 219 | @faux.all_empty |
| 220 | @validate.validation_complete |
Brian Norris | f624bf4 | 2023-03-02 12:57:49 -0800 | [diff] [blame] | 221 | def Unmount(_input_proto, _output_proto, _config): |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 222 | """Unmount a chroot""" |
Brian Norris | f624bf4 | 2023-03-02 12:57:49 -0800 | [diff] [blame] | 223 | # Deprecated. Do nothing. |
Chris McDonald | f48ea20 | 2020-01-29 13:19:23 -0700 | [diff] [blame] | 224 | |
| 225 | |
| 226 | @faux.all_empty |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 227 | @validate.require("path.path") |
Michael Mortensen | 52a98ac | 2020-07-28 16:00:18 -0600 | [diff] [blame] | 228 | @validate.validation_complete |
| 229 | def UnmountPath(input_proto, _output_proto, _config): |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 230 | """Unmount a path""" |
| 231 | sdk.UnmountPath(input_proto.path.path) |
Michael Mortensen | 52a98ac | 2020-07-28 16:00:18 -0600 | [diff] [blame] | 232 | |
| 233 | |
| 234 | @faux.all_empty |
Chris McDonald | f48ea20 | 2020-01-29 13:19:23 -0700 | [diff] [blame] | 235 | @validate.validation_complete |
| 236 | def Clean(input_proto, _output_proto, _config): |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 237 | """Clean unneeded files from a chroot.""" |
| 238 | chroot = controller_util.ParseChroot(input_proto.chroot) |
George Engelbrecht | 86cfae6 | 2023-04-05 10:57:41 -0600 | [diff] [blame] | 239 | |
| 240 | # Default (flagless) call sets 'safe' and 'sysroots'. |
| 241 | if not ( |
| 242 | input_proto.safe |
| 243 | or input_proto.images |
| 244 | or input_proto.sysroots |
| 245 | or input_proto.tmp |
| 246 | or input_proto.cache |
| 247 | or input_proto.logs |
| 248 | or input_proto.workdirs |
| 249 | or input_proto.incrementals |
| 250 | ): |
| 251 | sdk.Clean(chroot, safe=True, sysroots=True) |
| 252 | else: |
| 253 | sdk.Clean( |
| 254 | chroot, |
| 255 | safe=input_proto.safe, |
| 256 | images=input_proto.images, |
| 257 | sysroots=input_proto.sysroots, |
| 258 | tmp=input_proto.tmp, |
| 259 | cache=input_proto.cache, |
| 260 | logs=input_proto.logs, |
| 261 | workdirs=input_proto.workdirs, |
| 262 | incrementals=input_proto.incrementals, |
| 263 | ) |
Chris McDonald | 9d48680 | 2020-01-29 15:57:22 -0700 | [diff] [blame] | 264 | |
| 265 | |
| 266 | @faux.all_empty |
| 267 | @validate.validation_complete |
Bob Haarman | d1225ea | 2022-01-19 22:01:42 +0000 | [diff] [blame] | 268 | def BuildPrebuilts(input_proto, _output_proto, _config): |
Greg Edelston | 9dcdc8a | 2023-01-11 17:07:10 -0700 | [diff] [blame] | 269 | """Build the binary packages that comprise the Chromium OS SDK.""" |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 270 | chroot = controller_util.ParseChroot(input_proto.chroot) |
Greg Edelston | 199c536 | 2023-01-04 12:29:07 -0700 | [diff] [blame] | 271 | sdk.BuildPrebuilts(chroot, board=input_proto.build_target.name) |
Bob Haarman | d1225ea | 2022-01-19 22:01:42 +0000 | [diff] [blame] | 272 | |
| 273 | |
Bob Haarman | 171d409 | 2023-01-10 16:44:19 +0000 | [diff] [blame] | 274 | @faux.success(_BinhostCLs) |
Bob Haarman | c008260 | 2022-09-20 16:12:43 -0700 | [diff] [blame] | 275 | @faux.empty_error |
Bob Haarman | 0853ce9 | 2022-12-13 18:11:53 +0000 | [diff] [blame] | 276 | @validate.require( |
| 277 | "prepend_version", "version", "upload_location", "sdk_tarball_template" |
| 278 | ) |
Bob Haarman | d1225ea | 2022-01-19 22:01:42 +0000 | [diff] [blame] | 279 | @validate.validation_complete |
Bob Haarman | c008260 | 2022-09-20 16:12:43 -0700 | [diff] [blame] | 280 | def CreateBinhostCLs( |
Alex Klein | 0996b46 | 2023-06-15 15:26:37 -0600 | [diff] [blame] | 281 | input_proto: "sdk_pb2.CreateBinhostCLsRequest", |
| 282 | output_proto: "sdk_pb2.CreateBinhostCLsResponse", |
Bob Haarman | c008260 | 2022-09-20 16:12:43 -0700 | [diff] [blame] | 283 | _config: "api_config.ApiConfig", |
| 284 | ) -> None: |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 285 | """Create CLs to update the binhost to point at uploaded prebuilts.""" |
Bob Haarman | 171d409 | 2023-01-10 16:44:19 +0000 | [diff] [blame] | 286 | output_proto.cls.extend( |
| 287 | sdk.CreateBinhostCLs( |
| 288 | input_proto.prepend_version, |
| 289 | input_proto.version, |
| 290 | input_proto.upload_location, |
| 291 | input_proto.sdk_tarball_template, |
| 292 | ) |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 293 | ) |
Bob Haarman | 338f8b7 | 2022-02-04 01:02:46 +0000 | [diff] [blame] | 294 | |
| 295 | |
| 296 | @faux.all_empty |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 297 | @validate.require("prepend_version", "version", "upload_location") |
Bob Haarman | 338f8b7 | 2022-02-04 01:02:46 +0000 | [diff] [blame] | 298 | @validate.validation_complete |
Bob Haarman | d1225ea | 2022-01-19 22:01:42 +0000 | [diff] [blame] | 299 | def UploadPrebuiltPackages(input_proto, _output_proto, _config): |
Greg Edelston | 9dcdc8a | 2023-01-11 17:07:10 -0700 | [diff] [blame] | 300 | """Upload prebuilt packages.""" |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 301 | sdk.UploadPrebuiltPackages( |
| 302 | controller_util.ParseChroot(input_proto.chroot), |
| 303 | input_proto.prepend_version, |
| 304 | input_proto.version, |
| 305 | input_proto.upload_location, |
| 306 | ) |
Greg Edelston | 9dcdc8a | 2023-01-11 17:07:10 -0700 | [diff] [blame] | 307 | |
| 308 | |
| 309 | @faux.all_empty |
Greg Edelston | 9dcdc8a | 2023-01-11 17:07:10 -0700 | [diff] [blame] | 310 | @validate.validation_complete |
| 311 | def BuildSdkToolchain(input_proto, output_proto, _config): |
| 312 | """Build cross-compiler packages for the SDK.""" |
Greg Edelston | 9dcdc8a | 2023-01-11 17:07:10 -0700 | [diff] [blame] | 313 | extra_env: Dict[str, str] = {} |
| 314 | if input_proto.use_flags: |
| 315 | extra_env["USE"] = " ".join(use.flag for use in input_proto.use_flags) |
Greg Edelston | e265a17 | 2023-06-26 17:20:05 -0600 | [diff] [blame] | 316 | generated_files = sdk.BuildSdkToolchain(extra_env=extra_env) |
Greg Edelston | 9dcdc8a | 2023-01-11 17:07:10 -0700 | [diff] [blame] | 317 | output_proto.generated_files.extend(generated_files) |