Compare commits

...

1 Commits

Author SHA1 Message Date
75a6d211c9 import CS rubygem-mysql2-0.5.7-1.module_el9+1318+36e679b0 2026-03-31 12:05:32 +00:00
3 changed files with 75 additions and 32 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/mysql2-0.5.3-tests.txz
SOURCES/mysql2-0.5.3.gem
SOURCES/mysql2-0.5.7-tests.tar.gz
SOURCES/mysql2-0.5.7.gem

View File

@ -1,2 +1,2 @@
efae18a40b17065bff7f04732e8165d64393531c SOURCES/mysql2-0.5.3-tests.txz
75e6935c4d9a2b1c047d9e9b69c4c6d4c7e0faef SOURCES/mysql2-0.5.3.gem
1b4014b12c63dcd7d1991ddab8c9915554771f90 SOURCES/mysql2-0.5.7-tests.tar.gz
54c8cb597be7c9431176f66e91006300ac4bd016 SOURCES/mysql2-0.5.7.gem

View File

@ -1,19 +1,25 @@
# build with tests?
# Disable tests for 32bit arch, mariadb-server
# needed for majority of the tests is not built for ix86
# https://gitlab.com/redhat/centos-stream/rpms/mariadb/-/blob/e7c71299403146a661255e2d50a74d789d083429/mariadb.spec#L2
%ifarch %{ix86}
%bcond_with tests
%else
%bcond_without tests
%endif
# Generated from mysql2-0.3.11.gem by gem2rpm -*- rpm-spec -*-
%global gem_name mysql2
Name: rubygem-%{gem_name}
Version: 0.5.3
Version: 0.5.7
Release: 1%{?dist}
Summary: A simple, fast Mysql library for Ruby, binding to libmysql
License: MIT
URL: https://github.com/brianmario/mysql2
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# git clone --no-checkout https://github.com/brianmario/mysql2.git
# cd mysql2 && git archive -v -o mysql2-0.5.3-tests.txz 0.5.3 spec/
Source1: %{gem_name}-%{version}-tests.txz
# cd mysql2 && git archive -v -o mysql2-0.5.7-tests.tar.gz 0.5.7 spec/
Source1: %{gem_name}-%{version}-tests.tar.gz
# Required in lib/mysql2.rb
Requires: rubygem(bigdecimal)
@ -28,10 +34,13 @@ BuildRequires: rubygem(rspec)
# Used in mysql_install_db
BuildRequires: %{_bindir}/hostname
BuildRequires: rubygem(bigdecimal)
# Used in spec/em/em_spec.rb
# Comment out to prevent a build error by conflicting requests.
# Nothing provides libruby.so.2.4()(64bit) needed by rubygem-eventmachine.
#BuildRequires: rubygem(eventmachine)
%if !0%{?rhel}
# Used in spec/em/em_spec.rb as optional dependency.
# If rubygem-eventmachine is not present, the tests in the file are skipped.
BuildRequires: rubygem(eventmachine)
%endif
# Used in spec/ssl/gen_certs.sh
BuildRequires: %{_bindir}/openssl
%endif
%description
@ -52,13 +61,10 @@ Documentation for %{name}
%prep
%setup -q -n %{gem_name}-%{version} -b 1
%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
CONFIGURE_ARGS="--without-mysql-rpath $CONFIGURE_ARGS"
%gem_install
@ -67,8 +73,9 @@ mkdir -p %{buildroot}%{gem_dir}
cp -pa .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{gem_extdir_mri}
cp -a .%{gem_extdir_mri}/* %{buildroot}%{gem_extdir_mri}/
mkdir -p %{buildroot}%{gem_extdir_mri}/%{gem_name}
cp -a .%{gem_extdir_mri}/gem.build_complete %{buildroot}%{gem_extdir_mri}/
cp -a .%{gem_extdir_mri}/%{gem_name}/*.so %{buildroot}%{gem_extdir_mri}/%{gem_name}
# Prevent dangling symlink in -debuginfo.
rm -rf %{buildroot}%{gem_instdir}/ext
@ -81,6 +88,24 @@ pushd .%{gem_instdir}
ln -s %{_builddir}/spec spec
TOP_DIR=$(pwd)
# Added in https://github.com/brianmario/mysql2/pull/1293
export TEST_RUBY_MYSQL2_SSL_CERT_DIR="${TOP_DIR}/spec/ssl"
# Added in https://github.com/brianmario/mysql2/pull/1310
export TEST_RUBY_MYSQL2_SSL_CERT_HOST=localhost
pushd spec/ssl
bash gen_certs.sh
popd
# See https://github.com/brianmario/mysql2/blob/master/ci/ssl.sh
echo "
[mysqld]
ssl-ca=${TOP_DIR}/spec/ssl/ca-cert.pem
ssl-cert=${TOP_DIR}/spec/ssl/server-cert.pem
ssl-key=${TOP_DIR}/spec/ssl/server-key.pem
" > ~/.my.cnf
# Use testing port because the standard mysqld port 3306 is occupied.
# Assign a random port to consider a case of multi builds in parallel in a host.
# https://src.fedoraproject.org/rpms/rubygem-pg/pull-request/3
@ -92,7 +117,9 @@ MYSQL_TEST_LOG="${TOP_DIR}/mysql.log"
MYSQL_TEST_PID_FILE="${TOP_DIR}/mysql.pid"
mkdir "${MYSQL_TEST_DATA_DIR}"
# See https://mariadb.com/kb/en/authentication-from-mariadb-10-4/#configuring-mariadb-install-db-to-revert-to-the-previous-authentication-method
mysql_install_db \
--auth-root-authentication-method=normal \
--datadir="${MYSQL_TEST_DATA_DIR}" \
--log-error="${MYSQL_TEST_LOG}"
@ -104,15 +131,22 @@ mysql_install_db \
--port="${MYSQL_TEST_PORT}" \
--ssl &
conn_found=false
for i in $(seq 10); do
echo "Waiting for the DB server to accept connections... ${i}"
sleep 1
if grep -q 'ready for connections.' "${MYSQL_TEST_LOG}"; then
if grep -q 'ready for connections' "${MYSQL_TEST_LOG}"; then
conn_found=true
break
fi
echo "Waiting connections... ${i}"
done
if ! "${conn_found}"; then
echo "ERROR: Failed to connect the DB server."
cat "${MYSQL_TEST_LOG}"
exit 1
fi
# See https://github.com/brianmario/mysql2/blob/master/.travis_setup.sh
# See https://github.com/brianmario/mysql2/blob/master/ci/setup.sh
mysql -u root \
-e 'CREATE DATABASE /*M!50701 IF NOT EXISTS */ test' \
-S "${MYSQL_TEST_SOCKET}" \
@ -137,17 +171,6 @@ user:
socket: ${MYSQL_TEST_SOCKET}
EOF
# This test would require changes in host configuration.
sed -i '/^ it "should be able to connect via SSL options" do$/,/^ end$/ s/^/#/' \
spec/mysql2/client_spec.rb
# performance_schema.session_account_connect_attrs is unexpectedly empty.
# https://github.com/brianmario/mysql2/issues/965
sed -i '/^ it "should set default program_name in connect_attrs" do$/,/^ end$/ s/^/#/' \
spec/mysql2/client_spec.rb
sed -i '/^ it "should set custom connect_attrs" do$/,/^ end$/ s/^/#/' \
spec/mysql2/client_spec.rb
rspec -Ilib:%{buildroot}%{gem_extdir_mri} -f d spec
popd
@ -172,6 +195,26 @@ kill "$(cat "${MYSQL_TEST_PID_FILE}")"
%changelog
* Mon Jan 19 2026 Jarek Prokop <jprokop@redhat.com> - 0.5.7-1
- Upgrade to mysql2 0.5.7.
Related: RHEL-142278
* Wed Jul 23 2025 Jarek Prokop <jprokop@redhat.com> - 0.5.5-3
- Disable tests on the 32bit platforms ix86.
Related: RHEL-80222
* Fri Feb 09 2024 Jarek Prokop <jprokop@redhat.com> - 0.5.5-2
- Adapt tests to openssl 3.2
Resolves: RHEL-80222
* Fri Jan 19 2024 Jarek Prokop <jprokop@redhat.com> - 0.5.5-1
- Upgrade to mysql2 0.5.5.
Related: RHEL-17089
* Mon May 23 2022 Jarek Prokop <jprokop@redhat.com> - 0.5.4-1
- New upstream release 0.5.4 by merging Fedora rawhide branch (commit: e21b5b9)
Resolves: rhbz#2063773
* Fri May 29 2020 Jun Aruga <jaruga@redhat.com> - 0.5.3-1
- New upstream release 0.5.3 by merging Fedora master branch (commit: 674d475)
Resolves: rhbz#1817135