genbuild_h.sh: use the last git commit as timesource if available
Change-Id: I1472265adac9406a86da22839199ec6bbdaa0c69 Signed-off-by: Alexander Couzens <lynxis@fe80.eu> Reviewed-on: http://review.coreboot.org/8619 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
83b05eb0a8
commit
a74d569731
|
@ -18,7 +18,18 @@
|
|||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
DATE=""
|
||||
GITREV=""
|
||||
TIMESOURCE=""
|
||||
if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
|
||||
GITREV=$(LANG= git log remotes/origin/master -1 --format=format:%h)
|
||||
TIMESOURCE=git
|
||||
DATE=$(git log --pretty=format:%ct -1)
|
||||
else
|
||||
GITREV=Unknown
|
||||
TIMESOURCE="LANG= TZ=UTC date"
|
||||
DATE=$(date +%s)
|
||||
fi
|
||||
|
||||
#Print out the information that goes into build.h
|
||||
printf "/* build system definitions (autogenerated) */\n"
|
||||
|
@ -27,15 +38,9 @@ printf "#define __BUILD_H\n\n"
|
|||
printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
|
||||
|
||||
#See if the build is running in a git repo and the git command is available
|
||||
if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
|
||||
printf "/* %s UTC */\n" "$(LANG= TZ=UTC git log --date=local --pretty=format:%cd -1)"
|
||||
printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "$(git log --pretty=format:%ct -1)"
|
||||
printf "#define COREBOOT_ORIGIN_GIT_REVISION \"%s\"\n" "$(LANG= git log remotes/origin/master -1 --format=format:%h)"
|
||||
else
|
||||
printf "/* `LANG= TZ=UTC date` */\n"
|
||||
printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "$(LANG= date -d @$DATE +%s)"
|
||||
printf "#define COREBOOT_ORIGIN_GIT_REVISION \"Unknown\"\n"
|
||||
fi
|
||||
printf "/* timesource: $TIMESOURCE */\n"
|
||||
printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
|
||||
printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
|
||||
|
||||
printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
|
||||
printf "#define COREBOOT_BUILD \"%s\"\n" "$(LANG= TZ=UTC date -d @$DATE)"
|
||||
|
|
Loading…
Reference in New Issue