Skip to content

Commit 1f56e49

Browse files
alinaliBQjusting-bq
authored andcommitted
ODBC Linux rpm installer support
* Implement RPM installer fix formatting Remove todos ODBC rpm Installer wrap up * installing `rpm` package fixed the `cpack` command issue * Fix cpack command on CI (merge into last commit when ready) Change to use `awk` so script works on both platforms Comment out `find` and `tree` steps Change build path to be under /arrow Since docker is mounted, changing build path to be in `/arrow` will allow host machine to access docker build contents TEMP - Disable non-ODBC items Add commands to find build folder Attempt to build RPM installer * not sure if `/build/cpp` can be accessed outside of docker. Hopefully it should. * add `rpm` dependency install Indicate RPM in workflow run Add rpm `postinstall` (not tested) Remove merge conflict code * Enable ODBC installer build in CI instead of `compose.yaml` Update workflow matrix Update cpp_extra.yml Fix package name ^ Conflicts: ^ .github/workflows/cpp_extra.yml
1 parent cb3bd69 commit 1f56e49

9 files changed

Lines changed: 118 additions & 22 deletions

File tree

.github/workflows/cpp_extra.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,20 @@ jobs:
359359
odbc-linux:
360360
needs: check-enabled
361361
if: needs.check-enabled.outputs.is_enabled == 'true'
362-
name: ODBC Linux
362+
name: ODBC ${{ matrix.build-type }} ${{ matrix.title }}
363363
runs-on: ubuntu-latest
364364
timeout-minutes: 75
365365
strategy:
366366
fail-fast: false
367+
matrix:
368+
include:
369+
- image: ubuntu-cpp-odbc
370+
title: AMD64 Ubuntu RPM
371+
build-type: release
372+
format: rpm
373+
run-options: >-
374+
-e ARROW_FLIGHT_SQL_ODBC_INSTALLER=ON
375+
-e ODBC_PACKAGE_FORMAT=RPM
367376
env:
368377
ARCH: amd64
369378
ARCHERY_DEBUG: 1
@@ -391,7 +400,8 @@ jobs:
391400
uses: apache/infrastructure-actions/stash/restore@0ba14156c9f4c3cfbe4b0c9f36339ab0f8d81e53
392401
with:
393402
path: .docker
394-
key: ubuntu-cpp-odbc
403+
key: ${{ matrix.image }}-${{ matrix.format }}-${{ hashFiles('cpp/**') }}
404+
restore-keys: ${{ matrix.image }}-${{ matrix.format }}-
395405
- name: Execute Docker Build
396406
env:
397407
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
@@ -400,14 +410,21 @@ jobs:
400410
# GH-40558: reduce ASLR to avoid ASAN/LSAN crashes
401411
sudo sysctl -w vm.mmap_rnd_bits=28
402412
source ci/scripts/util_enable_core_dumps.sh
403-
archery docker run ubuntu-cpp-odbc
413+
archery docker run ${{ matrix.run-options || '' }} ${{ matrix.image }}
414+
- name: Upload ODBC ${{ matrix.format }} to the job
415+
if: matrix.build-type == 'release'
416+
uses: actions/upload-artifact@v7
417+
with:
418+
name: flight-sql-odbc-${{ matrix.format }}-installer
419+
path: build/cpp/ArrowFlightSQLODBC-*.${{ matrix.format }}
420+
if-no-files-found: error
404421
- name: Save Docker Volumes
405422
if: ${{ !cancelled() }}
406423
continue-on-error: true
407424
uses: apache/infrastructure-actions/stash/save@0ba14156c9f4c3cfbe4b0c9f36339ab0f8d81e53
408425
with:
409426
path: .docker
410-
key: ubuntu-cpp-odbc
427+
key: ${{ matrix.image }}-${{ matrix.format }}-${{ hashFiles('cpp/**') }}
411428
include-hidden-files: true
412429
- name: Docker Push
413430
if: >-
@@ -419,7 +436,7 @@ jobs:
419436
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
420437
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
421438
continue-on-error: true
422-
run: archery docker push ubuntu-cpp-odbc
439+
run: archery docker push ${{ matrix.image }}
423440

