dev-db/myodbc: Version bump for testing

Package-Manager: Portage-2.3.6, Repoman-2.3.2
This commit is contained in:
Brian Evans
2017-06-09 14:58:51 -04:00
parent a8ee28f007
commit b9d30cc5bf
6 changed files with 413 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST mysql-connector-odbc-5.2.7-src.tar.gz 606472 SHA256 0ad8fcccb4c41c7100fe02ec0aa87938d33329d23f7b68d1b9031c87750392c9 SHA512 f54ac8a23ade71da85e1335e95eccdccfd68a8687d17a584ced103812bdc5aee8014769a84eaa22724bb2cb23d34c7188c964d3283723defeaef5157a4b3c60f WHIRLPOOL 928808ac5b623ec345c8c1b8495ca1de7f10e65f0d14720e9bee6ab154ccf818ca690745a57fa7fa1c008ba57b24705657398cd9146fbf2e385c178deca0e499
DIST mysql-connector-odbc-5.3.8-src.tar.gz 690403 SHA256 eca40e1ad359cd1d7e23b6692e60179c8e3daa66337e7a0232de4162664d9885 SHA512 4703deab548f2953a58421b20977ced8dfd197d5274f89dd9e080cebdf35da007e558d5d52b6b09109744eddc2905c834f1e3e2ac83df4249d069d5e14fd34ee WHIRLPOOL 9286058a7d57e13e9a2e683682d87e0226e0e451880a20579867b673144d69f7941fbe16706267ca2caa058b1aef15fb4516445af8ab164fb745cd81a0c2814f

View File

@@ -0,0 +1,43 @@
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt 2013-03-09 09:51:06 +0000
+++ b/CMakeLists.txt 2013-03-09 11:05:27 +0000
@@ -33,6 +33,12 @@
INCLUDE(version.cmake)
+IF(WITH_DOCUMENTATION_INSTALL_PATH)
+ set(DOCUMENTATION_INSTALL_PATH ${WITH_DOCUMENTATION_INSTALL_PATH})
+ELSE(WITH_DOCUMENTATION_INSTALL_PATH)
+ set(DOCUMENTATION_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/share/doc/myodbc-${CONNECTOR_MAJOR}.${CONNECTOR_MINOR})
+ENDIF(WITH_DOCUMENTATION_INSTALL_PATH)
+
#Default is to build both drivers
IF(UNICODE OR NOT ANSI)
MESSAGE(STATUS "Configuring to build Unicode driver")
@@ -329,19 +335,17 @@
ELSE(WIN32)
- INSTALL(FILES ChangeLog DESTINATION .)
- INSTALL(FILES README DESTINATION .)
- INSTALL(FILES README.debug DESTINATION .)
- INSTALL(FILES INSTALL DESTINATION .)
+ INSTALL(FILES ChangeLog DESTINATION ${DOCUMENTATION_INSTALL_PATH})
+ INSTALL(FILES README DESTINATION ${DOCUMENTATION_INSTALL_PATH})
+ INSTALL(FILES README.debug DESTINATION ${DOCUMENTATION_INSTALL_PATH})
+ INSTALL(FILES INSTALL DESTINATION ${DOCUMENTATION_INSTALL_PATH})
IF(EXISTS "${CMAKE_SOURCE_DIR}/COPYING")
- INSTALL(FILES COPYING DESTINATION .)
ELSE()
- INSTALL(FILES LICENSE.mysql DESTINATION .)
ENDIF()
ENDIF(WIN32)
-INSTALL(FILES Licenses_for_Third-Party_Components.txt DESTINATION .)
+INSTALL(FILES Licenses_for_Third-Party_Components.txt DESTINATION ${DOCUMENTATION_INSTALL_PATH})
INCLUDE(CPack)

View File

