Skip to content

Commit 9b4d76e

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: ^ cpp/src/arrow/flight/sql/odbc/CMakeLists.txt
1 parent 62cdda9 commit 9b4d76e

9 files changed

Lines changed: 107 additions & 14 deletions

File tree

.github/workflows/cpp_extra.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ jobs:
350350
351351
odbc-linux:
352352
needs: check-labels
353-
name: ODBC Linux
353+
name: ODBC ${{ matrix.build-type }} ${{ matrix.title }}
354354
runs-on: ubuntu-latest
355355
if: >-
356356
needs.check-labels.outputs.force == 'true' ||
@@ -359,6 +359,15 @@ jobs:
359359
timeout-minutes: 75
360360
strategy:
361361
fail-fast: false
362+
matrix:
363+
include:
364+
- image: ubuntu-cpp-odbc
365+
title: AMD64 Ubuntu RPM
366+
build-type: release
367+
format: rpm
368+
run-options: >-
369+
-e ARROW_FLIGHT_SQL_ODBC_INSTALLER=ON
370+
-e ODBC_PACKAGE_FORMAT=RPM
362371
env:
363372
ARCH: amd64
364373
ARCHERY_DEBUG: 1
@@ -376,8 +385,8 @@ jobs:
376385
uses: actions/cache@v5
377386
with:
378387
path: .docker
379-
key: ubuntu-cpp-odbc-${{ hashFiles('cpp/**') }}
380-
restore-keys: ubuntu-cpp-odbc-
388+
key: ${{ matrix.image }}-${{ matrix.format }}-${{ hashFiles('cpp/**') }}
389+
restore-keys: ${{ matrix.image }}-${{ matrix.format }}-
381390
- name: Setup Python on hosted runner
382391
uses: actions/setup-python@v6
383392
with:
@@ -392,7 +401,14 @@ jobs:
392401
# GH-40558: reduce ASLR to avoid ASAN/LSAN crashes
393402
sudo sysctl -w vm.mmap_rnd_bits=28
394403
source ci/scripts/util_enable_core_dumps.sh
395-
archery docker run ubuntu-cpp-odbc
404+
archery docker run ${{ matrix.run-options || '' }} ${{ matrix.image }}
405+
- name: Upload ODBC ${{ matrix.format }} to the job
406+
if: matrix.build-type == 'release'
407+
uses: actions/upload-artifact@v7
408+
with:
409+
name: flight-sql-odbc-${{ matrix.format }}-installer
410+
path: build/cpp/ArrowFlightSqlOdbc-*.${{ matrix.format }}
411+
if-no-files-found: error
396412
- name: Docker Push
397413
if: >-
398414
success() &&
@@ -403,7 +419,7 @@ jobs:
403419
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
404420
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
405421
continue-on-error: true
406-
run: archery docker push ubuntu-cpp-odbc
422+
run: archery docker push ${{ matrix.image }}
407423

408424
odbc-macos:
409425
needs: check-labels

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ repos:
348348
?^cpp/examples/minimal_build/run\.sh$|
349349
?^cpp/examples/tutorial_examples/run\.sh$|
350350
?^cpp/src/arrow/flight/sql/odbc/install/mac/postinstall$|
351+
?^cpp/src/arrow/flight/sql/odbc/install/linux/rpm/postinstall$|
351352
?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc\.sh$|
352353
?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc_ini\.sh$|
353354
?^dev/release/05-binary-upload\.sh$|

ci/docker/ubuntu-24.04-cpp.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ RUN apt-get update -y -q && \
118118
python3-venv \
119119
rados-objclass-dev \
120120
rapidjson-dev \
121+
rpm \
121122
rsync \
122123
tzdata \
123124
tzdata-legacy \

ci/scripts/cpp_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ else
274274
-Dlz4_SOURCE=${lz4_SOURCE:-} \
275275
-Dnlohmann_json_SOURCE=${nlohmann_json_SOURCE:-} \
276276
-Dopentelemetry-cpp_SOURCE=${opentelemetry_cpp_SOURCE:-} \
277+
-DODBC_PACKAGE_FORMAT=${ODBC_PACKAGE_FORMAT:-} \
277278
-DORC_SOURCE=${ORC_SOURCE:-} \
278279
-DPARQUET_BUILD_EXAMPLES=${PARQUET_BUILD_EXAMPLES:-OFF} \
279280
-DPARQUET_BUILD_EXECUTABLES=${PARQUET_BUILD_EXECUTABLES:-OFF} \

compose.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,15 @@ services:
516516
ARROW_PARQUET: "OFF"
517517
ARROW_S3: "OFF"
518518
ARROW_SUBSTRAIT: "OFF"
519+
# Use `/arrow/build` so build artifacts are visible on the CI host
520+
# Generate ODBC installer before testing
519521
# Register ODBC before running tests
520522
command: >
521523
/bin/bash -c "
522-
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
524+
/arrow/ci/scripts/cpp_build.sh /arrow /arrow/build &&
525+
(cd /arrow/build/cpp && cpack) &&
523526
sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so &&
524-
/arrow/ci/scripts/cpp_test.sh /arrow /build"
527+
/arrow/ci/scripts/cpp_test.sh /arrow /arrow/build"
525528
526529
ubuntu-cpp-minimal:
527530
# Arrow build with minimal components/dependencies

cpp/cmake_modules/DefineOptions.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ takes precedence over ccache if a storage backend is configured" ON)
335335
ARROW_FLIGHT_SQL
336336
ARROW_COMPUTE)
337337

338+
define_option(ARROW_FLIGHT_SQL_ODBC_INSTALLER
339+
"Build the installer Arrow Flight SQL ODBC extension"
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: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
155155
set(CPACK_WIX_UI_BANNER
156156
"${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp")
157157
else()
158+
set(ODBC_UNIX_FILE_NAME
159+
"ArrowFlightSqlOdbc-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}"
160+
)
158161
if(APPLE)
159-
set(CPACK_PACKAGE_FILE_NAME
160-
"ArrowFlightSQLODBC-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}"
161-
)
162+
set(CPACK_PACKAGE_FILE_NAME "${ODBC_UNIX_FILE_NAME}")
162163
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
163164

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

183202
# Install ODBC

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)