makefiles/docker.inc.mk: handle building in git worktree [backport 2018.10]#10307
Merged
cladmi merged 2 commits intoRIOT-OS:2018.10-branchfrom Nov 2, 2018
Conversation
When building from a worktree, the common git directory was not mounted in docker. This lead to the version not being set and issues with git-cache in ubuntu bionic that could not execute the 'git hash-object' command. (cherry picked from commit 61a3e5d)
Contributor
Author
|
I will re-run the tests with this one. |
Contributor
Author
|
Both test indeed failed with the release branch and worked with this PR. |
Member
|
let's wait for Murdock. Thanks for the backport and testing! |
Contributor
Author
|
Murdock is green. Thank you for the review of the backport too. |
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.
Backport of #10303
Contribution description
When building from a worktree, the common git directory was not mounted in docker.
This lead to the version not being set and issues with git-cache in
ubuntu bionic that could not execute the 'git hash-object' command.
Implementation details
I just test that
.gitis a file starting withgitdirto know it is in a worktree.Any other solution is welcomed.
I then mounted the whole
--git-common-dirin the same location.Using the
gitdirpointed by the.gitfile was not enough to make it valid.I aslo tested overwriting the
.gitfile with the.gitrepository but docker did not allow that.Testing procedure
Original behavior untouched
In a normal repository, no
.gitdirectory is mounted when building with docker.New behavior
This must be run from a git worktree (replace
riot/masterto the upstream master branch if different)git worktree add ../git_test_worktree riot/master cd ../git_test_worktreeTesting the RIOT_VERSION calculation from git
With
riot/masterwe get anUNKNOWNversion, (see the last line).With this PR the version is correctly detected (see the last line).
Testing the behavior with
ubuntu:bionicdocker imageYou must have an initialized git cache
Build a docker image from RIOT-OS/riotdocker#42
I used
docker build . -t riot/bionicfrom the repository.Compiling a package using the
bionicimage fails in master asgit hash-objecttries to detect the current directory as a git directory.It works with this PR
Issues/PRs references
The RIOT_VERSION issue was detected in #9645 (comment) and the
git-cacheissue was detected when running Release compilation withbionicimage RIOT-OS/Release-Specs#76 (comment)