Skip to content

Commit

Permalink
GH-43199: [CI][Packaging] dev/release/utils-create-release-tarball.sh…
Browse files Browse the repository at this point in the history
… should not include the release candidate number in the name of the tarball's top-level directory. (#43200)

### Rationale for this change

`dev/release/util-create-release-tarball.sh` should not include the release candidate number in the name of the tarball's top-level directory. If the release candidate number is included, the binaries and the release verification tasks fail because the tarball entries have an unexpected folder hierarchy. See #43188 (comment). 

### What changes are included in this PR?

1. Modified `dev/release/util-create-release-tarball.sh` to not include the release candidate number in the name of the source directory from which the release tarball is created.

### Are these changes tested?

Manually verified this change fixes the bug:

```bash
$ dev/release/utils-create-release-tarball.sh 17.0.0 1
$ tar zxvf apache-arrow-17.0.0.tar.gz
...
$ ls 
apache-arrow-17.0.0/       apache-arrow-17.0.0.tar.gz
```

### Are there any user-facing changes?

No

* GitHub Issue: #43199

Authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
  • Loading branch information
sgilmore10 committed Jul 9, 2024
1 parent 8fc40fc commit 0c4d6c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions dev/release/02-source-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SourceTest < Test::Unit::TestCase
def setup
@current_commit = git_current_commit
detect_versions
@tag_name = "apache-arrow-#{@release_version}-rc0"
@tag_name_no_rc = "apache-arrow-#{@release_version}"
@archive_name = "apache-arrow-#{@release_version}.tar.gz"
@script = File.expand_path("dev/release/02-source.sh")
@tarball_script = File.expand_path("dev/release/utils-create-release-tarball.sh")
Expand Down Expand Up @@ -50,15 +50,15 @@ def source(*targets)

def test_symbolic_links
source
Dir.chdir(@tag_name) do
Dir.chdir(@tag_name_no_rc) do
assert_equal([],
Find.find(".").find_all {|path| File.symlink?(path)})
end
end

def test_csharp_git_commit_information
source
Dir.chdir("#{@tag_name}/csharp") do
Dir.chdir("#{@tag_name_no_rc}/csharp") do
FileUtils.mv("dummy.git", "../.git")
sh("dotnet", "pack", "-c", "Release")
FileUtils.mv("../.git", "dummy.git")
Expand All @@ -83,7 +83,7 @@ def test_csharp_git_commit_information

def test_python_version
source
Dir.chdir("#{@tag_name}/python") do
Dir.chdir("#{@tag_name_no_rc}/python") do
sh("python3", "setup.py", "sdist")
if on_release_branch?
pyarrow_source_archive = "dist/pyarrow-#{@release_version}.tar.gz"
Expand Down
19 changes: 10 additions & 9 deletions dev/release/utils-create-release-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,27 @@ version=$1
rc=$2

tag=apache-arrow-${version}-rc${rc}
root_folder=apache-arrow-${version}
tarball=apache-arrow-${version}.tar.gz

: ${release_hash:=$(git rev-list --max-count=1 ${tag})}

rm -rf ${tag}
rm -rf ${root_folder}

# be conservative and use the release hash, even though git produces the same
# archive (identical hashes) using the scm tag
(cd "${SOURCE_TOP_DIR}" && \
git archive ${release_hash} --prefix ${tag}/) | \
git archive ${release_hash} --prefix ${root_folder}/) | \
tar xf -

# Resolve symbolic and hard links
rm -rf ${tag}.tmp
mv ${tag} ${tag}.tmp
cp -R -L ${tag}.tmp ${tag}
rm -rf ${tag}.tmp
rm -rf ${root_folder}.tmp
mv ${root_folder} ${root_folder}.tmp
cp -R -L ${root_folder}.tmp ${root_folder}
rm -rf ${root_folder}.tmp

# Create a dummy .git/ directory to download the source files from GitHub with Source Link in C#.
dummy_git=${tag}/csharp/dummy.git
dummy_git=${root_folder}/csharp/dummy.git
mkdir ${dummy_git}
pushd ${dummy_git}
echo ${release_hash} > HEAD
Expand All @@ -58,5 +59,5 @@ mkdir objects refs
popd

# Create new tarball from modified source directory
tar czf ${tarball} ${tag}
rm -rf ${tag}
tar czf ${tarball} ${root_folder}
rm -rf ${root_folder}

0 comments on commit 0c4d6c7

Please sign in to comment.