Skip to content

Commit d74e3c3

Browse files
committed
Address feedback
1 parent f2bbcf6 commit d74e3c3

2 files changed

Lines changed: 25 additions & 23 deletions

File tree

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,14 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
212212

213213
# Install documentation files
214214
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt"
215-
DESTINATION "${ODBC_DOC_INSTALL_DIR}"
216-
COMPONENT Docs)
217-
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/connection-options.md"
215+
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../NOTICE.txt"
216+
"${CMAKE_CURRENT_SOURCE_DIR}/connection-options.md"
218217
DESTINATION "${ODBC_DOC_INSTALL_DIR}"
219218
COMPONENT Docs)
220219
endif()
221220

222221
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
223-
set(CPACK_COMPONENTS_ALL "ArrowFlightSQLODBC")
222+
set(CPACK_COMPONENTS_ALL "ArrowFlightSQLODBC" "Docs")
224223

225224
if(WIN32)
226225
# WiX msi installer on Windows
@@ -233,7 +232,6 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
233232
set(CPACK_WIX_PRODUCT_GUID "279D087B-93B5-4DC3-BA69-BCF485022A26")
234233
else()
235234
# macOS and Linux
236-
list(APPEND CPACK_COMPONENTS_ALL Docs)
237235
if(APPLE)
238236
set(CPACK_GENERATOR "productbuild")
239237
endif()
@@ -246,11 +244,8 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
246244
DISPLAY_NAME "ODBC library"
247245
DESCRIPTION "Apache Arrow Flight SQL ODBC library bin, required to install"
248246
REQUIRED)
249-
if(UNIX)
250-
# On macOS and Linux, provide connection string documentation since users need to manually enter DSN keys.
251-
cpack_add_component(Docs
252-
DISPLAY_NAME "Documentation"
253-
DESCRIPTION "Documentation for Apache Arrow Flight SQL ODBC Driver"
254-
)
255-
endif()
247+
cpack_add_component(Docs
248+
DISPLAY_NAME "Documentation"
249+
DESCRIPTION "Documentation for Apache Arrow Flight SQL ODBC Driver"
250+
REQUIRED)
256251
endif()

cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,44 +42,51 @@ fi
4242

4343
case "$(uname)" in
4444
Linux)
45-
ODBCINST_FILE="/etc/odbcinst.ini"
45+
SYSTEM_ODBCINST_FILE="/etc/odbcinst.ini"
4646
;;
4747
*)
4848
# macOS
49-
ODBCINST_FILE="/Library/ODBC/odbcinst.ini"
49+
SYSTEM_ODBCINST_FILE="/Library/ODBC/odbcinst.ini"
5050
mkdir -p /Library/ODBC
5151
;;
5252
esac
5353

5454
DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver"
5555

56-
touch "$ODBCINST_FILE"
56+
touch "$SYSTEM_ODBCINST_FILE"
5757

58-
if grep -q "^\[$DRIVER_NAME\]" "$ODBCINST_FILE"; then
58+
if grep -q "^\[$DRIVER_NAME\]" "$SYSTEM_ODBCINST_FILE"; then
5959
echo "Driver [$DRIVER_NAME] already exists in odbcinst.ini"
6060
else
6161
echo "Adding [$DRIVER_NAME] to odbcinst.ini..."
6262
echo "
6363
[$DRIVER_NAME]
6464
Description=An ODBC Driver for Apache Arrow Flight SQL
6565
Driver=$ODBC_64BIT
66-
" >>"$ODBCINST_FILE"
66+
" >>"$SYSTEM_ODBCINST_FILE"
6767
fi
6868

6969
# Check if [ODBC Drivers] section exists
70-
if grep -q '^\[ODBC Drivers\]' "$ODBCINST_FILE"; then
70+
if grep -q '^\[ODBC Drivers\]' "$SYSTEM_ODBCINST_FILE"; then
7171
# Section exists: check if driver entry exists
72-
if ! grep -q "^${DRIVER_NAME}=" "$ODBCINST_FILE"; then
72+
if ! grep -q "^${DRIVER_NAME}=" "$SYSTEM_ODBCINST_FILE"; then
7373
# Driver entry does not exist, add under [ODBC Drivers]
74-
sed -i '' "/^\[ODBC Drivers\]/a\\
75-
${DRIVER_NAME}=Installed
76-
" "$ODBCINST_FILE"
74+
75+
awk -v driver="$DRIVER_NAME" '
76+
$0 ~ /^\[ODBC Drivers\]/ && !inserted {
77+
print
78+
print driver "=Installed"
79+
inserted=1
80+
next
81+
}
82+
{ print }
83+
' "$SYSTEM_ODBCINST_FILE" > "${SYSTEM_ODBCINST_FILE}.tmp" && mv "${SYSTEM_ODBCINST_FILE}.tmp" "$SYSTEM_ODBCINST_FILE"
7784
fi
7885
else
7986
# Section doesn't exist, append both section and driver entry at end
8087
{
8188
echo ""
8289
echo "[ODBC Drivers]"
8390
echo "${DRIVER_NAME}=Installed"
84-
} >>"$ODBCINST_FILE"
91+
} >>"$SYSTEM_ODBCINST_FILE"
8592
fi

0 commit comments

Comments
 (0)