1#!/bin/bash 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20 21set -e 22 23: ${SOURCE_DEFAULT:=1} 24: ${SOURCE_GLIB:=${SOURCE_DEFAULT}} 25: ${SOURCE_RAT:=${SOURCE_DEFAULT}} 26: ${SOURCE_UPLOAD:=${SOURCE_DEFAULT}} 27: ${SOURCE_VOTE:=${SOURCE_DEFAULT}} 28 29SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 30SOURCE_TOP_DIR="$(cd "${SOURCE_DIR}/../../" && pwd)" 31 32if [ "$#" -ne 2 ]; then 33 echo "Usage: $0 <version> <rc-num>" 34 exit 35fi 36 37version=$1 38rc=$2 39 40tag=apache-arrow-${version} 41tagrc=${tag}-rc${rc} 42rc_url="https://dist.apache.org/repos/dist/dev/arrow/${tagrc}" 43 44echo "Preparing source for tag ${tag}" 45 46: ${release_hash:=$(cd "${SOURCE_TOP_DIR}" && git rev-list --max-count=1 ${tag})} 47 48if [ ${SOURCE_UPLOAD} -gt 0 ]; then 49 if [ -z "$release_hash" ]; then 50 echo "Cannot continue: unknown git tag: $tag" 51 exit 52 fi 53fi 54 55echo "Using commit $release_hash" 56 57tarball=${tag}.tar.gz 58 59rm -rf ${tag} 60# be conservative and use the release hash, even though git produces the same 61# archive (identical hashes) using the scm tag 62(cd "${SOURCE_TOP_DIR}" && \ 63 git archive ${release_hash} --prefix ${tag}/) | \ 64 tar xf - 65 66# Replace c_glib/ after running c_glib/autogen.sh to create c_gilb/ source archive containing the configure script 67if [ ${SOURCE_GLIB} -gt 0 ]; then 68 archive_name=tmp-apache-arrow 69 (cd "${SOURCE_TOP_DIR}" && \ 70 git archive ${release_hash} --prefix ${archive_name}/) \ 71 > "${SOURCE_TOP_DIR}/${archive_name}.tar" 72 c_glib_including_configure_tar_gz=c_glib.tar.gz 73 docker build -t arrow-release-source "${SOURCE_TOP_DIR}/dev/release/source" 74 docker run \ 75 -v "${SOURCE_TOP_DIR}":/arrow:delegated \ 76 arrow-release-source \ 77 /arrow/dev/release/source/build.sh ${archive_name} ${c_glib_including_configure_tar_gz} 78 rm -f "${SOURCE_TOP_DIR}/${archive_name}.tar" 79 rm -rf ${tag}/c_glib 80 tar xf "${SOURCE_TOP_DIR}/${c_glib_including_configure_tar_gz}" -C ${tag} 81 rm -f "${SOURCE_TOP_DIR}/${c_glib_including_configure_tar_gz}" 82fi 83 84# Resolve all hard and symbolic links 85rm -rf ${tag}.tmp 86mv ${tag} ${tag}.tmp 87cp -R -L ${tag}.tmp ${tag} 88rm -rf ${tag}.tmp 89 90# Create a dummy .git/ directory to download the source files from GitHub with Source Link in C#. 91dummy_git=${tag}/csharp/dummy.git 92mkdir ${dummy_git} 93pushd ${dummy_git} 94echo ${release_hash} > HEAD 95echo '[remote "origin"] url = https://github.com/apache/arrow.git' >> config 96mkdir objects refs 97popd 98 99# Create new tarball from modified source directory 100tar czf ${tarball} ${tag} 101rm -rf ${tag} 102 103if [ ${SOURCE_RAT} -gt 0 ]; then 104 "${SOURCE_DIR}/run-rat.sh" ${tarball} 105fi 106 107if [ ${SOURCE_UPLOAD} -gt 0 ]; then 108 # sign the archive 109 gpg --armor --output ${tarball}.asc --detach-sig ${tarball} 110 shasum -a 256 $tarball > ${tarball}.sha256 111 shasum -a 512 $tarball > ${tarball}.sha512 112 113 # check out the arrow RC folder 114 svn co --depth=empty https://dist.apache.org/repos/dist/dev/arrow tmp 115 116 # add the release candidate for the tag 117 mkdir -p tmp/${tagrc} 118 119 # copy the rc tarball into the tmp dir 120 cp ${tarball}* tmp/${tagrc} 121 122 # commit to svn 123 svn add tmp/${tagrc} 124 svn ci -m "Apache Arrow ${version} RC${rc}" tmp/${tagrc} 125 126 # clean up 127 rm -rf tmp 128 129 echo "Success! The release candidate is available here:" 130 echo " ${rc_url}" 131 echo "" 132 echo "Commit SHA1: ${release_hash}" 133 echo "" 134fi 135 136if [ ${SOURCE_VOTE} -gt 0 ]; then 137 echo "The following draft email has been created to send to the" 138 echo "dev@arrow.apache.org mailing list" 139 echo "" 140 echo "---------------------------------------------------------" 141 jira_url="https://issues.apache.org/jira" 142 jql="project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20${version}" 143 n_resolved_issues=$(curl "${jira_url}/rest/api/2/search/?jql=${jql}" | jq ".total") 144 cat <<MAIL 145To: dev@arrow.apache.org 146Subject: [VOTE] Release Apache Arrow ${version} - RC${rc} 147 148Hi, 149 150I would like to propose the following release candidate (RC${rc}) of Apache 151Arrow version ${version}. This is a release consisting of ${n_resolved_issues} 152resolved JIRA issues[1]. 153 154This release candidate is based on commit: 155${release_hash} [2] 156 157The source release rc${rc} is hosted at [3]. 158The binary artifacts are hosted at [4][5][6][7]. 159The changelog is located at [8]. 160 161Please download, verify checksums and signatures, run the unit tests, 162and vote on the release. See [9] for how to validate a release candidate. 163 164The vote will be open for at least 72 hours. 165 166[ ] +1 Release this as Apache Arrow ${version} 167[ ] +0 168[ ] -1 Do not release this as Apache Arrow ${version} because... 169 170[1]: ${jira_url}/issues/?jql=${jql} 171[2]: https://github.com/apache/arrow/tree/${release_hash} 172[3]: ${rc_url} 173[4]: https://bintray.com/apache/arrow/centos-rc/${version}-rc${rc} 174[5]: https://bintray.com/apache/arrow/debian-rc/${version}-rc${rc} 175[6]: https://bintray.com/apache/arrow/python-rc/${version}-rc${rc} 176[7]: https://bintray.com/apache/arrow/ubuntu-rc/${version}-rc${rc} 177[8]: https://github.com/apache/arrow/blob/${release_hash}/CHANGELOG.md 178[9]: https://cwiki.apache.org/confluence/display/ARROW/How+to+Verify+Release+Candidates 179MAIL 180 echo "---------------------------------------------------------" 181fi 182