(
self,
root: Path,
arch: Arch = Arch.host(),
profile: Profile = (
Profile.RELEASE if ui.env_is_truthy("CI_LTO") else Profile.OPTIMIZED
),
coverage: bool = False,
sanitizer: Sanitizer = Sanitizer.none,
image_registry: str = image_registry(),
image_prefix: str = "",
)
| 1527 | """ |
| 1528 | |
| 1529 | def __init__( |
| 1530 | self, |
| 1531 | root: Path, |
| 1532 | arch: Arch = Arch.host(), |
| 1533 | profile: Profile = ( |
| 1534 | Profile.RELEASE if ui.env_is_truthy("CI_LTO") else Profile.OPTIMIZED |
| 1535 | ), |
| 1536 | coverage: bool = False, |
| 1537 | sanitizer: Sanitizer = Sanitizer.none, |
| 1538 | image_registry: str = image_registry(), |
| 1539 | image_prefix: str = "", |
| 1540 | ): |
| 1541 | self.rd = RepositoryDetails( |
| 1542 | root, |
| 1543 | arch, |
| 1544 | profile, |
| 1545 | coverage, |
| 1546 | sanitizer, |
| 1547 | image_registry, |
| 1548 | image_prefix, |
| 1549 | ) |
| 1550 | self.images: dict[str, Image] = {} |
| 1551 | self.compositions: dict[str, Path] = {} |
| 1552 | for rel_path_s in sorted( |
| 1553 | git.expand_globs(self.root, "**/mzbuild.yml", "**/mzcompose.py") |
| 1554 | ): |
| 1555 | rel_path = Path(rel_path_s) |
| 1556 | if rel_path.parts[:2] == ("misc", "python"): |
| 1557 | continue |
| 1558 | |
| 1559 | parent = self.root / rel_path.parent |
| 1560 | if rel_path.name == "mzbuild.yml": |
| 1561 | image = Image(self.rd, parent) |
| 1562 | if not image.name: |
| 1563 | raise ValueError(f"config at {parent} missing name") |
| 1564 | if image.name in self.images: |
| 1565 | raise ValueError(f"image {image.name} exists twice") |
| 1566 | self.images[image.name] = image |
| 1567 | elif rel_path.name == "mzcompose.py": |
| 1568 | name = parent.name |
| 1569 | if name in self.compositions: |
| 1570 | raise ValueError(f"composition {name} exists twice") |
| 1571 | self.compositions[name] = parent |
| 1572 | |
| 1573 | # Validate dependencies. |
| 1574 | for image in self.images.values(): |
| 1575 | for d in image.depends_on: |
| 1576 | if d not in self.images: |
| 1577 | raise ValueError( |
| 1578 | f"image {image.name} depends on non-existent image {d}" |
| 1579 | ) |
| 1580 | |
| 1581 | @staticmethod |
| 1582 | def install_arguments(parser: argparse.ArgumentParser) -> None: |
nothing calls this directly
no test coverage detected