Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 23 additions & 54 deletions dev/tasks/linux-packages/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>(.+?)<\/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

Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions dev/tasks/linux-packages/apt/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}/
Expand Down
2 changes: 2 additions & 0 deletions dev/tasks/linux-packages/apt/ubuntu-trusty/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions dev/tasks/linux-packages/debian.ubuntu-trusty/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Priority: optional
Maintainer: Kouhei Sutou <kou@clear-code.com>
Build-Depends:
debhelper (>= 9),
dh-autoreconf,
pkg-config,
cmake,
git,
Expand Down
5 changes: 4 additions & 1 deletion dev/tasks/linux-packages/debian.ubuntu-trusty/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
16 changes: 12 additions & 4 deletions dev/tasks/linux-packages/package-task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion dev/tasks/linux-packages/yum/arrow.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
16 changes: 15 additions & 1 deletion dev/tasks/linux-packages/yum/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions dev/tasks/linux-packages/yum/centos-7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down