424441
odbc-macos:
425442
needs: check-enabled

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ repos:
347347
?^cpp/examples/minimal_build/run\.sh$|
348348
?^cpp/examples/tutorial_examples/run\.sh$|
349349
?^cpp/src/arrow/flight/sql/odbc/install/mac/postinstall$|
350+
?^cpp/src/arrow/flight/sql/odbc/install/linux/rpm/postinstall$|
350351
?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc\.sh$|
351352
?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc_ini\.sh$|
352353
?^cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance\.sh$|

ci/docker/ubuntu-24.04-cpp.dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ RUN apt-get update -y -q && \
119119
python3-venv \
120120
rados-objclass-dev \
121121
rapidjson-dev \
122+
rpm \
122123
rsync \
124+
sudo \
123125
tzdata \
124126
tzdata-legacy \
125127
unixodbc-dev \

ci/scripts/cpp_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ else
276276
-Dlz4_SOURCE=${lz4_SOURCE:-} \
277277
-Dnlohmann_json_SOURCE=${nlohmann_json_SOURCE:-} \
278278
-Dopentelemetry-cpp_SOURCE=${opentelemetry_cpp_SOURCE:-} \
279+
-DODBC_PACKAGE_FORMAT=${ODBC_PACKAGE_FORMAT:-} \
279280
-DORC_SOURCE=${ORC_SOURCE:-} \
280281
-DPARQUET_BUILD_EXAMPLES=${PARQUET_BUILD_EXAMPLES:-OFF} \
281282
-DPARQUET_BUILD_EXECUTABLES=${PARQUET_BUILD_EXECUTABLES:-OFF} \

compose.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,15 +537,18 @@ services:
537537
ARROW_PARQUET: "OFF"
538538
ARROW_S3: "OFF"
539539
ARROW_SUBSTRAIT: "OFF"
540+
# Use `/arrow/build` so build artifacts are visible on the CI host
541+
# Generate ODBC installer before testing
540542
# Register ODBC before running tests
541543
depends_on:
542544
dremio:
543545
condition: service_healthy
544546
command: >
545547
/bin/bash -c "
546-
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
548+
/arrow/ci/scripts/cpp_build.sh /arrow /arrow/build &&
549+
(cd /arrow/build/cpp && cpack) &&
547550
sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so &&
548-
/arrow/ci/scripts/cpp_test.sh /arrow /build"
551+
/arrow/ci/scripts/cpp_test.sh /arrow /arrow/build"
549552
550553
ubuntu-cpp-minimal:
551554
# Arrow build with minimal components/dependencies

cpp/cmake_modules/DefineOptions.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,18 @@ takes precedence over ccache if a storage backend is configured" ON)
329329
ARROW_FLIGHT)
330330

331331
define_option(ARROW_FLIGHT_SQL_ODBC
332-
"Build the Arrow Flight SQL ODBC extension"
332+
"Build the Arrow Flight SQL ODBC driver"
333333
OFF
334334
DEPENDS
335335
ARROW_FLIGHT_SQL
336336
ARROW_COMPUTE)
337337

