Skip to content

Apache DataFusion SQL Query Engine

ARROW-5092: [C#] Create a dummy .git directory to download the source files from GitHub with Source Link

Yosuke Shirobc494ef171eb
diff --git a/ci/travis_release_test.sh b/ci/travis_release_test.sh
index eed8191506..4b541525fc 100755
--- a/ci/travis_release_test.sh
+++ b/ci/travis_release_test.sh
@@ -19,4 +19,14 @@
set -eux
+pip install cython
+pip install setuptools
+
+wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
+sudo dpkg -i packages-microsoft-prod.deb
+
+sudo apt-get install apt-transport-https
+sudo apt-get update
+sudo apt-get install dotnet-sdk-2.2
+
dev/release/run-test.rb
diff --git a/dev/release/00-prepare-test.rb b/dev/release/00-prepare-test.rb
index 8ce8ca1bfc..07e848bf67 100644
--- a/dev/release/00-prepare-test.rb
+++ b/dev/release/00-prepare-test.rb
@@ -17,21 +17,18 @@
class PrepareTest < Test::Unit::TestCase
include GitRunnable
+ include VersionDetectable
def setup
@current_commit = git_current_commit
+ detect_versions
+
top_dir = Pathname(__dir__).parent.parent
@original_git_repository = top_dir + ".git"
- cpp_cmake_lists = top_dir + "cpp" + "CMakeLists.txt"
- @snapshot_version = cpp_cmake_lists.read[/ARROW_VERSION "(.+?)"/, 1]
- r_description = top_dir + "r" + "DESCRIPTION"
- @previous_version = r_description.read[/^Version: (.+?)\.9000$/, 1]
Dir.mktmpdir do |dir|
@test_git_repository = Pathname(dir) + "arrow"
git("clone", @original_git_repository.to_s, @test_git_repository.to_s)
Dir.chdir(@test_git_repository) do
- @release_version = @snapshot_version.gsub(/-SNAPSHOT\z/, "")
- @next_version = @release_version.gsub(/\A\d+/) {|major| major.succ}
@tag_name = "apache-arrow-#{@release_version}"
@release_branch = "release-#{@release_version}-rc0"
@script = "dev/release/00-prepare.sh"
diff --git a/dev/release/02-source-test.rb b/dev/release/02-source-test.rb
new file mode 100644
index 0000000000..04daeea63e
--- /dev/null
+++ b/dev/release/02-source-test.rb
@@ -0,0 +1,103 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+require "rexml/document"
+
+class SourceTest < Test::Unit::TestCase
+ include GitRunnable
+ include VersionDetectable
+
+ def setup
+ @current_commit = git_current_commit
+ detect_versions
+ @tag_name = "apache-arrow-#{@release_version}"
+ @script = File.expand_path("dev/release/02-source.sh")
+
+ Dir.mktmpdir do |dir|
+ Dir.chdir(dir) do
+ yield
+ end
+ end
+ end
+
+ def source(*targets)
+ env = {
+ "SOURCE_DEFAULT" => "0",
+ "release_hash" => @current_commit,
+ }
+ targets.each do |target|
+ env["SOURCE_#{target}"] = "1"
+ end
+ sh(env, @script, @release_version, "0")
+ sh("tar", "xf", "#{@tag_name}.tar.gz")
+ end
+
+ def test_symbolic_links
+ source
+ Dir.chdir("#{@tag_name}") do
+ assert_equal([],
+ Find.find(".").find_all {|path| File.symlink?(path)})
+ end
+ end
+
+ def test_glib_configure
+ unless ENV["ARROW_TEST_SOURCE_GLIB"] == "yes"
+ omit("This takes a long time. " +
+ "Set ARROW_TEST_SOURCE_GLIB=yes environment variable to test this.")
+ end
+ source("GLIB")
+ Dir.chdir("#{@tag_name}/c_glib") do
+ assert_equal([
+ "configure",
+ "configure.ac",
+ ],
+ Dir.glob("configure*").sort)
+ end
+ end
+
+ def test_csharp_git_commit_information
+ source
+ Dir.chdir("#{@tag_name}/csharp") do
+ sh("dotnet", "pack", "-c", "Release")
+ Dir.chdir("artifacts/Apache.Arrow/Release") do
+ sh("unzip", "Apache.Arrow.#{@snapshot_version}.nupkg")
+ FileUtils.chmod(0400, "Apache.Arrow.nuspec")
+ nuspec = REXML::Document.new(File.read("Apache.Arrow.nuspec"))
+ nuspec_repository = nuspec.elements["package/metadata/repository"]
+ attributes = {}
+ nuspec_repository.attributes.each do |key, value|
+ attributes[key] = value
+ end
+ assert_equal({
+ "type" => "git",
+ "url" => "https://github.com/apache/arrow",
+ "commit" => @current_commit,
+ },
+ attributes)
+ end
+ end
+ end
+
+ def test_python_version
+ source
+ Dir.chdir("#{@tag_name}/python") do
+ sh("python3", "setup.py", "sdist")
+ assert_equal(["dist/pyarrow-#{@release_version}a0.tar.gz"],
+ Dir.glob("dist/pyarrow-*.tar.gz"))
+ end
+ end
+end
diff --git a/dev/release/02-source.sh b/dev/release/02-source.sh
index 6235bc37d2..1a34055f97 100755
--- a/dev/release/02-source.sh
+++ b/dev/release/02-source.sh
@@ -17,9 +17,16 @@
# specific language governing permissions and limitations
# under the License.
#
+
set -e
-SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+: ${SOURCE_DEFAULT:=1}
+: ${SOURCE_UPLOAD:=${SOURCE_DEFAULT}}
+: ${SOURCE_GLIB:=${SOURCE_DEFAULT}}
+: ${SOURCE_RAT:=${SOURCE_DEFAULT}}
+
+SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+SOURCE_TOP_DIR="$(cd "${SOURCE_DIR}/../../" && pwd)"
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <version> <rc-num>"
@@ -34,120 +41,139 @@ tagrc=${tag}-rc${rc}
echo "Preparing source for tag ${tag}"
-: ${release_hash:=`git rev-list $tag 2> /dev/null | head -n 1 `}
+: ${release_hash:=$(cd "${SOURCE_TOP_DIR}" && git rev-list --max-count=1 ${tag})}
-if [ -z "$release_hash" ]; then
- echo "Cannot continue: unknown git tag: $tag"
- exit
+if [ ${SOURCE_UPLOAD} -gt 0 ]; then
+ if [ -z "$release_hash" ]; then
+ echo "Cannot continue: unknown git tag: $tag"
+ exit
+ fi
fi
echo "Using commit $release_hash"
tarball=${tag}.tar.gz
-archive_name=tmp-apache-arrow
+rm -rf ${tag}
# be conservative and use the release hash, even though git produces the same
# archive (identical hashes) using the scm tag
-git archive ${release_hash} --prefix ${archive_name}/ > ${archive_name}.tar.gz
-
-dist_c_glib_tar_gz=c_glib.tar.gz
-docker_image_name=apache-arrow/release-source
-DEBUG=yes docker build -t ${docker_image_name} ${SOURCE_DIR}/source
-docker \
- run \
- --rm \
- --interactive \
- --volume "$PWD":/host \
- ${docker_image_name} \
- /build.sh ${archive_name} ${dist_c_glib_tar_gz}
+(cd "${SOURCE_TOP_DIR}" && \
+ git archive ${release_hash} --prefix ${tag}/) | \
+ tar xf -
# replace c_glib/ by tar.gz generated by "make dist"
-rm -rf ${tag}
-git archive $release_hash --prefix ${tag}/ | tar xf -
-rm -rf ${tag}/c_glib
-tar xf ${dist_c_glib_tar_gz} -C ${tag}
-rm -f ${dist_c_glib_tar_gz}
+if [ ${SOURCE_GLIB} -gt 0 ]; then
+ archive_name=tmp-apache-arrow
+ (cd "${SOURCE_TOP_DIR}" && \
+ git archive ${release_hash} --prefix ${archive_name}/) \
+ > ${archive_name}.tar
+ dist_c_glib_tar_gz=c_glib.tar.gz
+ docker_image_name=apache-arrow/release-source
+ DEBUG=yes docker build -t ${docker_image_name} "${SOURCE_DIR}/source"
+ docker \
+ run \
+ --rm \
+ --interactive \
+ --volume "$PWD":/host \
+ ${docker_image_name} \
+ /build.sh ${archive_name} ${dist_c_glib_tar_gz}
+ rm -f ${archive_name}.tar
+ rm -rf ${tag}/c_glib
+ tar xf ${dist_c_glib_tar_gz} -C ${tag}
+ rm -f ${dist_c_glib_tar_gz}
+fi
# Resolve all hard and symbolic links
rm -rf ${tag}.tmp
mv ${tag} ${tag}.tmp
-cp -r -L ${tag}.tmp ${tag}
+cp -R -L ${tag}.tmp ${tag}
rm -rf ${tag}.tmp
+# Create a dummy .git/ directory to download the source files from GitHub with Source Link in C#.
+mkdir ${tag}/.git && cd $_
+echo ${release_hash} > HEAD
+echo '[remote "origin"] url = https://github.com/apache/arrow.git' >> config
+mkdir objects refs
+cd -
+
# Create new tarball from modified source directory
tar czf ${tarball} ${tag}
rm -rf ${tag}
-${SOURCE_DIR}/run-rat.sh ${tarball}
-
-# sign the archive
-gpg --armor --output ${tarball}.asc --detach-sig ${tarball}
-shasum -a 256 $tarball > ${tarball}.sha256
-shasum -a 512 $tarball > ${tarball}.sha512
-
-# check out the arrow RC folder
-svn co --depth=empty https://dist.apache.org/repos/dist/dev/arrow tmp
-
-# add the release candidate for the tag
-mkdir -p tmp/${tagrc}
-
-# copy the rc tarball into the tmp dir
-cp ${tarball}* tmp/${tagrc}
-
-# commit to svn
-svn add tmp/${tagrc}
-svn ci -m "Apache Arrow ${version} RC${rc}" tmp/${tagrc}
-
-# clean up
-rm -rf tmp
-
-rc_url="https://dist.apache.org/repos/dist/dev/arrow/${tagrc}"
-echo "Success! The release candidate is available here:"
-echo " ${rc_url}"
-echo ""
-echo "Commit SHA1: ${release_hash}"
-echo ""
-echo "The following draft email has been created to send to the"
-echo "[email protected] mailing list"
-echo ""
-echo "---------------------------------------------------------"
-jira_url="https://issues.apache.org/jira"
-jql="project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20${version}"
-n_resolved_issues=$(curl "${jira_url}/rest/api/2/search/?jql=${jql}" | jq ".total")
-cat <<MAIL
-Subject: [VOTE] Release Apache Arrow ${version} - RC${rc}
-
-Hi,
-
-I would like to propose the following release candidate (RC${rc}) of Apache
-Arrow version ${version}. This is a release consiting of ${n_resolved_issues}
-resolved JIRA issues[1].
-
-This release candidate is based on commit:
-${release_hash} [2]
-
-The source release rc${rc} is hosted at [3].
-The binary artifacts are hosted at [4][5][6][7].
-The changelog is located at [8].
-
-Please download, verify checksums and signatures, run the unit tests,
-and vote on the release. See [9] for how to validate a release candidate.
-
-The vote will be open for at least 72 hours.
-
-[ ] +1 Release this as Apache Arrow ${version}
-[ ] +0
-[ ] -1 Do not release this as Apache Arrow ${version} because...
-
-[1]: ${jira_url}/issues/?jql=${jql}
-[2]: https://github.com/apache/arrow/tree/${release_hash}
-[3]: ${rc_url}
-[4]: https://bintray.com/apache/arrow/centos-rc/${version}-rc${rc}
-[5]: https://bintray.com/apache/arrow/debian-rc/${version}-rc${rc}
-[6]: https://bintray.com/apache/arrow/python-rc/${version}-rc${rc}
-[7]: https://bintray.com/apache/arrow/ubuntu-rc/${version}-rc${rc}
-[8]: https://github.com/apache/arrow/blob/${release_hash}/CHANGELOG.md
-[9]: https://cwiki.apache.org/confluence/display/ARROW/How+to+Verify+Release+Candidates
+if [ ${SOURCE_RAT} -gt 0 ]; then
+ "${SOURCE_DIR}/run-rat.sh" ${tarball}
+fi
+
+if [ ${SOURCE_UPLOAD} -gt 0 ]; then
+ # sign the archive
+ gpg --armor --output ${tarball}.asc --detach-sig ${tarball}
+ shasum -a 256 $tarball > ${tarball}.sha256
+ shasum -a 512 $tarball > ${tarball}.sha512
+
+ # check out the arrow RC folder
+ svn co --depth=empty https://dist.apache.org/repos/dist/dev/arrow tmp
+
+ # add the release candidate for the tag
+ mkdir -p tmp/${tagrc}
+
+ # copy the rc tarball into the tmp dir
+ cp ${tarball}* tmp/${tagrc}
+
+ # commit to svn
+ svn add tmp/${tagrc}
+ svn ci -m "Apache Arrow ${version} RC${rc}" tmp/${tagrc}
+
+ # clean up
+ rm -rf tmp
+
+ rc_url="https://dist.apache.org/repos/dist/dev/arrow/${tagrc}"
+ echo "Success! The release candidate is available here:"
+ echo " ${rc_url}"
+ echo ""
+ echo "Commit SHA1: ${release_hash}"
+ echo ""
+ echo "The following draft email has been created to send to the"
+ echo "[email protected] mailing list"
+ echo ""
+ echo "---------------------------------------------------------"
+ # jira_url="https://issues.apache.org/jira"
+ jql="project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20${version}"
+ n_resolved_issues=$(curl "${jira_url}/rest/api/2/search/?jql=${jql}" | jq ".total")
+ cat <<MAIL
+ Subject: [VOTE] Release Apache Arrow ${version} - RC${rc}
+
+ Hi,
+
+ I would like to propose the following release candidate (RC${rc}) of Apache
+ Arrow version ${version}. This is a release consiting of ${n_resolved_issues}
+ resolved JIRA issues[1].
+
+ This release candidate is based on commit:
+ ${release_hash} [2]
+
+ The source release rc${rc} is hosted at [3].
+ The binary artifacts are hosted at [4][5][6][7].
+ The changelog is located at [8].
+
+ Please download, verify checksums and signatures, run the unit tests,
+ and vote on the release. See [9] for how to validate a release candidate.
+
+ The vote will be open for at least 72 hours.
+
+ [ ] +1 Release this as Apache Arrow ${version}
+ [ ] +0
+ [ ] -1 Do not release this as Apache Arrow ${version} because...
+
+ [1]: ${jira_url}/issues/?jql=${jql}
+ [2]: https://github.com/apache/arrow/tree/${release_hash}
+ [3]: ${rc_url}
+ [4]: https://bintray.com/apache/arrow/centos-rc/${version}-rc${rc}
+ [5]: https://bintray.com/apache/arrow/debian-rc/${version}-rc${rc}
+ [6]: https://bintray.com/apache/arrow/python-rc/${version}-rc${rc}
+ [7]: https://bintray.com/apache/arrow/ubuntu-rc/${version}-rc${rc}
+ [8]: https://github.com/apache/arrow/blob/${release_hash}/CHANGELOG.md
+ [9]: https://cwiki.apache.org/confluence/display/ARROW/How+to+Verify+Release+Candidates
MAIL
-echo "---------------------------------------------------------"
+ echo "---------------------------------------------------------"
+fi
diff --git a/dev/release/source/build.sh b/dev/release/source/build.sh
index 25775fdc3e..20c972466b 100755
--- a/dev/release/source/build.sh
+++ b/dev/release/source/build.sh
@@ -22,7 +22,7 @@ set -e
archive_name=$1
dist_c_glib_tar_gz=$2
-tar xf /host/${archive_name}.tar.gz
+tar xf /host/${archive_name}.tar
# build Apache Arrow C++ before building Apache Arrow GLib because
# Apache Arrow GLib requires Apache Arrow C++.
diff --git a/dev/release/test-helper.rb b/dev/release/test-helper.rb
index 74cce3fb08..1dad54390c 100644
--- a/dev/release/test-helper.rb
+++ b/dev/release/test-helper.rb
@@ -16,6 +16,7 @@
# under the License.
require "English"
+require "find"
require "tempfile"
require "tmpdir"
@@ -64,3 +65,15 @@ module GitRunnable
git("tags").lines(chomp: true)
end
end
+
+module VersionDetectable
+ def detect_versions
+ top_dir = Pathname(__dir__).parent.parent
+ cpp_cmake_lists = top_dir + "cpp" + "CMakeLists.txt"
+ @snapshot_version = cpp_cmake_lists.read[/ARROW_VERSION "(.+?)"/, 1]
+ @release_version = @snapshot_version.gsub(/-SNAPSHOT\z/, "")
+ @next_version = @release_version.gsub(/\A\d+/) {|major| major.succ}
+ r_description = top_dir + "r" + "DESCRIPTION"
+ @previous_version = r_description.read[/^Version: (.+?)\.9000$/, 1]
+ end
+end