This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch maint-21.0.0
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/maint-21.0.0 by this push:
new ddbc3dc005 GH-47074: [Release] Use reproducible mtime for csharp/ in
source archive (#47076)
ddbc3dc005 is described below
commit ddbc3dc005dfdde5a79d42cb5953190479b12b73
Author: Sutou Kouhei <[email protected]>
AuthorDate: Fri Jul 11 15:49:10 2025 +0900
GH-47074: [Release] Use reproducible mtime for csharp/ in source archive
(#47076)
### Rationale for this change
The current source archive creation is reproducible when we use the same
Git working tree.
But it's not reproducible when we use different Git working trees.
### What changes are included in this PR?
Use the committer date of the target commit instead of the `charp/` mtime
in the current Git working tree for `csharp/` in the source archive.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* GitHub Issue: #47074
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
dev/release/utils-create-release-tarball.sh | 28 +++++++++++++---------------
dev/release/verify-release-candidate.sh | 2 +-
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/dev/release/utils-create-release-tarball.sh
b/dev/release/utils-create-release-tarball.sh
index 2caf59a264..af6a02b571 100755
--- a/dev/release/utils-create-release-tarball.sh
+++ b/dev/release/utils-create-release-tarball.sh
@@ -62,28 +62,26 @@ rm -rf ${root_folder}.tmp
# * https://github.com/apache/arrow/pull/4488
#
# We need to set constant timestamp for a dummy .git/ directory for
-# Reproducible Builds. We use mtime of csharp/ for it. If
-# SOURCE_DATE_EPOCH is defined, this mtime is overwritten when tar
-# file is created.
-if stat --help > /dev/null 2>&1; then
- # GNU stat
- #
- # touch accepts YYYYMMDDhhmm.ss format but GNU stat doesn't support
- # for outputting with the format. So we use date for it.
- csharp_mtime=$(date --date="$(stat --format="%y" csharp)" +%Y%m%d%H%M.%S)
-else
- # BSD stat
- csharp_mtime=$(stat -f %Sm -t %Y%m%d%H%M.%S csharp)
-fi
+# Reproducible Builds. We use committer date of the target commit hash
+# for it. If SOURCE_DATE_EPOCH is defined, this mtime is overwritten
+# when tar file is created.
+csharp_mtime=$(TZ=UTC \
+ git \
+ -C "${SOURCE_TOP_DIR}" \
+ log \
+ --format=%cd \
+ --date=format:%Y%m%d%H%M.%S \
+ -n1 \
+ "${release_hash}")
dummy_git=${root_folder}/csharp/dummy.git
mkdir ${dummy_git}
pushd ${dummy_git}
echo ${release_hash} > HEAD
echo "[remote \"origin\"] url =
https://github.com/${GITHUB_REPOSITORY:-apache/arrow}.git" >> config
mkdir objects refs
-find . -exec touch -t "${csharp_mtime}" '{}' ';'
+TZ=UTC find . -exec touch -t "${csharp_mtime}" '{}' ';'
popd
-touch -t "${csharp_mtime}" ${root_folder}/csharp
+TZ=UTC touch -t "${csharp_mtime}" ${root_folder}/csharp
# Create new tarball from modified source directory.
#
diff --git a/dev/release/verify-release-candidate.sh
b/dev/release/verify-release-candidate.sh
index 28e4ed247d..d114975f74 100755
--- a/dev/release/verify-release-candidate.sh
+++ b/dev/release/verify-release-candidate.sh
@@ -791,7 +791,7 @@ ensure_source_directory() {
fetch_archive ${dist_name}
git clone https://github.com/${GITHUB_REPOSITORY}.git arrow
pushd arrow
- dev/release/utils-create-release-tarball.sh ${VERSION} ${RC_NUMBER}
+ "${SOURCE_DIR}/utils-create-release-tarball.sh" ${VERSION} ${RC_NUMBER}
if ! cmp ${dist_name}.tar.gz ../${dist_name}.tar.gz; then
echo "Source archive isn't reproducible"
return 1