make: fix BUILD_IN_DOCKER when RIOT is submodule#10550
make: fix BUILD_IN_DOCKER when RIOT is submodule#10550jcarrano merged 1 commit intoRIOT-OS:masterfrom
Conversation
jcarrano
left a comment
There was a problem hiding this comment.
I could reproduce the problem, but this fix will break worktrees.
| DOCKER_VOLUMES_AND_ENV += $(if $(wildcard $(GIT_CACHE_DIR)),-e GIT_CACHE_DIR=$(DOCKER_BUILD_ROOT)/gitcache) | ||
|
|
||
| # Handle worktree by mounting the git common dir in the same location | ||
| _is_git_worktree = $(shell grep '^gitdir: ' $(RIOTBASE)/.git 2>/dev/null) |
There was a problem hiding this comment.
Removing this will break worktrees, which was fixed in #10303.
|
Here are the commands I used to reproduce the issue: $ git clone git@github.com:inetrg/vslab-riot.git
$ cd vslab-riot
$ git submodule init
$ git submodule update
$ BUILD_IN_DOCKER=1 DOCKER="sudo docker" make -C src/
make: Entering directory '/home/jcarrano/source/vslab-riot/src'
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
-v '/home/jcarrano/source/vslab-riot/RIOT:/data/riotbuild/riotbase' \
-v '/home/jcarrano/source/vslab-riot/RIOT/cpu:/data/riotbuild/riotcpu' \
-v '/home/jcarrano/source/vslab-riot/RIOT/boards:/data/riotbuild/riotboard' \
-v '/home/jcarrano/source/vslab-riot/RIOT/makefiles:/data/riotbuild/riotmake' \
-v '/home/jcarrano/source/vslab-riot:/data/riotbuild/riotproject' \
-v /etc/localtime:/etc/localtime:ro \
-e 'RIOTBASE=/data/riotbuild/riotbase' \
-e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' \
-e 'RIOTCPU=/data/riotbuild/riotcpu' \
-e 'RIOTBOARD=/data/riotbuild/riotboard' \
-e 'RIOTMAKE=/data/riotbuild/riotmake' \
-e 'RIOTPROJECT=/data/riotbuild/riotproject' \
-v /home/jcarrano/.gitcache:/data/riotbuild/gitcache -e GIT_CACHE_DIR=/data/riotbuild/gitcache -v ../.git:../.git \
\
-w '/data/riotbuild/riotproject/src/' \
'riot/riotbuild:latest' make
docker: Error response from daemon: invalid volume specification: '../.git:../.git': invalid mount config for type "volume": invalid mount path: '../.git' mount path must be absolute.
See 'docker run --help'.
make: *** [/home/jcarrano/source/vslab-riot/RIOT/makefiles/docker.inc.mk:106: ..in-docker-container] Error 125
make: Leaving directory '/home/jcarrano/source/vslab-riot/src' |
The description says You have more information in the commit introducing it 61a3e5d#diff-4417068c1754de9c0490bd66a2ea783e and also the detailed procedure in the PR introducing it #10303 |
74c22d3 to
ae5608a
Compare
|
changed as suggested by @jcarrano and it solves the problem for me, too! |
jcarrano
left a comment
There was a problem hiding this comment.
Tested by using docker in with a submodule as in the description, and also verified that worktrees are still working.
|
🎉 |
|
I prefered the old commit message though at least |
Contribution description
This removes a non-working mount point when using BUILD_IN_DOCKER for an
external application where RIOTBASE is a submodule within the apps repo.
Actually I'm not sure why the removed lines are in place anyway, because they are only used when RIOT is a submodule, however they likely never worked.
Testing procedure
Try to build an application with
BUILD_IN_DOCKER=1which has RIOT as a submodule within its repo and uses that asRIOTBASE. Take for instance this https://github.com/inetrg/vslab-riot and you'll get the following error:It works when you clone RIOT separately and specify
RIOTBASEaccordingly, e.g.Issues/PRs references