kou commented on code in PR #49766:
URL: https://github.com/apache/arrow/pull/49766#discussion_r3144702389


##########
cpp/src/arrow/flight/sql/odbc/install/mac/postinstall:
##########
@@ -0,0 +1,51 @@
+#!/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.
+
+#!/usr/bin/env bash

Review Comment:
   ```suggestion
   ```



##########
cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc_ini.sh:
##########
@@ -0,0 +1,82 @@
+#!/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.
+
+#!/usr/bin/env bash

Review Comment:
   ```suggestion
   ```



##########
cpp/src/arrow/flight/sql/odbc/install/mac/postinstall:
##########
@@ -0,0 +1,51 @@
+#!/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.
+
+#!/usr/bin/env bash
+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"
+
+cleanup() {
+  rm -f "$odbc_install_script" "$dsn_install_script"
+}
+trap cleanup EXIT
+
+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
+}

Review Comment:
   Is `install_odbc.sh` removed when installation is failed?



##########
cpp/src/arrow/flight/sql/odbc/install/mac/README.txt:
##########
@@ -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'.

Review Comment:
   ```suggestion
   For the list of all supported options, check 
'/Library/ODBC/arrow-odbc/doc/connection-options.md'.
   ```



##########
cpp/src/arrow/flight/sql/odbc/CMakeLists.txt:
##########
@@ -159,6 +158,66 @@ 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_ARROW_FLIGHT_SQL_ODBC_SCRIPT

Review Comment:
   Is this variable name (the `CPACK_POSTFLIGHT` prefix) correct?
   It seems that https://cmake.org/cmake/help/latest/module/CPack.html doesn't 
mention the `PACK_POSTFLIGHT_...` pattern.



##########
cpp/src/arrow/flight/sql/odbc/CMakeLists.txt:
##########
@@ -159,6 +158,66 @@ 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_ARROW_FLIGHT_SQL_ODBC_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")
+    endif()
+
+    # Install ODBC
+    install(TARGETS arrow_flight_sql_odbc_shared
+            DESTINATION "${ODBC_INSTALL_DIR}"
+            COMPONENT arrow_flight_sql_odbc)

Review Comment:
   It seems that CMake uses "Unspecified" as the default component name: 
https://cmake.org/cmake/help/latest/command/install.html#common-options
   
   How about using `ArrowFlightSQLODBC` instead of `arrow_flight_sql_odbc`?



##########
cpp/src/arrow/flight/sql/odbc/CMakeLists.txt:
##########
@@ -159,6 +158,66 @@ 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}"

Review Comment:
   How about using `SQL` and `ODBC` like other locations?
   
   ```suggestion
             
"ArrowFlightSQLODBC-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to