From 319f84b395d5b129c7dca90554746589d2bb9f52 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Fri, 6 Mar 2020 23:46:19 +0100 Subject: 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 --- classes/toradex-kernel-localversion.bbclass | 12 ++++++++++-- 1 file 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` -- cgit v1.2.3