@@ -0,0 +1,43 @@
diff -aurN a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake
--- a/cmake/FindMySQL.cmake 2016-11-29 07:40:13.000000000 -0500
+++ b/cmake/FindMySQL.cmake 2017-02-17 13:59:18.115389096 -0500
@@ -747,7 +747,7 @@
endif()
if(NOT MYSQL_CXXFLAGS)
- if(MYSQL_CXX_LINKAGE OR MYSQL_VERSION_ID GREATER 50603)
+ if(MYSQL_CXX_LINKAGE)
_mysql_conf(MYSQL_CXXFLAGS "--cxxflags")
set(MYSQL_CXX_LINKAGE 1)
else()
diff -aurN a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2017-02-17 13:50:43.556006202 -0500
+++ b/CMakeLists.txt 2017-02-17 13:57:15.745676184 -0500
@@ -242,10 +242,9 @@
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
-SET(LIB_SUBDIR "lib")
-IF(RPM_BUILD AND CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|ppc64|ppc64p7|s390x|sparc64)")
- SET(LIB_SUBDIR "lib64")
-ENDIF()
+IF(NOT LIB_SUBDIR)
+ MESSAGE(ERROR "LIB_SUBDIR is not set")
+ENDIF(NOT LIB_SUBDIR)
MESSAGE(STATUS "Installation library subdir: ${LIB_SUBDIR}")
diff -aurN a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake
--- a/cmake/FindMySQL.cmake 2017-02-17 14:44:29.532733308 -0500
+++ b/cmake/FindMySQL.cmake 2017-02-17 14:48:56.756740330 -0500
@@ -270,8 +270,8 @@
set(_static_lib_ext ".lib") # Careful, can be import library for DLL
elseif(MYSQLCLIENT_NO_THREADS)
# In 5.1 and below there is a single threaded library
- set(_dynamic_libs "mysqlclient")
- set(_static_libs "libmysqlclient.a")
+ set(_dynamic_libs "${MYSQLCLIENT_LIB_NAME}")
+ set(_static_libs "lib${MYSQLCLIENT_LIB_NAME}.a")
set(_static_lib_ext ".a")
else()
# We try the multithreaded "libmysqlclient_r" first and if not

View File

