Additional set TZ=UTC to have predictable `date` output.
Signed-off-by: Alexander Couzens lynxis@fe80.eu --- scripts/buildversion.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/buildversion.sh b/scripts/buildversion.sh index 16c043f..f63b9a0 100755 --- a/scripts/buildversion.sh +++ b/scripts/buildversion.sh @@ -2,16 +2,18 @@ # Script to generate a C file with version information. OUTFILE="$1" VAR16MODE="$2" +DATE=$(date +%s)
# Extract version info if [ -d .git -o -f .git ]; then - VERSION="`git describe --tags --long --dirty`" + VERSION="$(git describe --tags --long --dirty)" + DATE="$(git log --date=local --pretty=format:%ct -1)" elif [ -f .version ]; then - VERSION="`cat .version`" + VERSION="$(cat .version)" else VERSION="?" fi -VERSION="${VERSION}-`date +"%Y%m%d_%H%M%S"`" +VERSION="${VERSION}-$(TZ=UTC date -d @$DATE +%Y%m%d_%H%M%S)" echo "Version: ${VERSION}"
# Build header file