Immutable details about a `Repository`. Used internally by mzbuild. Attributes: root: The path to the root of the repository. arch: The CPU architecture to build for. profile: What profile the repository is being built with. coverage: Whether the repository
| 161 | |
| 162 | |
| 163 | class RepositoryDetails: |
| 164 | """Immutable details about a `Repository`. |
| 165 | |
| 166 | Used internally by mzbuild. |
| 167 | |
| 168 | Attributes: |
| 169 | root: The path to the root of the repository. |
| 170 | arch: The CPU architecture to build for. |
| 171 | profile: What profile the repository is being built with. |
| 172 | coverage: Whether the repository has code coverage instrumentation |
| 173 | enabled. |
| 174 | sanitizer: Whether to use a sanitizer (address, hwaddress, cfi, thread, leak, memory, none) |
| 175 | cargo_workspace: The `cargo.Workspace` associated with the repository. |
| 176 | image_registry: The Docker image registry to pull images from and push |
| 177 | images to. |
| 178 | image_prefix: A prefix to apply to all Docker image names. |
| 179 | """ |
| 180 | |
| 181 | def __init__( |
| 182 | self, |
| 183 | root: Path, |
| 184 | arch: Arch, |
| 185 | profile: Profile, |
| 186 | coverage: bool, |
| 187 | sanitizer: Sanitizer, |
| 188 | image_registry: str, |
| 189 | image_prefix: str, |
| 190 | ): |
| 191 | self.root = root |
| 192 | self.arch = arch |
| 193 | self.profile = profile |
| 194 | self.coverage = coverage |
| 195 | self.sanitizer = sanitizer |
| 196 | self.cargo_workspace = cargo.Workspace(root) |
| 197 | self.image_registry = image_registry |
| 198 | self.image_prefix = image_prefix |
| 199 | |
| 200 | def build( |
| 201 | self, |
| 202 | subcommand: str, |
| 203 | rustflags: list[str], |
| 204 | channel: str | None = None, |
| 205 | extra_env: dict[str, str] = {}, |
| 206 | ) -> list[str]: |
| 207 | """Start a build invocation for the configured architecture.""" |
| 208 | return xcompile.cargo( |
| 209 | arch=self.arch, |
| 210 | channel=channel, |
| 211 | subcommand=subcommand, |
| 212 | rustflags=rustflags, |
| 213 | extra_env=extra_env, |
| 214 | ) |
| 215 | |
| 216 | def tool(self, name: str) -> list[str]: |
| 217 | """Start a binutils tool invocation for the configured architecture.""" |
| 218 | if platform.system() != "Linux": |
| 219 | # We can't use the local tools from macOS to build a Linux executable |
| 220 | return ["bin/ci-builder", "run", "stable", name] |