diff options
author | Jun Zhu <junzhu@nxp.com> | 2023-12-05 18:36:12 +0800 |
---|---|---|
committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2023-12-05 11:29:49 +0000 |
commit | 2701571da61ab0ee690b6e17e26bbc99f271b3b9 (patch) | |
tree | 2a69fb7756e06d66e8dd4291d2e23259f7b07ada | |
parent | 457465ca5c2063c49a4c230dcc2634d6c7e5bc63 (diff) | |
download | meta-freescale-2701571da61ab0ee690b6e17e26bbc99f271b3b9.tar.gz |
fsl-u-boot-localversion.bbclass: fix SRCREV_machine and AUTOREV use cases
Use the same logic as fsl-kernel-localversion.bbclass:
commit 16a356ef0d5d62090e84530e125ea6952994aaeb
Signed-off-by: Jun Zhu <junzhu@nxp.com>
(cherry picked from commit d7e13f19fbf93cb0bd87c29b44c5012e2e0e4393)
-rw-r--r-- | classes/fsl-u-boot-localversion.bbclass | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/classes/fsl-u-boot-localversion.bbclass b/classes/fsl-u-boot-localversion.bbclass index d160ca98..94b30c04 100644 --- a/classes/fsl-u-boot-localversion.bbclass +++ b/classes/fsl-u-boot-localversion.bbclass | |||
@@ -17,11 +17,21 @@ 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 ${SRCREV} 2> /dev/null` | 20 | if [ "${SRCREV}" = "INVALID" ]; then |
21 | patches=`cd ${S} ; git rev-list --count ${SRCREV}..HEAD 2> /dev/null` | 21 | hash=${SRCREV_machine} |
22 | printf "%s%s%s%s%s" "${UBOOT_LOCALVERSION}" +g $head +p $patches > ${S}/.scmversion | 22 | else |
23 | printf "%s%s%s%s%s" "${UBOOT_LOCALVERSION}" +g $head +p $patches > ${B}/.scmversion | 23 | hash=${SRCREV} |
24 | else | 24 | fi |
25 | if [ "$hash" = "AUTOINC" ]; then | ||
26 | branch=`git --git-dir=${S}/.git symbolic-ref --short -q HEAD` | ||
27 | head=`git --git-dir=${S}/.git rev-parse --verify --short origin/${branch} 2> /dev/null` | ||
28 | else | ||
29 | head=`git --git-dir=${S}/.git rev-parse --verify --short $hash 2> /dev/null` | ||
30 | fi | ||
31 | patches=`git --git-dir=${S}/.git rev-list --count $head..HEAD 2> /dev/null` | ||
32 | printf "%s%s%s%s" +g $head +p $patches > ${S}/.scmversion | ||
33 | printf "%s%s%s%s" +g $head +p $patches > ${B}/.scmversion | ||
34 | else | ||
25 | printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion | 35 | printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion |
26 | printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion | 36 | printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion |
27 | fi | 37 | fi |