coreboot-kgpe-d16/util/genbuild_h
Reka Norman 5e78090306 util/genbuild_h: Only use version tags in expected format
With commit 0110e1abe0 ("util/genbuild_h: Update printf %d to %s for
sh compatability"), the ChromeOS coreboot build is failing with:

In file included from src/lib/version.c:4:
/build/nissa/tmp/portage/sys-boot/coreboot-0.0.1-r5473/work/build/nivviks/build.h:10:32: error: 'v1' undeclared here (not in a function)
   10 | #define COREBOOT_MAJOR_VERSION v1
      |                                ^~
src/lib/version.c:35:46: note: in expansion of macro 'COREBOOT_MAJOR_VERSION'
   35 | const unsigned int coreboot_major_revision = COREBOOT_MAJOR_VERSION;
      |                                              ^~~~~~~~~~~~~~~~~~~~~~
/build/nissa/tmp/portage/sys-boot/coreboot-0.0.1-r5473/work/build/nivviks/build.h:11:32: error: 'v9308' undeclared here (not in a function)
   11 | #define COREBOOT_MINOR_VERSION v9308
      |                                ^~~~~
src/lib/version.c:36:46: note: in expansion of macro 'COREBOOT_MINOR_VERSION'
   36 | const unsigned int coreboot_minor_revision = COREBOOT_MINOR_VERSION;
      |                                              ^~~~~~~~~~~~~~~~~~~~~~

This is because the ChromeOS coreboot repo has a tag which is not in the
expected <major>.<minor> format:
$ git tag
v1.9308_26_0.0.22

Change genbuild_h.sh to only use the version from `git describe` if it's
in the expected <major>.<minor> format.

TEST=ChromeOS coreboot build now succeeds, with versions set to 0:
 #define COREBOOT_MAJOR_VERSION 0
 #define COREBOOT_MINOR_VERSION 0

Building upstream coreboot, the versions are still set correctly:
 #define COREBOOT_MAJOR_VERSION 4
 #define COREBOOT_MINOR_VERSION 18

Change-Id: I81b2317a83cdec4cc2aad60af2990e5e3f4ad694
Signed-off-by: Reka Norman <rekanorman@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70770
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Usha P <usha.p@intel.com>
2022-12-17 20:37:22 +00:00
..
description.md
genbuild_h.sh util/genbuild_h: Only use version tags in expected format 2022-12-17 20:37:22 +00:00