AppVeyor's Git is using a strftime() that doesn't support %s

This commit is contained in:
Ștefan Talpalaru 2020-04-30 22:27:55 +02:00
parent c8278c4ca4
commit 6a32811ebd
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 9 additions and 3 deletions

View File

@ -36,9 +36,12 @@ UCPU=""
if uname | grep -qiE "mingw|msys"; then
ON_WINDOWS=1
EXE_SUFFIX=".exe"
# otherwise it fails in AppVeyor due to https://github.com/git-for-windows/git/issues/2495
GIT_TIMESTAMP_ARG="--date=unix"
else
ON_WINDOWS=0
EXE_SUFFIX=""
GIT_TIMESTAMP_ARG="--date=format-local:%s"
fi
NIM_BINARY="${NIM_DIR}/bin/nim${EXE_SUFFIX}"
@ -56,7 +59,7 @@ nim_needs_rebuilding() {
fi
# compare the built commit's timestamp to the date of the last commit (keep in mind that Git doesn't preserve file timestamps)
if [[ -e "${NIM_DIR}/bin/timestamp" && $(cat "${NIM_DIR}/bin/timestamp") -eq $(cd "$NIM_DIR"; git log --pretty=format:%cd -n 1 --date=format-local:%s) ]]; then
if [[ -e "${NIM_DIR}/bin/timestamp" && $(cat "${NIM_DIR}/bin/timestamp") -eq $(cd "$NIM_DIR"; git log --pretty=format:%cd -n 1 ${GIT_TIMESTAMP_ARG}) ]]; then
return $NO_REBUILD
else
return $REBUILD
@ -125,7 +128,7 @@ build_nim() {
rm build_all_custom.sh
# record the last commit's timestamp
git log --pretty=format:%cd -n 1 --date=format-local:%s > bin/timestamp
git log --pretty=format:%cd -n 1 ${GIT_TIMESTAMP_ARG} > bin/timestamp
# update the CI cache
popd # we were in $NIM_DIR

View File

@ -30,8 +30,11 @@ fi
# Windows detection
if uname | grep -qiE "mingw|msys"; then
EXE_SUFFIX=".exe"
# otherwise it fails in AppVeyor due to https://github.com/git-for-windows/git/issues/2495
GIT_TIMESTAMP_ARG="--date=unix"
else
EXE_SUFFIX=""
GIT_TIMESTAMP_ARG="--date=format-local:%s"
fi
# macOS
@ -54,7 +57,7 @@ target_needs_rebuilding() {
fi
# compare binary mtime to the date of the last commit (keep in mind that Git doesn't preserve file timestamps)
if [[ -e "$TARGET_BINARY" && $(stat $STAT_FORMAT "$TARGET_BINARY") -gt $(cd "$SUBREPO_DIR"; git log --pretty=format:%cd -n 1 --date=format-local:%s) ]]; then
if [[ -e "$TARGET_BINARY" && $(stat $STAT_FORMAT "$TARGET_BINARY") -gt $(cd "$SUBREPO_DIR"; git log --pretty=format:%cd -n 1 ${GIT_TIMESTAMP_ARG}) ]]; then
return $NO_REBUILD
else
return $REBUILD