diff --git a/dev/tasks/linux-packages/Rakefile b/dev/tasks/linux-packages/Rakefile index bce23de2ff5..d24aa11cb85 100644 --- a/dev/tasks/linux-packages/Rakefile +++ b/dev/tasks/linux-packages/Rakefile @@ -21,35 +21,45 @@ require_relative "package-task" class ApacheArrowPackageTask < PackageTask def initialize - release_time = latest_commit_time(arrow_source_dir) + release_time = detect_release_time super("apache-arrow", detect_version(release_time), release_time) @rpm_package = "arrow" end private + 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_dir File.join(File.dirname(__FILE__), "..", "..", "..") end def 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>/)[0][0] - version = ENV['ARROW_VERSION'] || version #try to read from env formatted_release_time = release_time.strftime("%Y%m%d") - version.gsub(/-SNAPSHOT\z/) {".#{formatted_release_time}"} + version.gsub(/-SNAPSHOT\z/) {"-dev#{formatted_release_time}"} end def define_archive_task file @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 + end end end @@ -74,48 +84,7 @@ class ApacheArrowPackageTask < PackageTask cd(arrow_source_dir) do sh("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) end end end diff --git a/dev/tasks/linux-packages/apt/build.sh b/dev/tasks/linux-packages/apt/build.sh index 2e44775f0f5..b4a3fd6924c 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 build run tar xfz ${PACKAGE}_${VERSION}.orig.tar.gz case "${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} ;; esac run cd ${PACKAGE}-${VERSION}/ diff --git a/dev/tasks/linux-packages/apt/ubuntu-trusty/Dockerfile b/dev/tasks/linux-packages/apt/ubuntu-trusty/Dockerfile index dcb343b0208..12732879104 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/control index 298b3c76c63..6dfceacbf1b 100644 --- a/dev/tasks/linux-packages/debian.ubuntu-trusty/control +++ b/dev/tasks/linux-packages/debian.ubuntu-trusty/control @@ -4,6 +4,7 @@ Priority: optional Maintainer: Kouhei Sutou 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/rules index 5021f367049..5dc873f3987 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=-timeless BUILD_TYPE=release %: - dh $@ --with gir + dh $@ --with gir,autoreconf + +override_dh_autoreconf: + cd c_glib && ./autogen.sh override_dh_auto_configure: dh_auto_configure \ diff --git a/dev/tasks/linux-packages/package-task.rb b/dev/tasks/linux-packages/package-task.rb index b8f25ae4476..cc32db45362 100644 --- a/dev/tasks/linux-packages/package-task.rb +++ b/dev/tasks/linux-packages/package-task.rb @@ -33,12 +33,12 @@ def initialize(package, version, release_time) @rpm_package = @package case @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 @@ def debug_build? ENV["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) do return Time.iso8601(`git log -n 1 --format=%aI`.chomp).utc end diff --git a/dev/tasks/linux-packages/yum/arrow.spec.in b/dev/tasks/linux-packages/yum/arrow.spec.in index 9a0956dfb52..791c4ebdaf5 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-devel BuildRequires: python34-numpy %endif %if %{use_glib} +BuildRequires: autoconf-archive BuildRequires: gtk-doc BuildRequires: 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-doc sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool LD_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.sh index fea748be0aa..5f2205695b2 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}" cd if [ -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/ + ;; + esac else run cp /host/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/ fi diff --git a/dev/tasks/linux-packages/yum/centos-7/Dockerfile b/dev/tasks/linux-packages/yum/centos-7/Dockerfile index 58058ee20ec..1311a457965 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 \