Whole file
Mic92/nix-fast-build
The author described this change as “Fix --retries to re-run failed builds”. It counts as a record because the check below fails on the code as it stood at 0a9328843 and passes on 70013796e, with nothing else changed between the two runs.
ProjectMic92/nix-fast-build
Fix saved2026-06-10
Sharing licenceMIT · LICENSE.md
Change size+11 −7
What the code was meant to do, written into the code itself as a save note
Fix --retries to re-run failed builds
The change
| 34 | 34 | async def build( | |
| 35 | 35 | self, | |
| 36 | 36 | stack: AsyncExitStack, | |
| 37 | - | build_output: IO[str], | |
| 37 | + | build_output: IO[bytes], | |
| 38 | 38 | opts: Options, | |
| 39 | 39 | nom_pipe: IO[bytes] | None = None, | |
| 40 | 40 | ) -> BuildResult: | |
| 41 | 41 | """Build and return BuildResult.""" | |
| 42 | - | proc = await stack.enter_async_context( | |
| 43 | - | nix_build(self.attr, self.drv_path, build_output, opts, nom_pipe=nom_pipe) | |
| 44 | - | ) | |
| 45 | - | ||
| 46 | 42 | rc = 0 | |
| 47 | - | for _ in range(opts.retries + 1): | |
| 43 | + | for attempt in range(opts.retries + 1): | |
| 44 | + | proc = await stack.enter_async_context( | |
| 45 | + | nix_build( | |
| 46 | + | self.attr, self.drv_path, build_output, opts, nom_pipe=nom_pipe | |
| 47 | + | ) | |
| 48 | + | ) | |
| 48 | 49 | rc = await proc.wait() | |
| 49 | 50 | if rc == 0: | |
| 50 | 51 | logger.debug(f"build {self.attr} succeeded") | |
| 51 | 52 | return BuildResult(return_code=rc, log_output="") | |
| 52 | - | logger.warning(f"build {self.attr} exited with {rc}") | |
| 53 | + | logger.warning( | |
| 54 | + | f"build {self.attr} exited with {rc} " | |
| 55 | + | f"(attempt {attempt + 1}/{opts.retries + 1})" | |
| 56 | + | ) | |
| 53 | 57 | ||
| 54 | 58 | # If build failed, get the log using nix log | |
| 55 | 59 | log_output = await self.get_build_log(opts) |
The check that tells the two apart
fail→pass·tests/test_retry.py::test_retry_reruns_build
Check file tests/test_retry.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it0a9328843837300949f05ff8d7c937053e1d9dc9
Broken version dated2026-06-10
Modulenix_fast_build.build
Units changedBuild
Fingerprint24aed55e59f4c6ad
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.