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 <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32299
Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Georgi 2019-04-12 11:08:17 +02:00
parent 29368167b5
commit 237baa1433
1 changed files with 8 additions and 2 deletions

View File

@ -22,14 +22,20 @@ export LANG=C
export LC_ALL=C export LC_ALL=C
export TZ=UTC0 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 if [ "${BUILD_TIMELESS}" = "1" ]; then
GITREV=Timeless GITREV=Timeless
TIMESOURCE="fixed" TIMESOURCE="fixed"
DATE=0 DATE=0
elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then 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 TIMESOURCE=git
DATE=$(git log --no-show-signature --pretty=format:%ct -1) DATE=$(get_git_head_data %ct)
else else
GITREV=Unknown GITREV=Unknown
TIMESOURCE="date" TIMESOURCE="date"