Skip to content

Commit c61dc09

Browse files
isrgomeznmariz
authored andcommitted
WL14110: Include authentication_ldap_sasl_client plugin file
1 parent ba8c825 commit c61dc09

File tree

3 files changed

+42
-117
lines changed

3 files changed

+42
-117
lines changed

cpydist/__init__.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class BaseCommand(Command):
128128
build_base = None
129129
log = LOGGER
130130
vendor_folder = os.path.join("lib", "mysql", "vendor")
131-
private_folder = os.path.join("lib", "mysql", "private")
132131

133132
_mysql_info = {}
134133
_build_mysql_lib_dir = None
@@ -168,8 +167,7 @@ def finalize_options(self):
168167
cmd_build_ext.extra_compile_args = self.extra_compile_args
169168
cmd_build_ext.extra_link_args = self.extra_link_args
170169

171-
if os.name == "posix":
172-
self._copy_vendor_libraries()
170+
self._copy_vendor_libraries()
173171

174172
def remove_temp(self):
175173
"""Remove temporary build files."""
@@ -179,9 +177,6 @@ def remove_temp(self):
179177
vendor_folder = os.path.join(os.getcwd(), self.vendor_folder)
180178
if os.path.exists(vendor_folder):
181179
remove_tree(vendor_folder)
182-
private_folder = os.path.join(os.getcwd(), self.private_folder)
183-
if os.path.exists(private_folder):
184-
remove_tree(private_folder)
185180
elif os.name == "nt":
186181
if ARCH == "64-bit":
187182
libraries = ["libmysql.dll", "libssl-1_1-x64.dll",
@@ -208,11 +203,12 @@ def _get_openssl_libs(self):
208203
def _copy_vendor_libraries(self):
209204
vendor_libs = []
210205

211-
# Bundle OpenSSL libs
212-
if self.with_openssl_lib_dir:
213-
libssl, libcrypto = self._get_openssl_libs()
214-
vendor_libs.append(
215-
(self.with_openssl_lib_dir, [libssl, libcrypto]))
206+
if os.name == "posix":
207+
# Bundle OpenSSL libs
208+
if self.with_openssl_lib_dir:
209+
libssl, libcrypto = self._get_openssl_libs()
210+
vendor_libs.append(
211+
(self.with_openssl_lib_dir, [libssl, libcrypto]))
216212

217213
# Plugins
218214
bundle_plugin_libs = False
@@ -222,7 +218,9 @@ def _copy_vendor_libraries(self):
222218
plugin_name = ("authentication_ldap_sasl_client.{}"
223219
"".format(plugin_ext))
224220

225-
if os.path.exists(plugin_name):
221+
self.log.debug("ldap plugin_path: '{}'".format(
222+
os.path.join(plugin_path, plugin_name)))
223+
if os.path.exists(os.path.join(plugin_path, plugin_name)):
226224
bundle_plugin_libs = True
227225
vendor_libs.append(
228226
(plugin_path, [plugin_name]))
@@ -274,10 +272,7 @@ def _copy_vendor_libraries(self):
274272
sasl_plugin_libs.append(os.path.basename(lib_path_entry))
275273
sasl_libs.append((sasl_libs_path, sasl_plugin_libs))
276274

277-
if not os.path.exists(os.path.join(self.private_folder)):
278-
mkpath(os.path.join(os.getcwd(), self.private_folder))
279-
280-
# Copy vendor libraries to 'mysql/private' folder
275+
# Copy vendor libraries to 'mysql/vendor' folder
281276
self.log.info("Copying vendor libraries")
282277
for src_folder, files in sasl_libs:
283278
self.log.info("Copying folder: %s", src_folder)
@@ -286,8 +281,7 @@ def _copy_vendor_libraries(self):
286281
if not os.path.exists(src):
287282
self.log.warn("Library not found: %s", src)
288283
continue
289-
dst = os.path.join(os.getcwd(),
290-
os.path.join(self.private_folder))
284+
dst = os.path.join(os.getcwd(), self.vendor_folder)
291285
self.log.info("copying %s -> %s", src, dst)
292286
shutil.copy(src, dst)
293287

@@ -298,8 +292,7 @@ def _copy_vendor_libraries(self):
298292
if not os.path.exists(sasl2_libs_path):
299293
self.log.info("sasl2 llibraries not found at %s",
300294
sasl2_libs_path)
301-
self.distribution.package_data = {
302-
"mysql": ["vendor/*", "private/*"]}
295+
self.distribution.package_data = {"mysql": ["vendor/*"]}
303296
return
304297
sasl2_libs_w = [
305298
"libanonymous.*", "libcrammd5.*.*", "libdigestmd5.*.*.*.*",
@@ -319,8 +312,8 @@ def _copy_vendor_libraries(self):
319312

320313
sasl2_libs.append((sasl2_libs_path, sasl2_scram_libs))
321314

322-
if not os.path.exists(os.path.join(self.private_folder, "sasl2")):
323-
mkpath(os.path.join(os.getcwd(), self.private_folder, "sasl2"))
315+
if not os.path.exists(os.path.join(self.vendor_folder, "sasl2")):
316+
mkpath(os.path.join(os.getcwd(), self.vendor_folder, "sasl2"))
324317

325318
# Copy vendor libraries to 'mysql/vendor/sasl2' folder
326319
self.log.info("Copying vendor libraries")
@@ -329,15 +322,16 @@ def _copy_vendor_libraries(self):
329322
for filename in files:
330323
src = os.path.join(src_folder, filename)
331324
if not os.path.exists(src):
332-
self.log.warn("Library not found: %s", src)
325+
self.log.warning("Library not found: %s", src)
333326
continue
334-
dst = os.path.join(os.getcwd(),
335-
os.path.join(self.private_folder, "sasl2"))
327+
dst = os.path.join(
328+
os.getcwd(),
329+
os.path.join(self.vendor_folder, "sasl2"))
336330
self.log.info("copying %s -> %s", src, dst)
337331
shutil.copy(src, dst)
338332

339333
self.distribution.package_data = {
340-
"mysql": ["vendor/*", "private/*", "private/sasl2/*"]}
334+
"mysql": ["vendor/*", "vendor/sasl2/*"]}
341335

342336

343337
class BuildExt(build_ext, BaseCommand):

cpydist/data/deb/rules

Lines changed: 22 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
# along with this program; if not, write to the Free Software Foundation, Inc.,
3030
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3131

32+
export DH_VERBOSE = 1
33+
3234
PY2_BUILD_LIB_OPT = --build-lib=build/python2
3335
PY3_BUILD_LIB_OPT = --build-lib=build/python3
3436

@@ -89,79 +91,20 @@ PYTHON2_SUPPORTED=$(shell pyversions -sv | sed -e "s/\s*2\.5\s*//g")
8991
%:
9092
dh $@ $(EXTRA_OPTIONS_DH)
9193

92-
override_dh_auto_build:
93-
# Python v2
94-
set -xe; \
95-
for pyver in $(PYTHON2_SUPPORTED); \
96-
do \
97-
python$$pyver setup.py build \
98-
--build-base=build \
99-
$(PY2_BUILD_LIB_OPT) \
100-
--build-platlib=build/python2; \
101-
done
102-
103-
# Python v2 C Extension
104-
if [ -n "$(WITH_CEXT)" ]; then \
105-
set -xe; \
106-
for pyver in $(PYTHON2_SUPPORTED); \
107-
do \
108-
python$$pyver setup.py build_ext \
109-
--build-lib=build/python2_cext \
110-
--with-mysql-capi=$(MYSQL_CAPI) \
111-
--with-protobuf-include-dir=$(MYSQLXPB_PROTOBUF_INCLUDE_DIR) \
112-
--with-protobuf-lib-dir=$(MYSQLXPB_PROTOBUF_LIB_DIR) \
113-
--with-protoc=$(MYSQLXPB_PROTOC) \
114-
--extra-compile-args="$(EXTRA_COMPILE_ARGS)" \
115-
--extra-link-args="$(EXTRA_LINK_ARGS)" $(OPENSSL_OPT); \
116-
done; \
117-
fi
118-
119-
# Python v3
120-
set -xe; \
121-
for pyver in $(PYTHON3_SUPPORTED); \
122-
do \
123-
python$$pyver setup.py build \
124-
--build-base=build \
125-
$(PY3_BUILD_LIB_OPT) \
126-
--build-platlib=build/python3; \
127-
done
128-
129-
# Python v3 C Extension
130-
if [ -n "$(WITH_CEXT)" ]; then \
131-
set -xe; \
132-
for pyver in $(PYTHON3_SUPPORTED); \
133-
do \
134-
python$$pyver setup.py build_ext \
135-
--build-lib=build/python3_cext \
136-
--with-mysql-capi=$(MYSQL_CAPI) \
137-
--with-protobuf-include-dir=$(MYSQLXPB_PROTOBUF_INCLUDE_DIR) \
138-
--with-protobuf-lib-dir=$(MYSQLXPB_PROTOBUF_LIB_DIR) \
139-
--with-protoc=$(MYSQLXPB_PROTOC) \
140-
--extra-compile-args="$(EXTRA_COMPILE_ARGS)" \
141-
--extra-link-args="$(EXTRA_LINK_ARGS)" $(OPENSSL_OPT); \
142-
done; \
143-
fi
144-
14594
override_dh_auto_install:
14695
# Python v2
14796
set -xe; \
14897
DESTDIR=$(CURDIR)/debian/mysql-connector-python$(LIC_EXT); \
14998
for pyver in $(PYTHON2_SUPPORTED); \
150-
do \
151-
python$$pyver setup.py \
152-
install_lib --build-dir=build/python2 $(EXTRA_INSTALL_LIB_OPTS) \
153-
install --skip-build --install-layout=deb \
154-
--root $$DESTDIR $(BYTE_CODE_ONLY); \
155-
done
156-
157-
# Python v2 C Extension
158-
set -xe; \
159-
DESTDIR=$(CURDIR)/debian/mysql-connector-python$(LIC_EXT); \
160-
for pyver in $(PYTHON2_SUPPORTED); \
16199
do \
162100
python$$pyver setup.py \
163-
install_lib --build-dir=build/python2_cext $(EXTRA_INSTALL_LIB_OPTS) \
164-
install --skip-build --install-layout=deb \
101+
install --install-layout=deb \
102+
--with-mysql-capi=$(MYSQL_CAPI) \
103+
--with-protobuf-include-dir=$(MYSQLXPB_PROTOBUF_INCLUDE_DIR) \
104+
--with-protobuf-lib-dir=$(MYSQLXPB_PROTOBUF_LIB_DIR) \
105+
--with-protoc=$(MYSQLXPB_PROTOC) \
106+
--extra-compile-args="$(EXTRA_COMPILE_ARGS)" \
107+
--extra-link-args="$(EXTRA_LINK_ARGS)" $(OPENSSL_OPT) \
165108
--root $$DESTDIR $(BYTE_CODE_ONLY); \
166109
find $$DESTDIR -name 'mysql_connector_*.egg-info' -prune -exec rm -rf {} \;; \
167110
done
@@ -172,23 +115,23 @@ override_dh_auto_install:
172115
for pyver in $(PYTHON3_SUPPORTED); \
173116
do \
174117
python$$pyver setup.py \
175-
install_lib --build-dir=build/python3 $(EXTRA_INSTALL_LIB_OPTS) \
176-
install --skip-build --install-layout=deb \
177-
--root $$DESTDIR $(BYTE_CODE_ONLY); \
178-
done
179-
180-
# Python v3 C Extension
181-
set -xe; \
182-
DESTDIR=$(CURDIR)/debian/mysql-connector-python$(LIC_EXT)-py3; \
183-
for pyver in $(PYTHON3_SUPPORTED); \
184-
do \
185-
python$$pyver setup.py \
186-
install_lib --build-dir=build/python3_cext $(EXTRA_INSTALL_LIB_OPTS) \
187-
install --skip-build --install-layout=deb \
118+
install --install-layout=deb \
119+
--with-mysql-capi=$(MYSQL_CAPI) \
120+
--with-protobuf-include-dir=$(MYSQLXPB_PROTOBUF_INCLUDE_DIR) \
121+
--with-protobuf-lib-dir=$(MYSQLXPB_PROTOBUF_LIB_DIR) \
122+
--with-protoc=$(MYSQLXPB_PROTOC) \
123+
--extra-compile-args="$(EXTRA_COMPILE_ARGS)" \
124+
--extra-link-args="$(EXTRA_LINK_ARGS)" $(OPENSSL_OPT) \
188125
--root $$DESTDIR $(BYTE_CODE_ONLY); \
189126
find $$DESTDIR -name 'mysql_connector_*.egg-info' -prune -exec rm -rf {} \;; \
190127
done
191128

129+
override_dh_python2:
130+
dh_python2 --no-ext-rename
131+
132+
override_dh_python3:
133+
dh_python3 --no-ext-rename
134+
192135
ifeq ($(BYTE_CODE_ONLY), --byte-code-only)
193136
override_dh_pysupport:
194137
# Skipped. We need to keep the .pyc files.

cpydist/data/rpm/mysql-connector-python.spec

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,27 +241,15 @@ EXTRA_LINK_ARGS=""
241241

242242
rm -rf %{buildroot}
243243

244-
# skip-build is broken
245-
246244
%{__python2} setup.py ${COMMON_INSTALL_ARGS} \
247245
--extra-compile-args="${EXTRA_COMPILE_ARGS}" \
248246
--extra-link-args="${EXTRA_LINK_ARGS}" \
249247
--with-mysql-capi=%{with_mysql_capi} %{?byte_code_only}
250-
rm -rf %{buildroot}%{python2_sitearch}/mysql
251-
rm -rf %{buildroot}%{python2_sitearch}/mysqlx
252-
%{__python2} setup.py ${COMMON_INSTALL_ARGS} \
253-
--extra-compile-args="${EXTRA_COMPILE_ARGS}" \
254-
--extra-link-args="${EXTRA_LINK_ARGS}" %{?byte_code_only}
255248
pushd %{py3dir}
256249
%{__python3} setup.py ${COMMON_INSTALL_ARGS} \
257250
--extra-compile-args="${EXTRA_COMPILE_ARGS}" \
258251
--extra-link-args="${EXTRA_LINK_ARGS}" \
259252
--with-mysql-capi=%{with_mysql_capi} %{?byte_code_only}
260-
rm -rf %{buildroot}%{python3_sitearch}/mysql
261-
rm -rf %{buildroot}%{python3_sitearch}/mysqlx
262-
%{__python3} setup.py ${COMMON_INSTALL_ARGS} \
263-
--extra-compile-args="${EXTRA_COMPILE_ARGS}" \
264-
--extra-link-args="${EXTRA_LINK_ARGS}" %{?byte_code_only}
265253
popd
266254

267255
%clean

0 commit comments

Comments
 (0)