From 3db6459faeaadc85b94192dff1cb84317d19b960 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 1 Apr 2020 14:21:34 +0000 Subject: toradex-kernel/u-boot-localversion: use fixed length git hash Make sure the git hash is always 12 characters long. This avoids issues where we can get different length git hashes between to independent builds. This can be problematic when sstate is shared. Related-to: TOR-810 Signed-off-by: Stefan Agner --- classes/toradex-kernel-localversion.bbclass | 10 +++++----- classes/toradex-u-boot-localversion.bbclass | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/toradex-kernel-localversion.bbclass b/classes/toradex-kernel-localversion.bbclass index e2ec3a0..319ba96 100644 --- a/classes/toradex-kernel-localversion.bbclass +++ b/classes/toradex-kernel-localversion.bbclass @@ -26,18 +26,18 @@ kernel_do_configure_append() { 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` + head=`git --git-dir=${S}/.git rev-parse --verify --short=12 origin/${branch} 2> /dev/null` else - head=`git --git-dir=${S}/.git rev-parse --verify --short ${SRCREV_machine} 2> /dev/null` + head=`git --git-dir=${S}/.git rev-parse --verify --short=12 ${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` + head=`git --git-dir=${S}/.git rev-parse --verify --short=12 origin/${branch} 2> /dev/null` elif [ -n "${SRCREV}" -a "${SRCREV}" != "INVALID" ]; then - head=`git --git-dir=${S}/.git rev-parse --verify --short ${SRCREV} 2> /dev/null` + head=`git --git-dir=${S}/.git rev-parse --verify --short=12 ${SRCREV} 2> /dev/null` else - head=`git --git-dir=${S}/.git rev-parse --verify --short HEAD 2> /dev/null` + head=`git --git-dir=${S}/.git rev-parse --verify --short=12 HEAD 2> /dev/null` fi printf "+git.%s" $head > ${S}/.scmversion kernel_configure_variable LOCALVERSION_AUTO y diff --git a/classes/toradex-u-boot-localversion.bbclass b/classes/toradex-u-boot-localversion.bbclass index 153469d..3ad86db 100644 --- a/classes/toradex-u-boot-localversion.bbclass +++ b/classes/toradex-u-boot-localversion.bbclass @@ -19,7 +19,7 @@ UBOOT_LOCALVERSION = "${LOCALVERSION}" do_compile_prepend() { if [ "${SCMVERSION}" = "y" ]; then - head=`cd ${S} ; git rev-parse --verify --short HEAD 2> /dev/null` + head=`cd ${S} ; git rev-parse --verify --short=12 HEAD 2> /dev/null` printf "%s+git.%s" "${UBOOT_LOCALVERSION}" $head > ${S}/.scmversion printf "%s+git.%s" "${UBOOT_LOCALVERSION}" $head > ${B}/.scmversion fi -- cgit v1.2.3