Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: more deterministic git describe --abbrev=12 #13608

Merged
merged 1 commit into from
Feb 27, 2019

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Feb 21, 2019

Hardcode --abbrev=12 not to depend on personal git config preference.
12 is deemed large enough for the Linux kernel which should leave some
room:
https://public-inbox.org/git/[email protected]/

Add --dirty because it should be the default: who likes to be duped into
thinking they're debugging an exact version when they're not?

Signed-off-by: Marc Herbert [email protected]

@codecov-io
Copy link

codecov-io commented Feb 21, 2019

Codecov Report

Merging #13608 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13608      +/-   ##
==========================================
- Coverage   52.34%    52.3%   -0.04%     
==========================================
  Files         307      307              
  Lines       45350    45350              
  Branches    10464    10464              
==========================================
- Hits        23737    23721      -16     
- Misses      16865    16877      +12     
- Partials     4748     4752       +4
Impacted Files Coverage Δ
subsys/testsuite/ztest/include/ztest_assert.h 35% <0%> (-35%) ⬇️
subsys/testsuite/ztest/src/ztest.c 65.28% <0%> (-7.44%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 992f29a...b40d6d0. Read the comment docs.

Copy link
Collaborator

@SebastianBoe SebastianBoe left a comment

Choose a reason for hiding this comment

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

+1 to --abbrev=12, the build should be system-independent.

-1 to --dirty

I often test patches that I expect will not have an affect on the hex file by doing:

build --build-dir=b_0
git stash
build --build-dir=b_1
kdiff b_0 b_1

without --dirty I can verify that my stashed patch did not corrupt the build, but with --dirty I can not.

Presumably, the BUILD_VERSION exists for non-developers to be able to identify their build, any developer worth his salt will not distribute a build with a dirty working directory, so the --dirty flag is not needed in production, and harmful for developers that test like me.

@marc-hb
Copy link
Collaborator Author

marc-hb commented Feb 22, 2019

Thanks everyone for the review.

build --build-dir=b_0
git stash
build --build-dir=b_1
kdiff b_0 b_1

without --dirty I can verify that my stashed patch did not corrupt the build, but with --dirty I can not.

Interesting, I didn't think of that use case. Making a whitespace change after the git stash would be a simple workaround but I get your point.

To solve the same problem I typically do something "git add builddir/" and revert / comment out the source changes "manually" instead of using git stash. Then I can keep using all the same and usual set of git diff options than for source code. For non-trivial commits I tend to want finer-grained "revert" abilities anyway, git stash is too coarse and wouldn't work. For coarse reverts I git checkout HEAD~

any developer worth his salt will not distribute a build with a dirty working directory,

Depending on what you mean by "distribute" this is actually quite frequent, for instance when several people debug the same hardware and change the code (debug statements, others) frequently. Or even just one person interrupted by meetings or other context switches.

Anyway --dirty is unrelated to the this topic so I'll remove it. Maybe I'll try to make it optional in another PR.

@marc-hb marc-hb force-pushed the deterministic-builds branch from 59f10c7 to 113ebce Compare February 22, 2019 21:07
Hardcode --abbrev=12 not to depend on personal git config preference.
12 is deemed large enough for the Linux kernel which should leave some
room:
https://public-inbox.org/git/[email protected]/

Signed-off-by: Marc Herbert <[email protected]>
@marc-hb marc-hb force-pushed the deterministic-builds branch from 113ebce to b40d6d0 Compare February 22, 2019 21:10
@marc-hb
Copy link
Collaborator Author

marc-hb commented Feb 22, 2019

The last force push doesn't show any difference because github can apparently not compare commit messages. Doh.

@marc-hb marc-hb changed the title cmake: more deterministic git describe --abbrev=12 --dirty cmake: more deterministic git describe --abbrev=12 Feb 22, 2019
@marc-hb marc-hb requested a review from SebastianBoe February 22, 2019 22:02
@marc-hb marc-hb requested a review from mped-oticon February 25, 2019 02:03
@marc-hb marc-hb added Enhancement Changes/Updates/Additions to existing features area: Build System Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. labels Feb 26, 2019
@SebastianBoe
Copy link
Collaborator

@carlescufi : This is ready to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System Enhancement Changes/Updates/Additions to existing features Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants