Feature/podman#711
Open
carroarmato0 wants to merge 2 commits intoLoveRetro:mainfrom
Open
Conversation
Auto-detect docker or podman at build time, preferring docker when both are present. Override with CONTAINER_RUNTIME=podman (or any other compatible runtime) on the make command line. Signed-off-by: Christophe Vanlancker <carroarmato0@gmail.com>
Docker runs as real root inside the container, so build artifacts and cloned repos (other/) end up root-owned on the host. Rootless podman can't write into those directories, causing permission errors mid-build. Keep track of the last-used runtime in workspace/.container_runtime. When a different runtime is requested, re-run the cleanup inside the previous container using 'find -depth -user root -delete', which strips out everything the old runtime created while leaving host-owned source files untouched. If the previous runtime is gone, print a manual cleanup command and bail out cleanly. Also fixes a missing clean target in btmanager/Makefile, which was caught when the cleanup path exercised it for the first time. Signed-off-by: Christophe Vanlancker <carroarmato0@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The build system previously had Docker hardcoded as the only container runtime. This PR adds support for Podman as a drop-in alternative, which is useful on systems where Docker is not available or not preferred (e.g. rootless Linux setups where Podman is the default).
makefile.toolchain:
between runtimes
Automatic cleanup is needed as Docker containers run as root, so compiled objects and cloned repos (e.g. other/NextCommander) end up root-owned on the host. Rootless Podman cannot write into those directories. When a runtime switch is detected, the cleanup runs inside the previous container using find -depth -user root -delete, which removes only what that runtime created while leaving host-owned source files untouched. If the previous runtime is no longer installed, an actionable manual cleanup command is printed and the build aborts rather than producing a half-broken state.
workspace/tg5040/btmanager/Makefile:
Examples:
Build tests: