1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# -*- 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 ApacheArrowPackageTask < PackageTask
include Helper::ApacheArrow
def initialize
release_time = detect_release_time
super("apache-arrow",
detect_version(release_time),
release_time,
:rc_build_type => :release)
@rpm_package = "arrow"
end
private
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
end
if deb_archive_name != @archive_name
file deb_archive_name => @archive_name do
cp(@archive_name, deb_archive_name)
end
end
if rpm_archive_name != @archive_name
file rpm_archive_name => @archive_name do
cp(@archive_name, rpm_archive_name)
end
end
end
def download_rc_archive
base_url = "https://dist.apache.org/repos/dist/dev/arrow"
archive_name_no_rc = @archive_name.gsub(/-rc\d+(\.tar\.gz)\z/, "\\1")
url = "#{base_url}/#{@package}-#{@version}/#{archive_name_no_rc}"
download(url, @archive_name)
end
def download_released_archive
mirror_base_url = "https://www.apache.org/dyn/closer.lua/arrow"
mirror_list_url = "#{mirror_base_url}/arrow-#{@version}/#{@archive_name}"
open(mirror_list_url) do |response|
if /href="(.+?\/#{Regexp.escape(@archive_name)})"/ =~ response.read
download($1, ".")
end
end
end
def build_archive
cd(arrow_source_dir) do
sh("git", "archive", "HEAD",
"--prefix", "#{@archive_base_name}/",
"--output", @full_archive_name)
end
end
def apt_arm64_cuda_available_target?(target)
false
end
def apt_prepare_debian_control_cuda_architecture(control, target)
if apt_arm64_cuda_available_target?(target)
cuda_architecture = "any"
else
cuda_architecture = "i386 amd64"
end
control.gsub(/@CUDA_ARCHITECTURE@/, cuda_architecture)
end
def apt_prepare_debian_control_c_ares(control, target)
case target
when /\Aubuntu-bionic/
use_system_c_ares = "#"
else
use_system_c_ares = ""
end
control.gsub(/@USE_SYSTEM_C_ARES@/, use_system_c_ares)
end
def apt_prepare_debian_control_grpc(control, target)
case target
when /\Adebian-buster/, /\Aubuntu-(?:bionic|focal)/
use_system_grpc = "#"
else
use_system_grpc = ""
end
control.gsub(/@USE_SYSTEM_GRPC@/, use_system_grpc)
end
def apt_prepare_debian_control_thrift(control, target)
case target
when /\Aubuntu-bionic/
use_system_thrift = "#"
else
use_system_thrift = ""
end
control.gsub(/@USE_SYSTEM_THRIFT@/, use_system_thrift)
end
def apt_prepare_debian_control_utf8proc(control, target)
case target
when /\Aubuntu-bionic/
use_system_utf8proc = "#"
else
use_system_utf8proc = ""
end
control.gsub(/@USE_SYSTEM_UTF8PROC@/, use_system_utf8proc)
end
def apt_prepare_debian_control_zstd(control, target)
case target
when /\Adebian-buster/, /\Aubuntu-bionic/
use_system_zstd = "#"
else
use_system_zstd = ""
end
control.gsub(/@USE_SYSTEM_ZSTD@/, use_system_zstd)
end
def apt_prepare_debian_control(control_in, target)
control = control_in.dup
control = apt_prepare_debian_control_cuda_architecture(control, target)
control = apt_prepare_debian_control_c_ares(control, target)
control = apt_prepare_debian_control_grpc(control, target)
control = apt_prepare_debian_control_thrift(control, target)
control = apt_prepare_debian_control_utf8proc(control, target)
control = apt_prepare_debian_control_zstd(control, target)
control
end
end
task = ApacheArrowPackageTask.new
task.define
|