-
Notifications
You must be signed in to change notification settings - Fork 4.1k
GH-47876: [C++][FlightRPC] ODBC: macOS .PKG installer for Intel and ARM
#49766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,13 +132,11 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) | |
| set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") | ||
| set(CPACK_PACKAGE_CONTACT "dev@arrow.apache.org") | ||
|
|
||
| # GH-47876 TODO: set up `arrow_flight_sql_odbc` component for macOS Installer | ||
| # GH-47877 TODO: set up `arrow_flight_sql_odbc` component for Linux Installer | ||
| if(WIN32) | ||
| # Install ODBC and its Arrow dependencies | ||
| install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} | ||
| DESTINATION bin | ||
| COMPONENT arrow_flight_sql_odbc) | ||
| COMPONENT ArrowFlightSQLODBC) | ||
| install(TARGETS arrow_shared | ||
| arrow_compute_shared | ||
| arrow_flight_shared | ||
|
|
@@ -150,7 +148,7 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) | |
| "ext-ms-.*" | ||
| POST_EXCLUDE_REGEXES | ||
| ".*system32/.*\\.dll" | ||
| RUNTIME DESTINATION bin COMPONENT arrow_flight_sql_odbc) | ||
| RUNTIME DESTINATION bin COMPONENT ArrowFlightSQLODBC) | ||
|
|
||
| set(CPACK_WIX_EXTRA_SOURCES | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-flight-sql-odbc.wxs") | ||
|
|
@@ -159,10 +157,69 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) | |
|
|
||
| set(CPACK_WIX_UI_BANNER | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp") | ||
| else() | ||
| if(APPLE) | ||
| set(CPACK_PACKAGE_FILE_NAME | ||
| "ArrowFlightSQLODBC-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}" | ||
| ) | ||
| set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") | ||
|
|
||
| set(CPACK_SET_DESTDIR ON) | ||
| set(CPACK_INSTALL_PREFIX "/Library/ODBC") | ||
| # Register ODBC after install | ||
| set(CPACK_POSTFLIGHT_ARROWFLIGHTSQLODBC_SCRIPT | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/postinstall") | ||
| set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/README.txt") | ||
| set(CPACK_RESOURCE_FILE_WELCOME | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/welcome.txt") | ||
|
|
||
| set(ODBC_INSTALL_DIR "arrow-odbc/lib") | ||
| set(ODBC_DOC_INSTALL_DIR "arrow-odbc/doc") | ||
| else() | ||
| # Linux | ||
| # GH-49595: TODO implement DEB installer | ||
| # GH-47977: TODO implement RPM installer | ||
| message(STATUS "ODBC_PACKAGE_FORMAT DEB not implemented, see GH-49595") | ||
| message(STATUS "ODBC_PACKAGE_FORMAT RPM not implemented, see GH-47977") | ||
|
Comment on lines
+180
to
+183
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want to use CPack for deb and RPM?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kou Yes we would like to use I have raised GitHub issues for using
These are currently unassigned cc @lidavidm
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @raulcd, as mentioned in the Arrow community meeting, this is the PR thread discussion regarding
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We can do it with If we use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I'll work on deb/RPM in |
||
| endif() | ||
|
|
||
| # Install ODBC | ||
| install(TARGETS arrow_flight_sql_odbc_shared | ||
| DESTINATION "${ODBC_INSTALL_DIR}" | ||
| COMPONENT ArrowFlightSQLODBC) | ||
|
Comment on lines
+178
to
+189
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+178
to
+189
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| # Install temporary driver registration scripts, they will be removed after driver registration is complete | ||
| install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/install/unix/install_odbc.sh" | ||
| DESTINATION "${ODBC_INSTALL_DIR}" | ||
| COMPONENT ArrowFlightSQLODBC | ||
| PERMISSIONS OWNER_EXECUTE | ||
| OWNER_WRITE | ||
| OWNER_READ | ||
| GROUP_EXECUTE | ||
| GROUP_READ | ||
| WORLD_EXECUTE | ||
| WORLD_READ) | ||
| install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/install/unix/install_odbc_ini.sh" | ||
| DESTINATION "${ODBC_INSTALL_DIR}" | ||
| COMPONENT ArrowFlightSQLODBC | ||
| PERMISSIONS OWNER_EXECUTE | ||
| OWNER_WRITE | ||
| OWNER_READ | ||
| GROUP_EXECUTE | ||
| GROUP_READ | ||
| WORLD_EXECUTE | ||
| WORLD_READ) | ||
|
|
||
| # Install documentation files | ||
| install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt" | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../NOTICE.txt" | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/connection-options.md" | ||
| DESTINATION "${ODBC_DOC_INSTALL_DIR}" | ||
| COMPONENT Docs) | ||
| endif() | ||
|
|
||
| get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) | ||
| set(CPACK_COMPONENTS_ALL "arrow_flight_sql_odbc") | ||
| set(CPACK_COMPONENTS_ALL "ArrowFlightSQLODBC" "Docs") | ||
|
|
||
| if(WIN32) | ||
| # WiX msi installer on Windows | ||
|
|
@@ -173,14 +230,20 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) | |
| # Upgrade GUID is required to be unchanged for ODBC installer to upgrade | ||
| set(CPACK_WIX_UPGRADE_GUID "DBF27A18-F8BF-423F-9E3A-957414D52C4B") | ||
| set(CPACK_WIX_PRODUCT_GUID "279D087B-93B5-4DC3-BA69-BCF485022A26") | ||
| elseif(APPLE) | ||
| # macOS and Linux | ||
| set(CPACK_GENERATOR "productbuild") | ||
| endif() | ||
| # GH-47876 TODO: create macOS Installer using cpack | ||
| # GH-47877 TODO: create Linux Installer using cpack | ||
|
|
||
| # Load CPack after all CPACK* variables are set | ||
| include(CPack) | ||
| cpack_add_component(arrow_flight_sql_odbc | ||
| cpack_add_component(ArrowFlightSQLODBC | ||
| DISPLAY_NAME "ODBC library" | ||
| DESCRIPTION "Apache Arrow Flight SQL ODBC library bin, required to install" | ||
| REQUIRED) | ||
| cpack_add_component(Docs | ||
| DISPLAY_NAME "Documentation" | ||
| DESCRIPTION "Documentation for Apache Arrow Flight SQL ODBC Driver" | ||
| REQUIRED) | ||
| endif() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Files are available in '/Library/ODBC/arrow-odbc' after installation. | ||
|
|
||
| To set up a connection, you can use DSN to store your data source connection information. | ||
| 1. Open 'iODBC Data Source Administrator'. | ||
| 2. To create a user DSN, go to 'User DSN' tab and click 'Add'. | ||
| 3. Select 'Apache Arrow Flight SQL ODBC Driver' and click 'Finish'. | ||
| 4. Enter DSN name and connection string values. | ||
| For the list of all supported options, check '/Library/ODBC/arrow-odbc/doc/connection-options.md'. | ||
| 5. Click 'OK' to save the DSN. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/bin/bash | ||
| # | ||
| # 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. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| odbc_install_script="/Library/ODBC/arrow-odbc/lib/install_odbc.sh" | ||
| dsn_install_script="/Library/ODBC/arrow-odbc/lib/install_odbc_ini.sh" | ||
| driver_lib="/Library/ODBC/arrow-odbc/lib/libarrow_flight_sql_odbc.dylib" | ||
| dsn_file="/Library/ODBC/odbc.ini" | ||
|
|
||
| if [[ ! -x "$odbc_install_script" ]]; then | ||
| echo "ERROR: ODBC install script $odbc_install_script not found" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| "$odbc_install_script" "$driver_lib" || { | ||
| echo "ERROR: Failed to register ODBC driver ($driver_lib)" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| if [[ ! -x "$dsn_install_script" ]]; then | ||
| echo "ERROR: DSN install script $dsn_install_script not found" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| "$dsn_install_script" "$dsn_file" || { | ||
| echo "ERROR: Failed to register DSN to ($dsn_file)" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| # clean temporary script | ||
| rm -f "$odbc_install_script" "$dsn_install_script" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Apache Arrow Flight SQL ODBC Driver is a read-only ODBC driver for connecting to data sources that support Arrow Flight SQL. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Used by macOS ODBC installer script `install_odbc_ini.sh` and macOS ODBC testing | ||
| # Used by cpp/src/arrow/flight/sql/odbc/install/mac/postinstall | ||
|
|
||
| set -euo pipefail | ||
|
|
||
|
|
@@ -42,44 +42,51 @@ fi | |
|
|
||
| case "$(uname)" in | ||
| Linux) | ||
| USER_ODBCINST_FILE="/etc/odbcinst.ini" | ||
| SYSTEM_ODBCINST_FILE="/etc/odbcinst.ini" | ||
| ;; | ||
| *) | ||
| # macOS | ||
| USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini" | ||
| mkdir -p "$HOME"/Library/ODBC | ||
| SYSTEM_ODBCINST_FILE="/Library/ODBC/odbcinst.ini" | ||
| mkdir -p /Library/ODBC | ||
|
Comment on lines
48
to
+50
|
||
| ;; | ||
| esac | ||
|
|
||
| DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver" | ||
|
|
||
| touch "$USER_ODBCINST_FILE" | ||
| touch "$SYSTEM_ODBCINST_FILE" | ||
|
|
||
| if grep -q "^\[$DRIVER_NAME\]" "$USER_ODBCINST_FILE"; then | ||
| if grep -q "^\[$DRIVER_NAME\]" "$SYSTEM_ODBCINST_FILE"; then | ||
| echo "Driver [$DRIVER_NAME] already exists in odbcinst.ini" | ||
| else | ||
| echo "Adding [$DRIVER_NAME] to odbcinst.ini..." | ||
| echo " | ||
| [$DRIVER_NAME] | ||
| Description=An ODBC Driver for Apache Arrow Flight SQL | ||
| Driver=$ODBC_64BIT | ||
| " >>"$USER_ODBCINST_FILE" | ||
| " >>"$SYSTEM_ODBCINST_FILE" | ||
| fi | ||
|
|
||
| # Check if [ODBC Drivers] section exists | ||
| if grep -q '^\[ODBC Drivers\]' "$USER_ODBCINST_FILE"; then | ||
| if grep -q '^\[ODBC Drivers\]' "$SYSTEM_ODBCINST_FILE"; then | ||
| # Section exists: check if driver entry exists | ||
| if ! grep -q "^${DRIVER_NAME}=" "$USER_ODBCINST_FILE"; then | ||
| if ! grep -q "^${DRIVER_NAME}=" "$SYSTEM_ODBCINST_FILE"; then | ||
| # Driver entry does not exist, add under [ODBC Drivers] | ||
| sed -i '' "/^\[ODBC Drivers\]/a\\ | ||
| ${DRIVER_NAME}=Installed | ||
| " "$USER_ODBCINST_FILE" | ||
|
|
||
| awk -v driver="$DRIVER_NAME" ' | ||
| $0 ~ /^\[ODBC Drivers\]/ && !inserted { | ||
| print driver "=Installed" | ||
| inserted=1 | ||
| next | ||
| } | ||
| { print } | ||
| ' "$SYSTEM_ODBCINST_FILE" > "${SYSTEM_ODBCINST_FILE}.tmp" && mv "${SYSTEM_ODBCINST_FILE}.tmp" "$SYSTEM_ODBCINST_FILE" | ||
| fi | ||
| else | ||
| # Section doesn't exist, append both section and driver entry at end | ||
| { | ||
| echo "" | ||
| echo "[ODBC Drivers]" | ||
| echo "${DRIVER_NAME}=Installed" | ||
| } >>"$USER_ODBCINST_FILE" | ||
| } >>"$SYSTEM_ODBCINST_FILE" | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| #!/bin/bash | ||
| # | ||
| # 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. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SYSTEM_ODBC_FILE="${1:-}" | ||
|
|
||
| if [[ -z "$SYSTEM_ODBC_FILE" ]]; then | ||
| echo "ERROR: path to system ODBC DSN is not specified." >&2 | ||
| echo "Usage: install_odbc_ini.sh <abs_path_to_odbc_dsn_ini>" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver" | ||
| DSN_NAME="Apache Arrow Flight SQL ODBC DSN" | ||
|
|
||
| if ! touch "$SYSTEM_ODBC_FILE"; then | ||
| echo "ERROR: Cannot access or create $SYSTEM_ODBC_FILE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if grep -q "^\[$DSN_NAME\]" "$SYSTEM_ODBC_FILE"; then | ||
| echo "DSN [$DSN_NAME] already exists in $SYSTEM_ODBC_FILE" | ||
| else | ||
| echo "Adding [$DSN_NAME] to $SYSTEM_ODBC_FILE..." | ||
| cat >> "$SYSTEM_ODBC_FILE" <<EOF | ||
|
|
||
| [$DSN_NAME] | ||
| Description = An ODBC Driver DSN for Apache Arrow Flight SQL | ||
| Driver = $DRIVER_NAME | ||
| Host = | ||
| Port = | ||
| UID = | ||
| PWD = | ||
| EOF | ||
| fi | ||
|
|
||
| # Check if [ODBC Data Sources] section exists | ||
| if grep -q '^\[ODBC Data Sources\]' "$SYSTEM_ODBC_FILE"; then | ||
| # Section exists: check if DSN entry exists | ||
| if ! grep -Eq "^${DSN_NAME}[[:space:]]*=" "$SYSTEM_ODBC_FILE"; then | ||
| # Add DSN entry under [ODBC Data Sources] section | ||
| tmp_file="$(mktemp "${SYSTEM_ODBC_FILE}.XXXX")" | ||
|
|
||
| # Use awk to insert the line immediately after [ODBC Data Sources] | ||
| awk -v dsn="$DSN_NAME" -v driver="$DRIVER_NAME" ' | ||
| $0 ~ /^\[ODBC Data Sources\]/ && !inserted { | ||
|
Comment on lines
+59
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now adjust ownership with |
||
| print dsn "=" driver | ||
| inserted=1 | ||
| next | ||
| } | ||
| { print } | ||
| ' "$SYSTEM_ODBC_FILE" > "$tmp_file" | ||
|
|
||
| mv "$tmp_file" "$SYSTEM_ODBC_FILE" | ||
|
|
||
| # Restore expected permissions/ownership for system ODBC config | ||
| chmod 644 "$SYSTEM_ODBC_FILE" | ||
| fi | ||
|
Comment on lines
+54
to
+76
|
||
| else | ||
| # Section doesn't exist, append section and DSN entry at end | ||
| { | ||
| echo "" | ||
| echo "[ODBC Data Sources]" | ||
| echo "${DSN_NAME}=${DRIVER_NAME}" | ||
| } >> "$SYSTEM_ODBC_FILE" | ||
| fi | ||
Uh oh!
There was an error while loading. Please reload this page.