From 237baa14331930e73a46a44abfe35adedc212dc3 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 12 Apr 2019 11:08:17 +0200 Subject: util/genbuild_h: Allow operation with older git versions if git log --no-show-signature is not supported, retry without. Change-Id: I9ee1f8e887cde5e4d6c5e6958f269c62572cdd53 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/32299 Reviewed-by: Subrata Banik Reviewed-by: Werner Zeh Tested-by: build bot (Jenkins) --- util/genbuild_h/genbuild_h.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh index 5c45b2b1f8..bafdbc95d7 100755 --- a/util/genbuild_h/genbuild_h.sh +++ b/util/genbuild_h/genbuild_h.sh @@ -22,14 +22,20 @@ export LANG=C export LC_ALL=C export TZ=UTC0 +# $1: format string +get_git_head_data() { + LANG= git log --no-show-signature -1 --format="format:$1" 2>/dev/null || \ + LANG= git log -1 --format="format:$1" +} + if [ "${BUILD_TIMELESS}" = "1" ]; then GITREV=Timeless TIMESOURCE="fixed" DATE=0 elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then - GITREV=$(LANG= git log --no-show-signature -1 --format=format:%h) + GITREV=$(get_git_head_data %h) TIMESOURCE=git - DATE=$(git log --no-show-signature --pretty=format:%ct -1) + DATE=$(get_git_head_data %ct) else GITREV=Unknown TIMESOURCE="date" -- cgit v1.2.3