From 6ca5aaa1fc53b1409277fcc0a694d5ba9e05cd64 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 21 Nov 2018 22:46:36 +0900 Subject: [PATCH] configure: Fix BUILDID (again) The previous commit made BUILDID use git for submodule, but for complex git setup (e.g. worktree) and older git version or dead .git 'link' it would blindly rely on the existence of the .git file even if git does not actually find anything. This would lead to possibly empty BUILDID which would fail building. Just always run the git command, and echo the version string if it failed Change-Id: Ied268d2150a30dc1146498e15fa8394afc8a8d0d --- configure | 2 +- configure.ac | 2 +- ihk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 183af782..de542aa9 100755 --- a/configure +++ b/configure @@ -4886,7 +4886,7 @@ _ACEOF ABS_SRCDIR=$( cd $( dirname $0 ); pwd ) IHK_ABS_SRCDIR=${ABS_SRCDIR}/../ihk -BUILDID=$( cd $IHK_ABS_SRCDIR; if [ ! -e .git ]; then echo $IHK_VERSION; else bash -c 'git rev-list -1 HEAD | cut -c1-8'; fi ) +BUILDID=$( git --git-dir=$IHK_ABS_SRCDIR/.git rev-parse --short HEAD 2>/dev/null || echo $IHK_VERSION ) { $as_echo "$as_me:${as_lineno-$LINENO}: BUILDID=$BUILDID" >&5 $as_echo "$as_me: BUILDID=$BUILDID" >&6;} if test "x$BUILDID" != "x" ; then diff --git a/configure.ac b/configure.ac index 40fac2da..4cf8cc26 100644 --- a/configure.ac +++ b/configure.ac @@ -544,7 +544,7 @@ AC_DEFINE_UNQUOTED(MCKERNEL_VERSION,"$MCKERNEL_VERSION",[McKernel version string ABS_SRCDIR=$( cd $( dirname $0 ); pwd ) IHK_ABS_SRCDIR=${ABS_SRCDIR}/../ihk -BUILDID=$( cd $IHK_ABS_SRCDIR; if @<:@ ! -e .git @:>@; then echo $IHK_VERSION; else bash -c 'git rev-list -1 HEAD | cut -c1-8'; fi ) +BUILDID=$( git --git-dir=$IHK_ABS_SRCDIR/.git rev-parse --short HEAD 2>/dev/null || echo $IHK_VERSION ) AC_MSG_NOTICE([BUILDID=$BUILDID]) if test "x$BUILDID" != "x" ; then AC_DEFINE_UNQUOTED(BUILDID,"$BUILDID",[IHK build-id to confirm IHK and McKernel built at the same time are used]) diff --git a/ihk b/ihk index a7a200fd..4a8e719f 160000 --- a/ihk +++ b/ihk @@ -1 +1 @@ -Subproject commit a7a200fd3ef3d5ef18da6d8452d16f4cab2ca578 +Subproject commit 4a8e719fa0a1443b0ff447bce2d96c42e54da414