Apache DataFusion SQL Query Engine
ARROW-6997: [Packaging][RPM] Add apache-arrow-release
Sutou Kouhei5daef84a3096
diff --git a/dev/tasks/linux-packages/Rakefile b/dev/tasks/linux-packages/Rakefileindex f169c9de4f..71d953f477 100644--- a/dev/tasks/linux-packages/Rakefile+++ b/dev/tasks/linux-packages/Rakefile@@ -20,6 +20,7 @@packages = ["apache-arrow","apache-arrow-archive-keyring",+ "apache-arrow-release",]namespace :apt dodiff --git a/dev/tasks/linux-packages/apache-arrow-release/Rakefile b/dev/tasks/linux-packages/apache-arrow-release/Rakefilenew file mode 100644index 0000000000..ac0d877e3a--- /dev/null+++ b/dev/tasks/linux-packages/apache-arrow-release/Rakefile@@ -0,0 +1,71 @@+# -*- ruby -*-+#+# 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_relative "../helper"+require_relative "../package-task"++class ApacheArrowReleasePackageTask < PackageTask+ include Helper::ApacheArrow++ def initialize+ release_time = detect_release_time+ super("apache-arrow-release",+ detect_version(release_time),+ release_time,+ :rc_build_type => :release)+ end++ private+ def repo_path+ "#{yum_dir}/Apache-Arrow.repo"+ end++ def define_archive_task+ file @archive_name => [repo_path] do+ rm_rf(@archive_base_name)+ mkdir(@archive_base_name)+ download("https://dist.apache.org/repos/dist/dev/arrow/KEYS",+ "#{@archive_base_name}/KEYS")+ cp(repo_path, @archive_base_name)+ sh("tar", "czf", @archive_name, @archive_base_name)+ rm_rf(@archive_base_name)+ end++ if rpm_archive_name != @archive_name+ file rpm_archive_name => @archive_name do+ cp(@archive_name, rpm_archive_name)+ end+ end+ end++ def enable_apt?+ false+ end++ def yum_targets_default+ [+ "centos-6",+ "centos-7",+ "centos-8",+ ]+ end+end++task = ApacheArrowReleasePackageTask.new+task.definediff --git a/dev/tasks/linux-packages/apache-arrow-release/yum/Apache-Arrow.repo b/dev/tasks/linux-packages/apache-arrow-release/yum/Apache-Arrow.reponew file mode 100644index 0000000000..16a6d742fb--- /dev/null+++ b/dev/tasks/linux-packages/apache-arrow-release/yum/Apache-Arrow.repo@@ -0,0 +1,37 @@+# 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.++[apache-arrow-amazon-linux]+name=Apache Arrow for Amazon Linux 2 - $basearch+baseurl=https://apache.bintray.com/arrow/centos/7/$basearch/+gpgcheck=1+enabled=1+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow++[apache-arrow-centos]+name=Apache Arrow for CentOS $releasever - $basearch+baseurl=https://apache.bintray.com/arrow/centos/$releasever/$basearch/+gpgcheck=1+enabled=1+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow++[apache-arrow-rhel]+name=Apache Arrow for RHEL $releasever - $basearch+baseurl=https://apache.bintray.com/arrow/centos/$releasever/$basearch/+gpgcheck=1+enabled=1+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrowdiff --git a/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in b/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.innew file mode 100644index 0000000000..ee0be55b52--- /dev/null+++ b/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in@@ -0,0 +1,96 @@+# -*- rpm -*-+#+# 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.++%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:8}++%define use_dnf (%{_centos_ver} >= 8)+%if %{use_dnf}+%define yum_repository_enable() (dnf config-manager --set-enabled %1)+%define yum_repository_disable() (dnf config-manager --set-disabled %1)+%else+%define yum_repository_enable() (yum-config-manager --enable %1)+%define yum_repository_disable() (yum-config-manager --disable %1)+%endif++Name: @PACKAGE@+Version: @VERSION@+Release: @RELEASE@%{?dist}+Summary: Apache Arrow release files++License: Apache-2.0+URL: https://arrow.apache.org/+Source0: @PACKAGE@-%{version}.tar.gz++BuildArch: noarch++Requires: epel-release+%if %{use_dnf}+Requires: dnf-command(config-manager)+%else+Requires: yum-utils+%endif++%description+Apache Arrow release files.++%prep+%setup -q++%build+# We use distribution version explicitly because we can't use symbolic link+# on Bintray. CentOS uses 6, 7 and 8 but RHEL uses 6Server, 7Server and 8Server+# for $releasever. If we can use symbolic link on Bintray, we can use+# $releasever directly.+distribution_version=$(cut -d: -f5 /etc/system-release-cpe)+sed -i'' -e "s/\\\$releasever/${distribution_version}/g" Apache-Arrow.repo++%install+rm -rf $RPM_BUILD_ROOT++%{__install} -Dp -m0644 KEYS \+ $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow++%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d/+%{__install} -Dp -m0644 Apache-Arrow.repo \+ $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d/Apache-Arrow.repo++%files+%defattr(-, root, root, 0755)+%doc+%dir %{_sysconfdir}/yum.repos.d/+%dir %{_sysconfdir}/pki/rpm-gpg/+%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow+%config(noreplace) %{_sysconfdir}/yum.repos.d/Apache-Arrow.repo++%post+if grep -q 'Amazon Linux release 2' /etc/system-release 2>/dev/null; then+ %{yum_repository_enable apache-arrow-amazon-linux}+ %{yum_repository_disable apache-arrow-centos}+ %{yum_repository_disable apache-arrow-rhel}+elif grep -q 'Red Hat Enterprise Linux' /etc/system-release 2>/dev/null; then+ %{yum_repository_disable apache-arrow-amazon-linux}+ %{yum_repository_disable apache-arrow-centos}+ %{yum_repository_enable apache-arrow-rhel}+else+ %{yum_repository_disable apache-arrow-amazon-linux}+ %{yum_repository_enable apache-arrow-centos}+ %{yum_repository_disable apache-arrow-rhel}+fi++%changelogdiff --git a/dev/tasks/linux-packages/apache-arrow-release/yum/centos-6/Dockerfile b/dev/tasks/linux-packages/apache-arrow-release/yum/centos-6/Dockerfilenew file mode 100644index 0000000000..2c0dd05991--- /dev/null+++ b/dev/tasks/linux-packages/apache-arrow-release/yum/centos-6/Dockerfile@@ -0,0 +1,28 @@+# 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.++FROM centos:6++ARG DEBUG++RUN \+ quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \+ yum install -y ${quiet} epel-release && \+ yum install -y ${quiet} \+ rpm-build \+ rpmdevtools && \+ yum clean ${quiet} alldiff --git a/dev/tasks/linux-packages/apache-arrow-release/yum/centos-7/Dockerfile b/dev/tasks/linux-packages/apache-arrow-release/yum/centos-7/Dockerfilenew file mode 100644index 0000000000..0396593d7d--- /dev/null+++ b/dev/tasks/linux-packages/apache-arrow-release/yum/centos-7/Dockerfile@@ -0,0 +1,28 @@+# 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.++FROM centos:7++ARG DEBUG++RUN \+ quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \+ yum install -y ${quiet} epel-release && \+ yum install -y ${quiet} \+ rpm-build \+ rpmdevtools && \+ yum clean ${quiet} alldiff --git a/dev/tasks/linux-packages/apache-arrow-release/yum/centos-8/Dockerfile b/dev/tasks/linux-packages/apache-arrow-release/yum/centos-8/Dockerfilenew file mode 100644index 0000000000..8d929ad754--- /dev/null+++ b/dev/tasks/linux-packages/apache-arrow-release/yum/centos-8/Dockerfile@@ -0,0 +1,28 @@+# 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.++FROM centos:8++ARG DEBUG++RUN \+ quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \+ dnf install -y ${quiet} epel-release && \+ dnf install --enablerepo=PowerTools -y ${quiet} \+ rpm-build \+ rpmdevtools && \+ dnf clean ${quiet} alldiff --git a/dev/tasks/linux-packages/apache-arrow/yum/centos-6/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/centos-6/Dockerfileindex a19afe796e..08e6f156ed 100644--- a/dev/tasks/linux-packages/apache-arrow/yum/centos-6/Dockerfile+++ b/dev/tasks/linux-packages/apache-arrow/yum/centos-6/Dockerfile@@ -20,8 +20,9 @@ FROM centos:6ARG DEBUGENV \- SRPM_DOWNLOAD_URL=http://vault.centos.org/7.6.1810/os/Source/SPackages \- LIBARCHIVE_SRPM_BASE=libarchive-3.1.2-10.el7_2.src.rpm+ DEVTOOLSET_VERSION=6 \+ LIBARCHIVE_SRPM_BASE=libarchive-3.1.2-10.el7_2.src.rpm \+ SRPM_DOWNLOAD_URL=http://vault.centos.org/7.6.1810/os/Source/SPackagesRUN \quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \@@ -47,7 +48,7 @@ RUN \yum install -y ${quiet} \cmake3 \bzip2-devel \- devtoolset-6 \+ devtoolset-${DEVTOOLSET_VERSION} \gflags-devel \git \gobject-introspection-devel \diff --git a/dev/tasks/linux-packages/apt/build.sh b/dev/tasks/linux-packages/apt/build.shindex a6a1cc4ce1..7872c35749 100755--- a/dev/tasks/linux-packages/apt/build.sh+++ b/dev/tasks/linux-packages/apt/build.sh@@ -20,6 +20,8 @@LANG=C+set -u+run(){"$@"diff --git a/dev/tasks/linux-packages/package-task.rb b/dev/tasks/linux-packages/package-task.rbindex 199af54694..b8b2834470 100644--- a/dev/tasks/linux-packages/package-task.rb+++ b/dev/tasks/linux-packages/package-task.rb@@ -148,10 +148,20 @@ class PackageTasktask :dist => [@archive_name]end+ def enable_apt?+ true+ end+def apt_targets+ return [] unless enable_apt?+targets = (ENV["APT_TARGETS"] || "").split(",")return targets unless targets.empty?+ apt_targets_default+ end++ def apt_targets_default# Disable arm64 targets by default for now# because they require some setups on host.[@@ -172,9 +182,40 @@ class PackageTask"#{@package}-#{@deb_upstream_version}.tar.gz"end+ def apt_dir+ "apt"+ end++ def apt_build+ tmp_dir = "#{apt_dir}/tmp"+ rm_rf(tmp_dir)+ mkdir_p(tmp_dir)+ cp(deb_archive_name,+ File.join(tmp_dir, deb_archive_name))+ Dir.glob("debian*") do |debian_dir|+ cp_r(debian_dir, "#{tmp_dir}/#{debian_dir}")+ end++ env_sh = "#{apt_dir}/env.sh"+ File.open(env_sh, "w") do |file|+ file.puts(<<-ENV)+PACKAGE=#{@package}+VERSION=#{@deb_upstream_version}+ ENV+ end++ cd(apt_dir) do+ apt_targets.each do |target|+ next unless Dir.exist?(target)+ distribution, version, architecture = target.split("-", 3)+ os = "#{distribution}-#{version}"+ run_docker(os, architecture)+ end+ end+ end+def define_apt_tasknamespace :apt do- apt_dir = "apt"source_build_sh = "#{__dir__}/apt/build.sh"build_sh = "#{apt_dir}/build.sh"repositories_dir = "#{apt_dir}/repositories"@@ -186,32 +227,17 @@ class PackageTaskdirectory repositories_dirdesc "Build deb packages"- task :build => [deb_archive_name, build_sh, repositories_dir] do- tmp_dir = "#{apt_dir}/tmp"- rm_rf(tmp_dir)- mkdir_p(tmp_dir)- cp(deb_archive_name,- File.join(tmp_dir, deb_archive_name))- Dir.glob("debian*") do |debian_dir|- cp_r(debian_dir, "#{tmp_dir}/#{debian_dir}")- end-- env_sh = "#{apt_dir}/env.sh"- File.open(env_sh, "w") do |file|- file.puts(<<-ENV)-PACKAGE=#{@package}-VERSION=#{@deb_upstream_version}- ENV- end-- cd(apt_dir) do- apt_targets.each do |target|- next unless Dir.exist?(target)- distribution, version, architecture = target.split("-", 3)- os = "#{distribution}-#{version}"- run_docker(os, architecture)- end- end+ if enable_apt?+ build_dependencies = [+ deb_archive_name,+ build_sh,+ repositories_dir,+ ]+ else+ build_dependencies = []+ end+ task :build => build_dependencies do+ apt_build if enable_apt?endend@@ -232,6 +258,10 @@ VERSION=#{@deb_upstream_version}targets = (ENV["YUM_TARGETS"] || "").split(",")return targets unless targets.empty?+ yum_targets_default+ end++ def yum_targets_default# Disable aarch64 targets by default for now# because they require some setups on host.[@@ -244,7 +274,11 @@ VERSION=#{@deb_upstream_version}enddef rpm_archive_name- "#{@package}-#{@rpm_version}.tar.gz"+ "#{rpm_archive_base_name}.tar.gz"+ end++ def rpm_archive_base_name+ "#{@package}-#{@rpm_version}"enddef yum_dir@@ -268,6 +302,10 @@ VERSION=#{@deb_upstream_version}endend+ def yum_spec_in_path+ "#{yum_dir}/#{@rpm_package}.spec.in"+ end+def yum_buildtmp_dir = "#{yum_dir}/tmp"rm_rf(tmp_dir)@@ -286,8 +324,7 @@ RELEASE=#{@rpm_release}endspec = "#{tmp_dir}/#{@rpm_package}.spec"- spec_in = "#{yum_dir}/#{@rpm_package}.spec.in"- spec_in_data = File.read(spec_in)+ spec_in_data = File.read(yum_spec_in_path)spec_data = spec_in_data.gsub(/@(.+?)@/) do |matched|yum_expand_variable($1) || matchedend@@ -317,7 +354,12 @@ RELEASE=#{@rpm_release}desc "Build RPM packages"if enable_yum?- build_dependencies = [rpm_archive_name, yum_build_sh, repositories_dir]+ build_dependencies = [+ repositories_dir,+ rpm_archive_name,+ yum_build_sh,+ yum_spec_in_path,+ ]elsebuild_dependencies = []end@@ -380,6 +422,8 @@ RELEASE=#{@rpm_release}enddef update_debian_changelog+ return unless enable_apt?+Dir.glob("debian*") do |debian_dir|update_content("#{debian_dir}/changelog") do |content|<<-CHANGELOG.rstrip@@ -399,7 +443,7 @@ RELEASE=#{@rpm_release}return unless enable_yum?release_time = @release_time.strftime("%a %b %d %Y")- update_content("yum/#{@rpm_package}.spec.in") do |content|+ update_content(yum_spec_in_path) do |content|content = content.sub(/^(%changelog\n)/, <<-CHANGELOG)%changelog* #{release_time} #{packager_name} <#{packager_email}> - #{@rpm_version}-#{@rpm_release}diff --git a/dev/tasks/linux-packages/yum/build.sh b/dev/tasks/linux-packages/yum/build.shindex 1ada8782a4..3358b3064e 100755--- a/dev/tasks/linux-packages/yum/build.sh+++ b/dev/tasks/linux-packages/yum/build.sh@@ -18,6 +18,8 @@# specific language governing permissions and limitations# under the License.+set -u+run(){"$@"@@ -73,14 +75,17 @@ cdif [ -n "${SOURCE_ARCHIVE}" ]; thencase "${RELEASE}" in0.dev*)- run tar xf /host/tmp/${SOURCE_ARCHIVE}+ source_archive_base_name=$( \+ echo ${SOURCE_ARCHIVE} | sed -e 's/\.tar\.gz$//')+ run tar xf /host/tmp/${SOURCE_ARCHIVE} \+ --transform="s,^[^/]*,${PACKAGE},"run mv \- apache-${PACKAGE}-${VERSION}-$(echo $RELEASE | sed -e 's/^0\.//') \- apache-${PACKAGE}-${VERSION}+ ${PACKAGE} \+ ${source_archive_base_name}run tar czf \rpmbuild/SOURCES/${SOURCE_ARCHIVE} \- apache-${PACKAGE}-${VERSION}- run rm -rf apache-${PACKAGE}-${VERSION}+ ${source_archive_base_name}+ run rm -rf ${source_archive_base_name};;*)run cp /host/tmp/${SOURCE_ARCHIVE} rpmbuild/SOURCES/@@ -99,7 +104,7 @@ run cat <<BUILD > build.shrpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${PACKAGE}.specBUILDrun chmod +x build.sh-if [ "${distribution_version}" = 6 ]; then+if [ -n "${DEVTOOLSET_VERSION:-}" ]; thenrun cat <<WHICH_STRIP > which-strip.sh#!/bin/bash@@ -107,12 +112,12 @@ which stripWHICH_STRIPrun chmod +x which-strip.shrun cat <<USE_DEVTOOLSET_STRIP >> ~/.rpmmacros-%__strip $(run scl enable devtoolset-6 ./which-strip.sh)+%__strip $(run scl enable devtoolset-${DEVTOOLSET_VERSION} ./which-strip.sh)USE_DEVTOOLSET_STRIPif [ "${DEBUG:-no}" = "yes" ]; then- run scl enable devtoolset-6 ./build.sh+ run scl enable devtoolset-${DEVTOOLSET_VERSION} ./build.shelse- run scl enable devtoolset-6 ./build.sh > /dev/null+ run scl enable devtoolset-${DEVTOOLSET_VERSION} ./build.sh > /dev/nullfielseif [ "${DEBUG:-no}" = "yes" ]; thendiff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.ymlindex 8344c2b07f..c704a82a63 100644--- a/dev/tasks/tasks.yml+++ b/dev/tasks/tasks.yml@@ -1277,6 +1277,8 @@ tasks:upload_extensions:- .rpmartifacts:+ - apache-arrow-release-{no_rc_version}-1.el6.noarch.rpm+ - apache-arrow-release-{no_rc_version}-1.el6.src.rpm- arrow-{no_rc_version}-1.el6.src.rpm- arrow-debuginfo-{no_rc_version}-1.el6.[a-z0-9_]+.rpm- arrow-devel-{no_rc_version}-1.el6.[a-z0-9_]+.rpm@@ -1297,6 +1299,8 @@ tasks:upload_extensions:- .rpmartifacts:+ - apache-arrow-release-{no_rc_version}-1.el7.noarch.rpm+ - apache-arrow-release-{no_rc_version}-1.el7.src.rpm- arrow-{no_rc_version}-1.el7.src.rpm- arrow-debuginfo-{no_rc_version}-1.el7.[a-z0-9_]+.rpm- arrow-devel-{no_rc_version}-1.el7.[a-z0-9_]+.rpm@@ -1361,6 +1365,8 @@ tasks:upload_extensions:- .rpmartifacts:+ - apache-arrow-release-{no_rc_version}-1.el8.noarch.rpm+ - apache-arrow-release-{no_rc_version}-1.el8.src.rpm- arrow-{no_rc_version}-1.el8.src.rpm- arrow-dataset-devel-{no_rc_version}-1.el8.[a-z0-9_]+.rpm- arrow-dataset-libs-debuginfo-{no_rc_version}-1.el8.[a-z0-9_]+.rpm