diff options
author | Daniel Wagenknecht <dwagenknecht@emlix.com> | 2023-11-28 11:47:34 +0100 |
---|---|---|
committer | Daniel Wagenknecht <dwagenknecht@emlix.com> | 2023-11-28 12:05:41 +0100 |
commit | 415373942a8f3ca4c6f04dff35823c065f43d696 (patch) | |
tree | 09035dd75d124e135cb26db443c65532ff9c77b5 /classes/fsl-u-boot-localversion.bbclass | |
parent | 7f0a7f3d19f564da0faf20e279b1b18a7f0068b6 (diff) | |
download | meta-freescale-415373942a8f3ca4c6f04dff35823c065f43d696.tar.gz |
classes: make localversion classes deterministic
The localversion string built into the kernel and u-boot should be
deterministic. With OpenEmbedded it is common practice to apply patches
to the sources. The commit id of HEAD will differ each time the patching
step is rerun. With the previous implementation of the fsl-{kernel,u-
boot}-localversion classes this produced non-deterministic commit ids to
be used. This is undesireable, because the commit-id read from the
version string during runtime is not present in the sources. It also
caused problems when building out-of-tree kernel-modules if the kernel
itself was taken from sstate cache but the kernel-module needed to be
rebuild and retriggered the kernels do_patch task (see #961).
Rework to produce a deterministic string that will use the commit id
given as SRCREV and count the number of patches applied on top.
With e.g. commit id 11aabbcc and 5 patches this will result in a version
string
+g11aabbcc+p5
Fixes: https://github.com/Freescale/meta-freescale/issues/961
Signed-off-by: Daniel Wagenknecht <dwagenknecht@emlix.com>
Diffstat (limited to 'classes/fsl-u-boot-localversion.bbclass')
-rw-r--r-- | classes/fsl-u-boot-localversion.bbclass | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/classes/fsl-u-boot-localversion.bbclass b/classes/fsl-u-boot-localversion.bbclass index ebde8ea7..d160ca98 100644 --- a/classes/fsl-u-boot-localversion.bbclass +++ b/classes/fsl-u-boot-localversion.bbclass | |||
@@ -17,9 +17,10 @@ UBOOT_LOCALVERSION = "${LOCALVERSION}" | |||
17 | do_compile:prepend() { | 17 | do_compile:prepend() { |
18 | if [ "${SCMVERSION}" = "y" ]; then | 18 | if [ "${SCMVERSION}" = "y" ]; then |
19 | # Add GIT revision to the local version | 19 | # Add GIT revision to the local version |
20 | head=`cd ${S} ; git rev-parse --verify --short HEAD 2> /dev/null` | 20 | head=`cd ${S} ; git rev-parse --verify --short ${SRCREV} 2> /dev/null` |
21 | printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${S}/.scmversion | 21 | patches=`cd ${S} ; git rev-list --count ${SRCREV}..HEAD 2> /dev/null` |
22 | printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${B}/.scmversion | 22 | printf "%s%s%s%s%s" "${UBOOT_LOCALVERSION}" +g $head +p $patches > ${S}/.scmversion |
23 | printf "%s%s%s%s%s" "${UBOOT_LOCALVERSION}" +g $head +p $patches > ${B}/.scmversion | ||
23 | else | 24 | else |
24 | printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion | 25 | printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion |
25 | printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion | 26 | printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion |