MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / build

Method build

misc/python/materialize/mzbuild.py:1016–1034  ·  view source on GitHub ↗

Build the image from source. Requires that the caller has already acquired all dependencies and prepared all `PreImage` actions via `PreImage.prepare_batch`.

(self, prep: dict[type[PreImage], Any], push: bool = False)

Source from the content-addressed store, hash-verified

1014 return f
1015
1016 def build(self, prep: dict[type[PreImage], Any], push: bool = False) -> None:
1017 """Build the image from source.
1018
1019 Requires that the caller has already acquired all dependencies and
1020 prepared all `PreImage` actions via `PreImage.prepare_batch`.
1021 """
1022 # Use a file lock to prevent parallel mzcompose processes from
1023 # racing on git clean / copy / strip for the same image directory.
1024 lock_dir = self.image.rd.root / "target" / "mzbuild-locks"
1025 lock_dir.mkdir(parents=True, exist_ok=True)
1026 profile = self.image.rd.profile.name.lower()
1027 lock_path = lock_dir / f"{self.image.name}-{profile}.lock"
1028 with open(lock_path, "w") as lock_file:
1029 ui.say(f"Acquiring lock for {self.spec()}")
1030 fcntl.flock(lock_file, fcntl.LOCK_EX)
1031 try:
1032 self._build_locked(prep, push)
1033 finally:
1034 fcntl.flock(lock_file, fcntl.LOCK_UN)
1035
1036 def _build_locked(
1037 self, prep: dict[type[PreImage], Any], push: bool = False

Callers

nothing calls this directly

Calls 3

specMethod · 0.95
_build_lockedMethod · 0.95
lowerMethod · 0.45

Tested by

no test coverage detected