Backport docker machinery to zutils; drop _docker.py - #836
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the repo-local isolated Docker implementation (.nanvix/src/_docker.py) and migrates the build/clean lifecycle to use the Docker/isolated-workspace capabilities provided by nanvix_zutil, including tar-based workspace sync, CRLF normalization, persistent build volumes, invalidation, and copy-back outputs.
Changes:
- Drop
.nanvix/src/_docker.pyand switch.nanvix/src/build.pyto run an isolated, fused build+install pipeline via zutils’ Docker support. - Update
.nanvix/src/clean.pyto remove isolated build volumes via zutils (instead of the removed module). - Extend Docker tar-sync excludes to skip
.nanvix/out.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .nanvix/src/config.py | Adds .nanvix/out to Docker tar-sync excludes. |
| .nanvix/src/clean.py | Replaces _docker.py volume cleanup with zutils remove_build_volume. |
| .nanvix/src/build.py | Migrates isolated build+install flow to zutils DockerConfig and removes _docker.py usage. |
| .nanvix/src/_docker.py | Deletes the legacy isolated Docker implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3b74866 to
7feed92
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
.nanvix/src/build.py:116
_docker_build()relies onassert self.docker is not Nonefor a runtime precondition. Asserts can be disabled withpython -O, and even when enabled they produce an unhelpfulAssertionErrorfor a missing dependency/flag. Prefer an explicit runtime check with a clear error.
assert self.docker is not None
.nanvix/src/build.py:140
_fused_build_cmd()usesassert self.docker is not Noneas a runtime precondition, which can be stripped underpython -Oand turns a user-facing configuration error into an internal crash. Use an explicit check with a clear exception/message instead.
assert self.docker is not None
.nanvix/src/build.py:50
- PR description says the zutils
DockerConfigsurface is used forinvalidation_inputs + clean_cmd, butdocker_config()only setsclean_cmdhere. Withpersistent_volume = True, missing/incorrect invalidation settings can allow stale build artifacts to persist across runs. Either configuredocker.invalidation_inputs(matching the old_docker.pysignature inputs) or update the PR description if zutils provides equivalent defaults.
# Feed the isolated (case-insensitive / Windows) tar-copy build. The
# per-phase copy-back outputs (DESTDIR install tree) are set in
# ``_docker_build`` because the destination differs per build.
docker.tar_excludes = config.DOCKER_TAR_EXCLUDES
docker.crlf_files = config.DOCKER_CRLF_FILES
docker.persistent_volume = True
docker.clean_cmd = (
"make -f Makefile.nanvix clean 2>/dev/null || true; "
"rm -f .nanvix-configured"
)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
.nanvix/src/clean.py:55
- In isolated-workspace mode, this only removes the persistent Docker build volume when
self.dockeris already configured. Running./z cleanwithout Docker enabled (or beforeself.dockeris initialised) can leave the build volume behind, which is a regression from the prior_docker.pycleanup behavior.
elif self.docker is not None:
volume = self.docker.volume_name()
if volume is not None:
remove_build_volume(volume)
.nanvix/src/build.py:50
- The PR description says the isolated Docker build is wired through zutils
invalidation_inputs+clean_cmd, but this config only setsclean_cmd. With a persistent build volume, missing invalidation inputs risks stale/inconsistent builds when Makefile.nanvix, toolchain/SDK metadata, buildroot contents, or build args change (the old_docker.pyexplicitly detected this and forced a clean rebuild).
docker.clean_cmd = (
"make -f Makefile.nanvix clean 2>/dev/null || true; "
"rm -f .nanvix-configured"
)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
.nanvix/src/build.py:116
- Using
assert self.docker is not Nonewill raise anAssertionError(or be skipped under-O) instead of producing a clear, user-facing failure when an isolated workspace requires Docker (e.g., on Windows / case-insensitive worktrees). This should be an explicit runtime check with a helpful fatal message/hint.
assert self.docker is not None
.nanvix/src/build.py:118
- The comment says
Setup.localreferences the container-side buildroot, but the code passesDOCKER_SYSROOT_PATH(sysroot). This mismatch is confusing when troubleshooting module link flags; please align the comment with what is actually used.
# Setup.local references the container-side buildroot (synced in).
.nanvix/src/build.py:50
- The PR description says the zutils
DockerConfigsurface is used withinvalidation_inputs + clean_cmd, but this config only setsclean_cmd. Withoutinvalidation_inputs, persistent-volume builds can keep stale artifacts when SDK/buildroot/Makefile inputs change (the old_docker.pyexplicitly forced a clean rebuild on such changes). Please wire updocker.invalidation_inputsto match the previous invalidation behavior.
docker.tar_excludes = config.DOCKER_TAR_EXCLUDES
docker.crlf_files = config.DOCKER_CRLF_FILES
docker.persistent_volume = True
docker.clean_cmd = (
"make -f Makefile.nanvix clean 2>/dev/null || true; "
"rm -f .nanvix-configured"
)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
91e44bc to
1903a5a
Compare
Backport docker machinery to zutils; drop
_docker.pyRetires
.nanvix/src/_docker.py(340 lines) in favor of the docker featuresnow provided by
nanvix-zutil(see nanvix/zutils#339, #340, #341).Changes
_docker.py;build.py/clean.pyuse the zutilsDockerConfigsurface:
crlf_files,output_files(dir-tree aware),persistent_volume,invalidation_inputs+clean_cmd, andremove_build_volume._docker_buildruns the fused build+install pipeline via zutils' isolatedpath; the install tree is staged at its mirrored destination path.
.nanvix/outadded toDOCKER_TAR_EXCLUDES.Notes
.zutils-versionmust be bumped to a releasecontaining them before this merges (currently exercised via
--with-zutils).just lc).