Skip to content

Commit 0c7acd2

Browse files
committed
scripts: fix stat command compatibility for Linux in release script
Move the MTIME assignment inside the platform-specific branches: use stat -f on macOS and stat -c with date on Linux, since the original stat -f syntax is macOS-only.
1 parent 4fd809e commit 0c7acd2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

scripts/release/make_release_artifacts.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,17 @@ case "$1" in
106106
mv "${REPO_NAME}-${RELEASE_VERSION}-rc.${RC_NUMBER}" "${TAR_TOP_DIR_NAME}"
107107

108108
echo "[INFO] Normalizing tarball metadata..."
109-
MTIME=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "${TAR_TOP_DIR_NAME}/LICENSE")
110109

111110
# On macOS, use gnu-tar
112111
if [[ $(uname) == "Darwin" ]]; then
112+
MTIME=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "${TAR_TOP_DIR_NAME}/LICENSE")
113113
if ! command -v gtar &> /dev/null; then
114114
echo "[ERROR] GNU tar (gtar) is required. Please run: brew install gnu-tar"
115115
exit 1
116116
fi
117117
TAR_CMD=gtar
118118
else
119+
MTIME=$(date -d "$(stat -c %y "${TAR_TOP_DIR_NAME}/LICENSE")" "+%Y-%m-%d %H:%M:%S")
119120
TAR_CMD=tar
120121
fi
121122

0 commit comments

Comments
 (0)