From 6a32811ebd5d2952198b4fd644d9f29cf8c12aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Thu, 30 Apr 2020 22:27:55 +0200 Subject: [PATCH] AppVeyor's Git is using a strftime() that doesn't support %s --- scripts/build_nim.sh | 7 +++++-- scripts/build_p2pd.sh | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/build_nim.sh b/scripts/build_nim.sh index d36c1ab..27ddd55 100755 --- a/scripts/build_nim.sh +++ b/scripts/build_nim.sh @@ -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 diff --git a/scripts/build_p2pd.sh b/scripts/build_p2pd.sh index 3e215d2..bcf47fa 100755 --- a/scripts/build_p2pd.sh +++ b/scripts/build_p2pd.sh @@ -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