@@ -0,0 +1,93 @@
diff -aurN a/driver/connect.c b/driver/connect.c
--- a/driver/connect.c 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/connect.c 2017-02-17 16:14:48.116640371 -0500
@@ -510,11 +510,11 @@
}
}
-#if MYSQL_VERSION_ID >= 50709
- mysql_get_option(mysql, MYSQL_OPT_NET_BUFFER_LENGTH, &dbc->net_buffer_length);
+#if MYSQL_VERSION_ID >= 50709 && !defined(MARIADB_BASE_VERSION)
+ mysql_get_option(mysql, MYSQL_OPT_NET_BUFFER_LENGTH, &dbc->net_buffer_length_value);
#else
// for older versions just use net_buffer_length() macro
- dbc->net_buffer_length = net_buffer_length;
+ dbc->net_buffer_length_value = net_buffer_length;
#endif
return rc;
diff -aurN a/driver/cursor.c b/driver/cursor.c
--- a/driver/cursor.c 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/cursor.c 2017-02-17 16:13:19.163299885 -0500
@@ -1485,7 +1485,7 @@
We have a limited capacity to shove data across the wire, but
we handle this by sending in multiple calls to exec_stmt_query()
*/
- if (ext_query->length + length >= (SQLULEN) stmt->dbc->net_buffer_length)
+ if (ext_query->length + length >= (SQLULEN) stmt->dbc->net_buffer_length_value)
{
break_insert= TRUE;
break;
diff -aurN a/driver/driver.h b/driver/driver.h
--- a/driver/driver.h 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/driver.h 2017-02-17 16:10:57.072950723 -0500
@@ -378,7 +378,7 @@
int txn_isolation;
uint port;
uint cursor_count;
- ulong net_buffer_length;
+ ulong net_buffer_length_value;
uint commit_flag;
#ifdef THREAD
myodbc_mutex_t lock;
diff -aurN a/driver/info.c b/driver/info.c
--- a/driver/info.c 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/info.c 2017-02-17 16:12:54.315763441 -0500
@@ -587,7 +587,7 @@
MYINFO_SET_USHORT(0);
case SQL_MAX_STATEMENT_LEN:
- MYINFO_SET_ULONG(dbc->net_buffer_length);
+ MYINFO_SET_ULONG(dbc->net_buffer_length_value);
case SQL_MAX_TABLE_NAME_LEN:
MYINFO_SET_USHORT(NAME_LEN);
diff -aurN a/driver/connect.c b/driver/connect.c
--- a/driver/connect.c 2017-02-17 16:16:14.609026769 -0500
+++ b/driver/connect.c 2017-02-17 16:34:29.637592664 -0500
@@ -179,7 +179,7 @@
/* Set other connection options */
if (ds->allow_big_results || ds->safe)
-#if MYSQL_VERSION_ID >= 50709
+#if MYSQL_VERSION_ID >= 50709 && !defined(MARIADB_BASE_VERSION)
mysql_options(mysql, MYSQL_OPT_MAX_ALLOWED_PACKET, &max_long);
#else
/* max_allowed_packet is a magical mysql macro. */
@@ -252,7 +252,7 @@
ds_get_utf8attr(ds->rsakey, &ds->rsakey8));
}
-#if MYSQL_VERSION_ID >= 50710
+#if MYSQL_VERSION_ID >= 50710 && !defined(MARIADB_BASE_VERSION)
{
char tls_options[128] = { 0 };
if (!ds->no_tls_1)
@@ -323,7 +323,7 @@
#endif
mysql->options.use_ssl = !ds->disable_ssl_default;
-#if MYSQL_VERSION_ID >= 50703
+#if MYSQL_VERSION_ID >= 50703 && !defined(MARIADB_BASE_VERSION)
{
if (ds->ssl_enforce)
{
@@ -332,7 +332,7 @@
}
#endif
-#if MYSQL_VERSION_ID >= 50711
+#if MYSQL_VERSION_ID >= 50711 && !defined(MARIADB_BASE_VERSION)
if (ds->sslmode)
{
unsigned int mode = 0;

View File

@@ -0,0 +1,96 @@
diff -aurN a/driver/catalog_no_i_s.c b/driver/catalog_no_i_s.c
--- a/driver/catalog_no_i_s.c 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/catalog_no_i_s.c 2017-02-17 14:07:03.979683613 -0500
@@ -1093,7 +1093,11 @@
unsigned long *lengths;
SQLRETURN rc= SQL_SUCCESS;
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 100001
+ myodbc_init_dynamic_array(&records, sizeof(MY_FOREIGN_KEY_FIELD), 0, 0, MYF(0));
+#else
myodbc_init_dynamic_array(&records, sizeof(MY_FOREIGN_KEY_FIELD), 0, 0);
+#endif
/* Get the list of tables that match szCatalog and szTable */
myodbc_mutex_lock(&stmt->dbc->lock);
diff -aurN a/driver/desc.c b/driver/desc.c
--- a/driver/desc.c 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/desc.c 2017-02-17 14:09:30.139954232 -0500
@@ -63,13 +63,21 @@
but in desc_get_rec we manually get a pointer to it. This avoids
having to call set_dynamic after modifying the DESCREC.
*/
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 100001
+ if (myodbc_init_dynamic_array(&desc->records, sizeof(DESCREC), 0, 0, MYF(0)))
+#else
if (myodbc_init_dynamic_array(&desc->records, sizeof(DESCREC), 0, 0))
+#endif
{
x_free((char *)desc);
return NULL;
}
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 100001
+ if (myodbc_init_dynamic_array(&desc->bookmark, sizeof(DESCREC), 0, 0, MYF(0)))
+#else
if (myodbc_init_dynamic_array(&desc->bookmark, sizeof(DESCREC), 0, 0))
+#endif
{
delete_dynamic(&desc->records);
x_free((char *)desc);
@@ -997,7 +1005,11 @@
delete_dynamic(&dest->records);
if (myodbc_init_dynamic_array(&dest->records, sizeof(DESCREC),
src->records.max_element,
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 100001
+ src->records.alloc_increment, MYF(0)))
+#else
src->records.alloc_increment))
+#endif
{
return set_desc_error(dest, "HY001",
"Memory allocation error",
diff -aurN a/driver/handle.c b/driver/handle.c
--- a/driver/handle.c 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/handle.c 2017-02-17 14:10:32.078797593 -0500
@@ -409,7 +409,11 @@
}
}
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 100001
+ myodbc_init_dynamic_array(*param_bind, sizeof(MYSQL_BIND), elements, 10, MYF(0));
+#else
myodbc_init_dynamic_array(*param_bind, sizeof(MYSQL_BIND), elements, 10);
+#endif
memset((*param_bind)->buffer, 0, sizeof(MYSQL_BIND) *
(*param_bind)->max_element);
diff -aurN a/driver/parse.c b/driver/parse.c
--- a/driver/parse.c 2016-11-29 07:40:13.000000000 -0500
+++ b/driver/parse.c 2017-02-17 14:12:00.638143846 -0500
@@ -139,8 +139,13 @@
/* TODO: Store offsets rather than ptrs. In this case we will be fine
if work with copy of the originally parsed string */
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 100001
+ myodbc_init_dynamic_array(&pq->token, sizeof(uint), 20, 10, MYF(0));
+ myodbc_init_dynamic_array(&pq->param_pos, sizeof(uint), 10, 10, MYF(0));
+#else
myodbc_init_dynamic_array(&pq->token, sizeof(uint), 20, 10);
myodbc_init_dynamic_array(&pq->param_pos, sizeof(uint), 10, 10);
+#endif
}
return pq;
diff -aurN a/MYODBC_MYSQL.h b/MYODBC_MYSQL.h
--- a/MYODBC_MYSQL.h 2016-11-29 07:40:13.000000000 -0500
+++ b/MYODBC_MYSQL.h 2017-02-17 15:04:47.153994839 -0500
@@ -44,7 +44,7 @@
#endif
#ifdef THREAD
-#if MYSQL_VERSION_ID < 50703
+#if MYSQL_VERSION_ID < 50703 || defined(MARIADB_BASE_VERSION)
#include <my_pthread.h>
#define myodbc_mutex_t pthread_mutex_t
#define myodbc_key_t pthread_key_t

View File

@@ -0,0 +1,137 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-multilib flag-o-matic versionator
MAJOR="$(get_version_component_range 1-2 $PV)"
MY_PN="mysql-connector-odbc"
MY_P="${MY_PN}-${PV/_p/r}-src"
DESCRIPTION="ODBC driver for MySQL"
HOMEPAGE="http://www.mysql.com/products/myodbc/"
SRC_URI="https://dev.mysql.com/get/Downloads/Connector-ODBC/${MAJOR}/${MY_P}.tar.gz"
LICENSE="GPL-2"
SLOT="${MAJOR}"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE=""
# Does not build with mysql-connector-c
RDEPEND="
dev-db/unixODBC[${MULTILIB_USEDEP}]
~virtual/libmysqlclient-18[${MULTILIB_USEDEP}]
abi_x86_32? (
!app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
)
!dev-db/mysql-connector-c
"
DEPEND="${RDEPEND}"
S=${WORKDIR}/${MY_P}
# Careful!
DRIVER_NAME="${PN}-${SLOT}"
# Patch document path so it doesn't install files to /usr
PATCHES=(
"${FILESDIR}/${MAJOR}-cmake-doc-path.patch"
"${FILESDIR}/${MAJOR}-cxxlinkage.patch"
"${FILESDIR}/${MAJOR}-mariadb-dynamic-array.patch"
"${FILESDIR}/5.2.7-my_malloc.patch"
"${FILESDIR}/${MAJOR}-mariadb-buffer_length.patch"
)
src_prepare() {
# Fix undefined references due to standards change
append-cflags -std=gnu89
# Remove Tests
sed -i -e "s/ADD_SUBDIRECTORY(test)//" \
"${S}/CMakeLists.txt"
# Fix as-needed on the installer binary
echo "TARGET_LINK_LIBRARIES(myodbc-installer odbc)" >> "${S}/installer/CMakeLists.txt"
default
}
multilib_src_configure() {
local clientlib
for clientlib in "mariadb" "perconaclient" "mysqlclient" "notfound" ; do
[[ -x "${EPREFIX}/usr/$(get_libdir)/lib${clientlib}.so" ]] && break
done
[[ "${clientlib}x" == "notfoundx" ]] && \
die "Installed client library name could not be determined"
# The RPM_BUILD flag does nothing except install to /usr/lib64 when "x86_64"
# MYSQL_CXX_LINKAGE expects "mysql_config --cxxflags" which doesn't exist on MariaDB
mycmakeargs+=(
-DMYSQL_CXX_LINKAGE=0
-DWITH_UNIXODBC=1
-DMYSQLCLIENT_LIB_NAME="${clientlib}"
-DWITH_DOCUMENTATION_INSTALL_PATH=/usr/share/doc/${PF}
-DMYSQL_LIB_DIR="${EPREFIX}/usr/$(get_libdir)"
-DLIB_SUBDIR="$(get_libdir)/${PN}-${MAJOR}"
-DMYSQL_INCLUDE_DIR="$(mysql_config --variable=pkgincludedir)"
-DMYSQLCLIENT_NO_THREADS=ON
-DDISABLE_GUI=ON
)
cmake-utils_src_configure
}
multilib_src_install_all() {
debug-print-function ${FUNCNAME} "$@"
dodir /usr/share/${PN}-${SLOT}
for i in odbc.ini odbcinst.ini; do
einfo "Building $i"
sed \
-e "s,__PN__,${DRIVER_NAME},g" \
-e "s,__PF__,${MAJOR},g" \
-e "s,libmyodbc3.so,libmyodbc${SLOT:0:1}a.so,g" \
>"${D}"/usr/share/${PN}-${SLOT}/${i} \
<"${FILESDIR}"/${i}.m4 \
|| die "Failed to build $i"
done;
mv "${D}/usr/bin/myodbc-installer" \
"${D}/usr/bin/myodbc-installer-${MAJOR}" || die "failed to move slotted binary"
}
pkg_config() {
[ "${ROOT}" != "/" ] && \
die 'Sorry, non-standard ROOT setting is not supported :-('
local msg='MySQL ODBC driver'
local drivers=$(/usr/bin/odbcinst -q -d)
if echo $drivers | grep -vq "^\[${DRIVER_NAME}\]$" ; then
ebegin "Installing ${msg}"
/usr/bin/odbcinst -i -d -f /usr/share/${PN}-${SLOT}/odbcinst.ini
rc=$?
eend $rc
[ $rc -ne 0 ] && die
else
einfo "Skipping already installed ${msg}"
fi
local sources=$(/usr/bin/odbcinst -q -s)
msg='sample MySQL ODBC DSN'
if echo $sources | grep -vq "^\[${DRIVER_NAME}-test\]$"; then
ebegin "Installing ${msg}"
/usr/bin/odbcinst -i -s -l -f /usr/share/${PN}-${SLOT}/odbc.ini
rc=$?
eend $rc
[ $rc -ne 0 ] && die
else
einfo "Skipping already installed ${msg}"
fi
}
pkg_postinst() {
elog "If this is a new install, please run the following command"
elog "to configure the MySQL ODBC drivers and sources:"
elog "emerge --config =${CATEGORY}/${PF}"
elog "Please note that the driver name used to form the DSN now includes the SLOT."
elog "The myodbc-install utility is installed as myodbc-install-${MAJOR}"
}