diff options
Diffstat (limited to 'classes/fsl-u-boot-localversion.bbclass')
-rw-r--r-- | classes/fsl-u-boot-localversion.bbclass | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/classes/fsl-u-boot-localversion.bbclass b/classes/fsl-u-boot-localversion.bbclass index ebde8ea7..94b30c04 100644 --- a/classes/fsl-u-boot-localversion.bbclass +++ b/classes/fsl-u-boot-localversion.bbclass @@ -17,10 +17,21 @@ UBOOT_LOCALVERSION = "${LOCALVERSION}" do_compile:prepend() { if [ "${SCMVERSION}" = "y" ]; then # Add GIT revision to the local version - head=`cd ${S} ; git rev-parse --verify --short HEAD 2> /dev/null` - printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${S}/.scmversion - printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${B}/.scmversion - else + if [ "${SRCREV}" = "INVALID" ]; then + hash=${SRCREV_machine} + else + hash=${SRCREV} + fi + if [ "$hash" = "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 $hash 2> /dev/null` + fi + patches=`git --git-dir=${S}/.git rev-list --count $head..HEAD 2> /dev/null` + printf "%s%s%s%s" +g $head +p $patches > ${S}/.scmversion + printf "%s%s%s%s" +g $head +p $patches > ${B}/.scmversion + else printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion fi |