Apache DataFusion SQL Query Engine
ARROW-3067: [Packaging] Support dev/rc/release .deb/.rpm builds
Kouhei Sutou41a653c94fba
diff --git a/dev/tasks/linux-packages/Rakefile b/dev/tasks/linux-packages/Rakefileindex bce23de2ff..d24aa11cb8 100644--- a/dev/tasks/linux-packages/Rakefile+++ b/dev/tasks/linux-packages/Rakefile@@ -21,35 +21,45 @@ require_relative "package-task"class ApacheArrowPackageTask < PackageTaskdef initialize- release_time = latest_commit_time(arrow_source_dir)+ release_time = detect_release_timesuper("apache-arrow", detect_version(release_time), release_time)@rpm_package = "arrow"endprivate+ def detect_release_time+ release_time_env = ENV["ARROW_RELEASE_TIME"]+ if release_time_env+ Time.parse(release_time_env).utc+ else+ latest_commit_time(arrow_source_dir) || Time.now.utc+ end+ end+def arrow_source_dirFile.join(File.dirname(__FILE__), "..", "..", "..")enddef detect_version(release_time)+ version_env = ENV['ARROW_VERSION']+ return version_env if version_env+pom_xml_path = File.join(arrow_source_dir, "java", "pom.xml")version = File.read(pom_xml_path).scan(/^ <version>(.+?)<\/version>/)[0][0]- version = ENV['ARROW_VERSION'] || version #try to read from envformatted_release_time = release_time.strftime("%Y%m%d")- version.gsub(/-SNAPSHOT\z/) {".#{formatted_release_time}"}+ version.gsub(/-SNAPSHOT\z/) {"-dev#{formatted_release_time}"}enddef define_archive_taskfile @archive_name do- # case @version- # when /\A\d+\.\d+\.\d+-rc\d+\z/- # download_rc_archive- # when /\A\d+\.\d+\.\d+\z/- # download_released_archive- # else- # build_archive- # end- build_archive+ case @version+ when /\A\d+\.\d+\.\d+-rc\d+\z/+ download_rc_archive+ when /\A\d+\.\d+\.\d+\z/+ download_released_archive+ else+ build_archive+ endendend@@ -74,48 +84,7 @@ class ApacheArrowPackageTask < PackageTaskcd(arrow_source_dir) dosh("git", "archive", "HEAD","--prefix", "#{@archive_base_name}/",- "--output", @archive_name)- rm_f(@archive_base_name)- sh("tar", "xf", @archive_name)- rm_f(@archive_name)-- c_glib_tmp_dir = "c_glib_tmp"- rm_rf(c_glib_tmp_dir)- mkdir_p(c_glib_tmp_dir)- cp_r(@archive_base_name, c_glib_tmp_dir)- c_glib_dir = File.expand_path("#{@archive_base_name}/c_glib")- rm_rf(c_glib_dir)- cd("#{c_glib_tmp_dir}/#{@archive_base_name}") do- build_type = "debug"- cpp_dir = File.expand_path("cpp")- cpp_build_dir = File.expand_path("cpp_build")- mkdir_p(cpp_build_dir)- cd(cpp_build_dir) do- sh("cmake", cpp_dir,- "-DCMAKE_BUILD_TYPE=#{build_type}",- "-DARROW_BOOST_USE_SHARED=ON",- "-DARROW_BUILD_TESTS=OFF")- sh("make", "-j8")- end- cd("c_glib") do- sh("./autogen.sh")- sh("./configure",- "--with-arrow-cpp-build-dir=#{cpp_build_dir}",- "--with-arrow-cpp-build-type=#{build_type}",- "--enable-gtk-doc")- sh({"LD_LIBRARY_PATH" => "#{cpp_build_dir}/#{build_type}"},- "make", "-j8")- sh("make", "dist")- tar_gz = Dir.glob("*.tar.gz").first- sh("tar", "xf", tar_gz)- mv(File.basename(tar_gz, ".tar.gz"),- c_glib_dir)- end- end- rm_rf(c_glib_tmp_dir)-- sh("tar", "czf", @full_archive_name, @archive_base_name)- rm_rf(@archive_base_name)+ "--output", @full_archive_name)endendenddiff --git a/dev/tasks/linux-packages/apt/build.sh b/dev/tasks/linux-packages/apt/build.shindex 2e44775f0f..b4a3fd6924 100755--- a/dev/tasks/linux-packages/apt/build.sh+++ b/dev/tasks/linux-packages/apt/build.sh@@ -49,9 +49,13 @@ run cp /host/tmp/${PACKAGE}-${VERSION}.tar.gz \run cd buildrun tar xfz ${PACKAGE}_${VERSION}.orig.tar.gzcase "${VERSION}" in+ *~dev*)+ run mv ${PACKAGE}-$(echo $VERSION | sed -e 's/~dev/-dev/') \+ ${PACKAGE}-${VERSION}+ ;;*~rc*)- mv ${PACKAGE}-$(echo $VERSION | sed -r -e 's/~rc[0-9]+//') \- ${PACKAGE}-${VERSION}+ run mv ${PACKAGE}-$(echo $VERSION | sed -r -e 's/~rc[0-9]+//') \+ ${PACKAGE}-${VERSION};;esacrun cd ${PACKAGE}-${VERSION}/diff --git a/dev/tasks/linux-packages/apt/ubuntu-trusty/Dockerfile b/dev/tasks/linux-packages/apt/ubuntu-trusty/Dockerfileindex dcb343b020..1273287910 100644--- a/dev/tasks/linux-packages/apt/ubuntu-trusty/Dockerfile+++ b/dev/tasks/linux-packages/apt/ubuntu-trusty/Dockerfile@@ -25,10 +25,12 @@ RUN \quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \apt update ${quiet} && \apt install -y -V ${quiet} \+ autoconf-archive \build-essential \cmake3 \debhelper\devscripts \+ dh-autoreconf \git \gtk-doc-tools \libboost-filesystem-dev \diff --git a/dev/tasks/linux-packages/debian.ubuntu-trusty/control b/dev/tasks/linux-packages/debian.ubuntu-trusty/controlindex 298b3c76c6..6dfceacbf1 100644--- a/dev/tasks/linux-packages/debian.ubuntu-trusty/control+++ b/dev/tasks/linux-packages/debian.ubuntu-trusty/control@@ -4,6 +4,7 @@ Priority: optionalMaintainer: Kouhei Sutou <[email protected]>Build-Depends:debhelper (>= 9),+ dh-autoreconf,pkg-config,cmake,git,diff --git a/dev/tasks/linux-packages/debian.ubuntu-trusty/rules b/dev/tasks/linux-packages/debian.ubuntu-trusty/rulesindex 5021f36704..5dc873f398 100755--- a/dev/tasks/linux-packages/debian.ubuntu-trusty/rules+++ b/dev/tasks/linux-packages/debian.ubuntu-trusty/rules@@ -11,7 +11,10 @@ export DEB_BUILD_MAINT_OPTIONS=reproducible=-timelessBUILD_TYPE=release%:- dh $@ --with gir+ dh $@ --with gir,autoreconf++override_dh_autoreconf:+ cd c_glib && ./autogen.shoverride_dh_auto_configure:dh_auto_configure \diff --git a/dev/tasks/linux-packages/package-task.rb b/dev/tasks/linux-packages/package-task.rbindex b8f25ae447..cc32db4536 100644--- a/dev/tasks/linux-packages/package-task.rb+++ b/dev/tasks/linux-packages/package-task.rb@@ -33,12 +33,12 @@ class PackageTask@rpm_package = @packagecase @version- when /-(rc\d+)\z/+ when /-((?:dev|rc)\d+)\z/base_version = $PREMATCH- rc = $1- @deb_upstream_version = "#{base_version}~#{rc}"+ sub_version = $1+ @deb_upstream_version = "#{base_version}~#{sub_version}"@rpm_version = base_version- @rpm_release = "0.#{rc}"+ @rpm_release = "0.#{sub_version}"else@deb_upstream_version = @version@rpm_version = @version@@ -69,7 +69,15 @@ class PackageTaskENV["DEBUG"] != "no"end+ def git_directory?(directory)+ candidate_paths = [".git", "HEAD"]+ candidate_paths.any? do |candidate_path|+ File.exist?(File.join(directory, candidate_path))+ end+ end+def latest_commit_time(git_directory)+ return nil unless git_directory?(git_directory)cd(git_directory) doreturn Time.iso8601(`git log -n 1 --format=%aI`.chomp).utcenddiff --git a/dev/tasks/linux-packages/yum/arrow.spec.in b/dev/tasks/linux-packages/yum/arrow.spec.inindex 9a0956dfb5..791c4ebdaf 100644--- a/dev/tasks/linux-packages/yum/arrow.spec.in+++ b/dev/tasks/linux-packages/yum/arrow.spec.in@@ -44,6 +44,7 @@ BuildRequires: python34-develBuildRequires: python34-numpy%endif%if %{use_glib}+BuildRequires: autoconf-archiveBuildRequires: gtk-docBuildRequires: gobject-introspection-devel%endif@@ -75,9 +76,11 @@ cd -%if %{use_glib}cd c_glib+./autogen.sh%configure \--with-arrow-cpp-build-dir=$PWD/../cpp/build \- --with-arrow-cpp-build-type=$build_type+ --with-arrow-cpp-build-type=$build_type \+ --enable-gtk-docsed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtoolsed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtoolLD_LIBRARY_PATH=$PWD/arrow-glib/.libs/:$PWD/../cpp/build/$build_type \diff --git a/dev/tasks/linux-packages/yum/build.sh b/dev/tasks/linux-packages/yum/build.shindex fea748be0a..5f2205695b 100755--- a/dev/tasks/linux-packages/yum/build.sh+++ b/dev/tasks/linux-packages/yum/build.sh@@ -71,7 +71,21 @@ run mkdir -p "${rpm_dir}" "${srpm_dir}"cdif [ -n "${SOURCE_ARCHIVE}" ]; then- run cp /host/tmp/${SOURCE_ARCHIVE} rpmbuild/SOURCES/+ case "${RELEASE}" in+ 0.dev*)+ run tar xf /host/tmp/${SOURCE_ARCHIVE}+ run mv \+ apache-${PACKAGE}-${VERSION}-$(echo $RELEASE | sed -e 's/^0\.//') \+ apache-${PACKAGE}-${VERSION}+ run tar czf \+ rpmbuild/SOURCES/${SOURCE_ARCHIVE} \+ apache-${PACKAGE}-${VERSION}+ run rm -rf apache-${PACKAGE}-${VERSION}+ ;;+ *)+ run cp /host/tmp/${SOURCE_ARCHIVE} rpmbuild/SOURCES/+ ;;+ esacelserun cp /host/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/fidiff --git a/dev/tasks/linux-packages/yum/centos-7/Dockerfile b/dev/tasks/linux-packages/yum/centos-7/Dockerfileindex 58058ee20e..1311a45796 100644--- a/dev/tasks/linux-packages/yum/centos-7/Dockerfile+++ b/dev/tasks/linux-packages/yum/centos-7/Dockerfile@@ -25,6 +25,7 @@ RUN \yum install -y ${quiet} epel-release && \yum groupinstall -y ${quiet} "Development Tools" && \yum install -y ${quiet} \+ autoconf-archive \boost-devel \cmake3 \git \