338+
define_option(ARROW_FLIGHT_SQL_ODBC_INSTALLER
339+
"Build the installer for the Arrow Flight SQL ODBC driver"
340+
OFF
341+
DEPENDS
342+
ARROW_FLIGHT_SQL_ODBC)
343+
338344
define_option(ARROW_GANDIVA
339345
"Build the Gandiva libraries"
340346
OFF

cpp/src/arrow/flight/sql/odbc/CMakeLists.txt

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,13 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
154154

155155
set(CPACK_WIX_UI_BANNER
156156
"${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp")
157+
set(ODBC_DOC_INSTALL_DIR "doc")
157158
else()
159+
set(ODBC_UNIX_FILE_NAME
160+
"ArrowFlightSQLODBC-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}"
161+
)
158162
if(APPLE)
159-
set(CPACK_PACKAGE_FILE_NAME
160-
"ArrowFlightSQLODBC-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}"
161-
)
163+
set(CPACK_PACKAGE_FILE_NAME "${ODBC_UNIX_FILE_NAME}")
162164
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
163165

164166
set(CPACK_SET_DESTDIR ON)
@@ -174,10 +176,28 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
174176
set(ODBC_DOC_INSTALL_DIR "arrow-odbc/doc")
175177
else()
176178
# Linux
177-
# GH-49595: TODO implement DEB installer
178-
# GH-47977: TODO implement RPM installer
179-
message(STATUS "ODBC_PACKAGE_FORMAT DEB not implemented, see GH-49595")
180-
message(STATUS "ODBC_PACKAGE_FORMAT RPM not implemented, see GH-47977")
179+
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
180+
if(${ODBC_PACKAGE_FORMAT} STREQUAL "DEB")
181+
# GH-49595 TODO: implement DEB installer
182+
message(STATUS "ODBC_PACKAGE_FORMAT DEB not implemented, see GH-49595")
183+
elseif(${ODBC_PACKAGE_FORMAT} STREQUAL "RPM")
184+
set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64)
185+
set(CPACK_GENERATOR RPM)
186+
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
187+
"${CMAKE_CURRENT_SOURCE_DIR}/install/linux/postinst")
188+
set(CPACK_RPM_FILE_NAME "${ODBC_UNIX_FILE_NAME}.rpm")
189+
# Disable dependency check as ODBC embeds all third party dependencies
190+
set(CPACK_RPM_PACKAGE_AUTOREQPROV "no")
191+
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
192+
set(CPACK_RPM_COMPONENT_INSTALL ON)
193+
else()
194+
message(FATAL_ERROR "ODBC_PACKAGE_FORMAT '${ODBC_PACKAGE_FORMAT}' must be DEB or RPM for Linux installer."
195+
)
196+
endif()
197+
198+
# By default, Linux installs under /usr
199+
set(ODBC_INSTALL_DIR "lib64/arrow-odbc/lib")
200+
set(ODBC_DOC_INSTALL_DIR "lib64/arrow-odbc/doc")
181201
endif()
182202

183203
# Install ODBC
@@ -206,15 +226,15 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
206226
GROUP_READ
207227
WORLD_EXECUTE
208228
WORLD_READ)
209-
210-
# Install documentation files
211-
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt"
212-
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../NOTICE.txt"
213-
"${CMAKE_CURRENT_SOURCE_DIR}/connection-options.md"
214-
DESTINATION "${ODBC_DOC_INSTALL_DIR}"
215-
COMPONENT Docs)
216229
endif()
217230

231+
# Install documentation files
232+
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt"
233+
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../NOTICE.txt"
234+
"${CMAKE_CURRENT_SOURCE_DIR}/connection-options.md"
235+
DESTINATION "${ODBC_DOC_INSTALL_DIR}"
236+
COMPONENT Docs)
237+
218238
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
219239
set(CPACK_COMPONENTS_ALL "ArrowFlightSQLODBC" "Docs")
220240

cpp/src/arrow/flight/sql/odbc/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,22 @@ After ODBC has been registered, you can run the ODBC tests. It is recommended to
144144
.\cpp\build\< release | debug >\< Release | Debug>\arrow-flight-sql-odbc-test.exe
145145
```
146146
147+
## Installers
148+
149+
ODBC installers are uploaded to the CI artifacts.
150+
151+
| Operating System | Package Format |
152+
|------------------|----------------|
153+
| Windows | MSI |
154+
| macOS | PKG |
155+
| Linux | DEB / RPM |
156+
157+
### Install `.RPM` on Ubuntu
158+
While installing via `.DEB` installer on Ubuntu is the recommended approach, users may install `.RPM` on Ubuntu using below command
159+
```
160+
alien -i --scripts ArrowFlightSQLODBC-<version>.rpm
161+
```
162+
147163
## Known Limitations
148164
149165
- Conversion from timestamp data type with specified time zone value to strings is not supported at the moment. This doesn't impact driver's usage of retrieving timestamp data from Power BI on Windows, and Excel on macOS and Windows. See GH-47504 for more context.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
# Use temporary driver registration script to register ODBC driver in system DSN
21+
odbc_install_script="/usr/lib64/arrow-odbc/lib/install_odbc.sh"
22+
"$odbc_install_script" /usr/lib64/arrow-odbc/lib/libarrow_flight_sql_odbc.so
23+
24+
# Use temporary DSN registration script to register sample system DSN
25+
dsn_install_script="/usr/lib64/arrow-odbc/lib/install_odbc_ini.sh"
26+
"$dsn_install_script" /etc/odbc.ini
27+
28+
# clean temporary script
29+
rm -f "$odbc_install_script"
30+
rm -f "$dsn_install_script"

0 commit comments

Comments
 (0)