makefiles/docker.inc.mk: handle building in git worktree#10303
Merged
jcarrano merged 1 commit intoRIOT-OS:masterfrom Oct 31, 2018
Merged
makefiles/docker.inc.mk: handle building in git worktree#10303jcarrano merged 1 commit intoRIOT-OS:masterfrom
jcarrano merged 1 commit intoRIOT-OS:masterfrom
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.
Contributor
Author
|
A test in mac would be great too if you could @smlng |
Contributor
Author
|
I could test without it for the release (or just use the patch in my branch), but having the release tag working with the upcoming |
Member
I agree. Let's get this in |
6 tasks
jcarrano
reviewed
Oct 31, 2018
Contributor
Author
|
Thanks for the review. |
Contributor
Author
|
Backport provided in #10307 |
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.
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)