Commit Graph

9 Commits

Author SHA1 Message Date
Torsten Rasmussen 2a74dc26de cmake: cleanup version printing during CMake configure time
Follow-up: #34842

This is a follow-up commit that ensures relevant version information
regarding the build is located together as discussed in #34842.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-05-07 20:50:02 -04:00
Torsten Rasmussen 8ff65f4087 cmake: get: using NOT DEFINE BUILD_VERSION instead of NOT BUILD_VERSION
If user is specifying `-DBUILD_VERSION=<value>` then the proper way to
test is using `NOT DEFINED BUILD_VERSION`.

The difference between `NOT DEFINED BUILD_VERSION` and
`NOT BUILD_VERSION` is that a user specifying `-DBUILD_VERSION=0` will
result in `NOT BUILD_VERSION` becoming true, whereas
`NOT DEFINED BUILD_VERSION` would be false, which is the correct
behavior here, as the user actually provided a specific BUILD_VERSION.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-05-07 20:50:02 -04:00
Marc Herbert 4ea66b32fa git.cmake: git describe --always to support shallow clones
There's no reason for BUILD_VERSION to work only when there are git
tags.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-06 16:30:15 -05:00
Marc Herbert 654a2f245d git.cmake: print BUILD_VERSION always, simplify and fix error message
In an ideal world, good CIs make it very clear what exact git versions
are getting built. However:

- Zephyr is (re-)used in many projects and they cannot all be expected
  to have ideal CI.

- CI with multiple git repos is complex (#34713) which makes the world
  an even less ideal place: much more chance for some git versions to be
  missing.

- Many developers don't realize that Github and other CIs do not test
  pull/12345/head but the moving target pull/12345/merge instead. While
  not resolving pull/12345/merge completely (maybe another day), this
  commit provides at least evidence that pull/12345/head is NOT the
  commit tested.

So the addition of the following line in the logs is a very small price
to pay that can save enormous amounts of time when trying to understand
some obscure build failures.

-- BUILD_VERSION=zephyr-v2.5.0-2957-g6230b5bb66bc

Note this obviously does not provide any git information when
BUILD_VERSION is overriden but it does not hurt either in this case:
knowing BUILD_VERSION was overriden is also useful.

The "BUILD_VERSION is left undefined" message was just wrong in
the (unlikely) case `git describe` printed something while also
failing. Remove it; it's so much simpler to just print $BUILD_VERSION
and give the direct, unfiltered information.

Note this simplification is also a partial revert of 1b80f00f56
which threw the entire git warnings "baby" with some obscure duplicate
1.13.0 "bathwater" that is not relevant any more and that I guess barely
anyone noticed even at the time.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-06 16:30:15 -05:00
Marc Herbert a880fb1343 cmake: explain BUILD_VERSION and KERNEL_VERSION_*
- Add examples for the latter.
- Point at each other and highlight how independent they are from each
  other.
- State their inputs and outputs in plain English.
- Fix "git describe" error message giving the wrong impression that
  everyone cares about BUILD_VERSION. Only the boot banner cares now.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-05-09 11:52:05 +02:00
Marc Herbert 39131dc3ce git.cmake: let the environment override BUILD_VERSION
This is needed to remove noise when comparing binaries across git
commits and more generally for anyone who wants to manual
control/override the version number when building with or without a
.git/ subdirectory.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-04-17 08:30:41 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Marc Herbert f085647521 cmake: more deterministic git describe --abbrev=12
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/xmqq37knwcf4.fsf@gitster.mtv.corp.google.com/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-02-27 10:27:47 +01:00
Mark Ruvald Pedersen 55d6b4cd7c cmake: boilerplate: Move out finding git+python to separate cmake files
Follow the same convention as that of ccache.
Improve readability of boilerplate.cmake file.
Move inclusion of version.cmake up to satisfy git.cmake dependency.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2018-12-27 19:24:51 -05:00