diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2020-03-06 23:46:19 +0100 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2020-03-06 23:48:56 +0100 |
commit | 319f84b395d5b129c7dca90554746589d2bb9f52 (patch) | |
tree | b696840be7769cc1cac8835d6021eb5ec6d1729e | |
parent | 3e645e66daea9951a02b9de0f52864a79389e23a (diff) |
toradex-kernel-localversion.bbclass: fix set scmversion with autorev
Handle the case where SRCREV_machine is set to AUTOREV.
As SRCREV_machine isn't set to INVALID as its default drop checking for INVALID.
fixes: f22318f toradex-kernel-localversion.bbclass: use SRCREV to set scmversion
Related-to: TOR-694
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
-rw-r--r-- | classes/toradex-kernel-localversion.bbclass | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/classes/toradex-kernel-localversion.bbclass b/classes/toradex-kernel-localversion.bbclass index 766bd0a..f23ee58 100644 --- a/classes/toradex-kernel-localversion.bbclass +++ b/classes/toradex-kernel-localversion.bbclass @@ -21,8 +21,16 @@ kernel_do_configure_append() { sed -i -e /CONFIG_LOCALVERSION_AUTO/d ${B}/.config if [ "${SCMVERSION}" = "y" ]; then # Add GIT revision to the local version - if [ -n "${SRCREV_machine}" -a "${SRCREV_machine}" != "INVALID" ]; then - head=`git --git-dir=${S}/.git rev-parse --verify --short ${SRCREV_machine} 2> /dev/null` + # SRCREV_machine is used in kernel recipes using kernel-yocto.bbclass, + # e.g. our linux-toradex-mainline recipe + if [ -n "${SRCREV_machine}" ]; then + if [ "${SRCREV_machine}" = "AUTOINC" ]; then + branch=`git --git-dir=${S}/.git symbolic-ref --short -q HEAD` + head=`git --git-dir=${S}/.git rev-parse --verify --short origin/${branch} 2> /dev/null` + else + head=`git --git-dir=${S}/.git rev-parse --verify --short ${SRCREV_machine} 2> /dev/null` + fi + # SRCREV is used by linux-toradex recipes elif [ -n "${SRCREV}" -a "${SRCREV}" = "AUTOINC" ]; then branch=`git --git-dir=${S}/.git symbolic-ref --short -q HEAD` head=`git --git-dir=${S}/.git rev-parse --verify --short origin/${branch} 2> /dev/null` |