Skip to content

Commit

Permalink
fsl-u-boot-localversion.bbclass: fix SRCREV_machine and AUTOREV use c…
Browse files Browse the repository at this point in the history
…ases

Use the same logic as fsl-kernel-localversion.bbclass:
    commit 16a356e

Signed-off-by: Jun Zhu <[email protected]>
  • Loading branch information
junzhuimx committed Dec 5, 2023
1 parent 92a1b94 commit d7e13f1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions classes/fsl-u-boot-localversion.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +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 ${SRCREV} 2> /dev/null`
patches=`cd ${S} ; git rev-list --count ${SRCREV}..HEAD 2> /dev/null`
printf "%s%s%s%s%s" "${UBOOT_LOCALVERSION}" +g $head +p $patches > ${S}/.scmversion
printf "%s%s%s%s%s" "${UBOOT_LOCALVERSION}" +g $head +p $patches > ${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
Expand Down

0 comments on commit d7e13f1

Please sign in to comment.