Go to file
Thomas Petazzoni 9e4ffdc8cf Makefile: properly account for custom tags in BR2_VERSION_FULL
BR2_VERSION_FULL is currently defined as follows:

  BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)

This BR2_VERSION_FULL value then gets used as the "VERSION" variable
in the /etc/os-release file.

The logic of "setlocalversion" is that if it is exactly on a tag, it
returns nothing.

If it is on a tag + a number of commits, then it returns only
-XYZ-gABC where XYZ is the number of commits since the last tag, and
ABC the git commit hash (these are extracted from git describe).

This output then gets concatenated to BR2_VERSION which gives
something like 2020.05 or 2020.05-00123-g5bc6a.

The issue is that when you're on a tag specific to your project, which
is not a Buildroot YYYY.MM tag, then the output of setlocalversion is
empty, and all you get as VERSION in os-release is $(BR2_VERSION)
which is not really nice. Worse, if you have another non-official
Buildroot tag between the last official Buildroot tag/version and
where you are, you will get $(BR2_VERSION)-XYZ-gABC, but XYZ will not
correspond to the number of commits since BR2_VERSION, but since the
last tag that "git describe" as found, which is clearly incorrect.

Here is an example: you're on master, "make print-version" (which
displays BR2_VERSION_FULL) will show:

$ make print-version
2020.08-git-00758-gc351877a6e

So far so good. Now, you create a tag say 5 commits "before" master,
and show BR2_VERSION_FULL again:

$ git tag -a -m "dummy tag" dummy-tag HEAD~5
$ make print-version
2020.08-git-00005-gc351877a6e

This makes you believe you are 5 commits above 2020.08, which is
absolutely wrong.

So this commit simplifies the logic of setlocalversion to simply
return what "git describe" provides, and not prepend $(BR2_VERSION) in
the main Makefile. Since official Buildroot tags match official
Buildroot version names, you get the same output when you're on an
official Buildroot tag, or some commits above a Buildroot tag. An in
other cases, you get a sensible output. The logic is also adjusted for
the Mercurial case.

In the above situation, with this commit applied, we get:

$ make print-version
dummy-tag-6-g6258cdddeb

(6 commits instead of 5 as we have this very commit applied, but at
least it's 6 commits on top of the dummy-tag)

Finally, if you're not using a version control system, setlocalversion
was already returning nothing, so in this case, the Makefile simply
sets BR2_VERSION_FULL to BR2_VERSION to preserve this behavior.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit 98c99556e3)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-08-13 20:06:23 +02:00
arch arch/x86: adds BR2_X86_CPU_HAS_3DNOW flag 2020-07-16 18:18:26 +02:00
board board/raspberrypi: fix rpi4/rpi4-64 genimage config files 2020-07-22 09:06:29 +02:00
boot boot/grub2: Fix GRUB i386-pc build with Ubuntu gcc 2020-06-21 23:21:31 +02:00
configs configs/raspberrypi{3, 4}_64: enabling BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT no longer needed 2020-05-29 22:59:18 +02:00
docs docs/manual/adding-packages-generic.txt: fix typo 2020-07-05 23:16:28 +02:00
fs fs/cpio: generate reproducible archives 2020-07-16 18:33:32 +02:00
linux linux: bump CIP RT kernel to version 4.19.132-cip30-rt12 2020-08-13 11:29:43 +02:00
package package/nodejs: use system-icu for host-nodejs 2020-08-13 18:43:45 +02:00
support Makefile: properly account for custom tags in BR2_VERSION_FULL 2020-08-13 20:06:23 +02:00
system Revert "system: don't attempt swapon/swapoff in inittab if not available" 2020-02-08 20:13:07 +01:00
toolchain toolchain/toolchain-wrapper: let recent GCC handle SOURCE_DATE_EPOCH 2020-07-16 18:32:12 +02:00
utils utils/genrandconfig: drop outdated python-nfc check 2020-03-04 19:08:12 +01:00
.defconfig arch: remove support for sh64 2016-09-08 22:15:15 +02:00
.flake8 .flake8: fix check for 80/132 columns 2019-04-10 12:31:33 +02:00
.gitignore update gitignore 2013-05-04 12:41:55 +02:00
.gitlab-ci.yml gitlab-ci: convert only/except to rules 2020-08-13 11:43:09 +02:00
.gitlab-ci.yml.in gitlab-ci: convert only/except to rules 2020-08-13 11:43:09 +02:00
CHANGES Update for 2020.02.4 2020-07-26 10:08:24 +02:00
Config.in Config.in: update BR2_OPTIMIZE_FAST prompt and help text 2020-07-22 13:38:51 +02:00
Config.in.legacy package/python-pycrypto: remove package 2020-05-31 22:36:03 +02:00
COPYING COPYING: add exception about patch licensing 2016-02-26 19:50:13 +01:00
DEVELOPERS DEVELOPERS: add Angelo Compagnucci to several packages 2020-08-13 11:33:20 +02:00
Makefile Makefile: properly account for custom tags in BR2_VERSION_FULL 2020-08-13 20:06:23 +02:00
Makefile.legacy Remove BR2_DEPRECATED 2016-10-15 23:14:45 +02:00
README README: add reference to submitting-patches 2016-02-01 19:16:08 +01:00

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on Freenode IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches