Skip to content

Backport docker machinery to zutils; drop _docker.py - #836

Merged
ppenna merged 3 commits into
nanvix/v3.12.3from
fix/backport-docker-feats
Jul 30, 2026
Merged

Backport docker machinery to zutils; drop _docker.py#836
ppenna merged 3 commits into
nanvix/v3.12.3from
fix/backport-docker-feats

Conversation

@ada-x64

@ada-x64 ada-x64 commented Jul 29, 2026

Copy link
Copy Markdown

Backport docker machinery to zutils; drop _docker.py

Retires .nanvix/src/_docker.py (340 lines) in favor of the docker features
now provided by nanvix-zutil (see nanvix/zutils#339, #340, #341).

Changes

  • Delete _docker.py; build.py/clean.py use the zutils DockerConfig
    surface: crlf_files, output_files (dir-tree aware), persistent_volume,
    invalidation_inputs + clean_cmd, and remove_build_volume.
  • _docker_build runs the fused build+install pipeline via zutils' isolated
    path; the install tree is staged at its mirrored destination path.
  • .nanvix/out added to DOCKER_TAR_EXCLUDES.

Notes

  • Depends on the zutils PRs.zutils-version must be bumped to a release
    containing them before this merges (currently exercised via --with-zutils).
  • e2e-validated end-to-end on Linux (isolated) and Windows (full just lc).

Copilot AI review requested due to automatic review settings July 29, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py and switch .nanvix/src/build.py to run an isolated, fused build+install pipeline via zutils’ Docker support.
  • Update .nanvix/src/clean.py to 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.

Comment thread .nanvix/src/clean.py Outdated
Comment thread .nanvix/src/build.py
Copilot AI review requested due to automatic review settings July 30, 2026 14:00
@ada-x64
ada-x64 force-pushed the fix/backport-docker-feats branch from 3b74866 to 7feed92 Compare July 30, 2026 14:00
@ada-x64 ada-x64 linked an issue Jul 30, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 on assert self.docker is not None for a runtime precondition. Asserts can be disabled with python -O, and even when enabled they produce an unhelpful AssertionError for 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() uses assert self.docker is not None as a runtime precondition, which can be stripped under python -O and 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 DockerConfig surface is used for invalidation_inputs + clean_cmd, but docker_config() only sets clean_cmd here. With persistent_volume = True, missing/incorrect invalidation settings can allow stale build artifacts to persist across runs. Either configure docker.invalidation_inputs (matching the old _docker.py signature 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"
        )

Comment thread .nanvix/src/build.py
Copilot AI review requested due to automatic review settings July 30, 2026 14:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.docker is already configured. Running ./z clean without Docker enabled (or before self.docker is initialised) can leave the build volume behind, which is a regression from the prior _docker.py cleanup 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 sets clean_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.py explicitly detected this and forced a clean rebuild).
        docker.clean_cmd = (
            "make -f Makefile.nanvix clean 2>/dev/null || true; "
            "rm -f .nanvix-configured"
        )

Copilot AI review requested due to automatic review settings July 30, 2026 14:38
@ada-x64
ada-x64 marked this pull request as ready for review July 30, 2026 14:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 None will raise an AssertionError (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.local references the container-side buildroot, but the code passes DOCKER_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 DockerConfig surface is used with invalidation_inputs + clean_cmd, but this config only sets clean_cmd. Without invalidation_inputs, persistent-volume builds can keep stale artifacts when SDK/buildroot/Makefile inputs change (the old _docker.py explicitly forced a clean rebuild on such changes). Please wire up docker.invalidation_inputs to 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"
        )

ada-x64 and others added 3 commits July 30, 2026 12:13
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>
@ada-x64
ada-x64 force-pushed the fix/backport-docker-feats branch from 91e44bc to 1903a5a Compare July 30, 2026 16:13
Copilot AI review requested due to automatic review settings July 30, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread .nanvix/src/build.py
@ppenna
ppenna merged commit 6994cab into nanvix/v3.12.3 Jul 30, 2026
13 checks passed
@ppenna
ppenna deleted the fix/backport-docker-feats branch July 30, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove _docker.py duplication

3 participants