summaryrefslogtreecommitdiff
path: root/meta-phosphor/recipes-core
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2021-07-01 00:15:45 +0300
committerPatrick Williams <patrick@stwcx.xyz>2021-07-01 01:37:50 +0300
commit24d05d0bba777238227121f79f3e8b02bb2bb535 (patch)
treef1af03bf2c87fdd01d98fe3372827e2bf4f9c9fe /meta-phosphor/recipes-core
parenta430033d3bffc7d3f9f9d84611f68049d8b17f75 (diff)
downloadopenbmc-24d05d0bba777238227121f79f3e8b02bb2bb535.tar.xz
meta-phosphor: os-release: fix task caching with DISTRO_VERSION
It was reported that the following sequence would not cause `os-release` to rebuild: ``` bitbake os-release git commit --amend bitbake os-release ``` This is due to how bitbake task hashing is implemented with respect to weak variables. In 439c59b, DISTRO_VERSION was changed to a weak variable, but it is included in the 'vardeps' chain for 'do_compile'. When bitbake computes the hash for a task, typically the contents of the variables are used for the hashing, but for weak variables only the definition is used. (Confirmed by adding bb.note debugs to `poky/bitbake/lib/bb/data.py`) The new, weak DISTRO_VERSION is intended to be populated with contents from a `git describe` operation. Those contents must be used in the hashing of the 'do_compile' task and not the definition. This can be accomplished by creating an indirection using a strong variable. The dependency chain and hash evaluation will be as follows: ``` do_compile -> DISTRO_VERSION -> PHOSPHOR_OS_RELEASE_DISTRO_VERSION hash(do_compile) = ... + DISTRO_VERSION:${PHOSPHOR_OS_RELEASE_DISTRO_VERSION} + PHOSPHOR_...DISTRO_VERSION=2.11.0-dev-... ``` Prior to this fix the hash evaluation was: ``` hash(do_compile) = ... + DISTRO_VERSION:${@run_git...} ``` Fixes 439c59b425cf403355571875b3fa714782dcf15b. Tested: Ensure the above reported sequence causes a rebuild of os-release with expected data. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0bd93d3d88bf62dfe03549419fe98ab85f10a68c
Diffstat (limited to 'meta-phosphor/recipes-core')
-rw-r--r--meta-phosphor/recipes-core/os-release/os-release.bbappend10
1 files changed, 9 insertions, 1 deletions
diff --git a/meta-phosphor/recipes-core/os-release/os-release.bbappend b/meta-phosphor/recipes-core/os-release/os-release.bbappend
index f42235e4c..1a3b22898 100644
--- a/meta-phosphor/recipes-core/os-release/os-release.bbappend
+++ b/meta-phosphor/recipes-core/os-release/os-release.bbappend
@@ -15,7 +15,15 @@ def run_git(d, cmd):
bb.warn("Unexpected exception from 'git' call: %s" % e)
pass
-DISTRO_VERSION ??= "${@run_git(d, 'describe --dirty')}"
+# DISTRO_VERSION can be overridden by a bbappend or config, so it must be a
+# weak override. But, when a variable is weakly overridden the definition
+# and not the contents are used in the task-hash (for sstate reuse). We need
+# a strong variable in the vardeps chain for do_compile so that we get the
+# contents of the 'git describe --dirty' call. Create a strong/immediate
+# indirection via PHOSPHOR_OS_RELEASE_DISTRO_VERSION.
+PHOSPHOR_OS_RELEASE_DISTRO_VERSION := "${@run_git(d, 'describe --dirty')}"
+DISTRO_VERSION ??= "${PHOSPHOR_OS_RELEASE_DISTRO_VERSION}"
+
VERSION = "${@'-'.join(d.getVar('VERSION_ID').split('-')[0:2])}"
BUILD_ID := "${@run_git(d, 'describe --abbrev=0')}"