Upgrade to mysql2 0.5.5.

This commit is contained in:
Jarek Prokop 2024-01-19 15:45:17 +01:00 committed by root
parent b9b6db878d
commit eabe573dff
4 changed files with 75 additions and 6 deletions

2
.rubygem-mysql2.metadata Normal file
View File

@ -0,0 +1,2 @@
40bb98b39e2d8f3521c6a4350a66a3c0ac9e2dd9 mysql2-0.5.5.gem
e1f5106dda376545c654f64f0ea7b8609f03a220 mysql2-0.5.5-tests.txz

View File

@ -0,0 +1,29 @@
From 06512d47dc1491bf5686b2bd89a8555de9f2acc9 Mon Sep 17 00:00:00 2001
From: Jun Aruga <jaruga@redhat.com>
Date: Thu, 22 Dec 2022 16:14:39 +0100
Subject: [PATCH] Use the SSL pem files in the Git repository.
---
spec/mysql2/client_spec.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb
index 5861882..3f5cda8 100644
--- a/spec/mysql2/client_spec.rb
+++ b/spec/mysql2/client_spec.rb
@@ -154,9 +154,9 @@ RSpec.describe Mysql2::Client do # rubocop:disable Metrics/BlockLength
let(:option_overrides) do
{
'host' => 'mysql2gem.example.com', # must match the certificates
- :sslkey => '/etc/mysql/client-key.pem',
- :sslcert => '/etc/mysql/client-cert.pem',
- :sslca => '/etc/mysql/ca-cert.pem',
+ :sslkey => 'spec/ssl/client-key.pem',
+ :sslcert => 'spec/ssl/client-cert.pem',
+ :sslca => 'spec/ssl/ca-cert.pem',
:sslcipher => 'DHE-RSA-AES256-SHA',
:sslverify => true,
}
--
2.38.1

View File

@ -5,15 +5,18 @@
%global gem_name mysql2
Name: rubygem-%{gem_name}
Version: 0.5.4
Version: 0.5.5
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/
# cd mysql2 && git archive -v -o mysql2-0.5.5-tests.txz 0.5.5 spec/
Source1: %{gem_name}-%{version}-tests.txz
# Use the SSL pem files in the upstream repositry for the SSL tests.
# https://github.com/brianmario/mysql2/pull/1293
Patch0: rubygem-mysql2-0.5.4-use-ssl-pem-files-in-repo.patch
# Required in lib/mysql2.rb
Requires: rubygem(bigdecimal)
@ -32,6 +35,8 @@ BuildRequires: rubygem(bigdecimal)
# Comment out to prevent a build error by unsatisfiable dependencies.
# No matching package to install: 'rubygem(eventmachine)'
#BuildRequires: rubygem(eventmachine)
# Used in spec/ssl/gen_certs.sh
BuildRequires: %{_bindir}/openssl
%endif
%description
@ -52,6 +57,10 @@ Documentation for %{name}
%prep
%setup -q -n %{gem_name}-%{version} -b 1
pushd %{_builddir}/spec
%patch -P 0 -p2
popd
%build
gem build ../%{gem_name}-%{version}.gemspec
%gem_install
@ -77,6 +86,24 @@ pushd .%{gem_instdir}
ln -s %{_builddir}/spec spec
TOP_DIR=$(pwd)
# Regenerate the SSL certification files from the localhost, as we cannot set
# the host mysql2gem.example.com required for the SSL tests.
# https://github.com/brianmario/mysql2/pull/1296
sed -i '/host/ s/mysql2gem\.example\.com/localhost/' spec/mysql2/client_spec.rb
sed -i '/commonName_default/ s/mysql2gem\.example\.com/localhost/' spec/ssl/gen_certs.sh
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
@ -100,13 +127,20 @@ 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
# Reset password for the root user due to MariaDB 10.4 authentication change.
# See https://mariadb.com/kb/en/authentication-from-mariadb-104/#altering-the-user-account-to-revert-to-the-previous-authentication-method
@ -164,6 +198,10 @@ kill "$(cat "${MYSQL_TEST_PID_FILE}")"
%changelog
* 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

View File

@ -1,2 +1,2 @@
SHA512 (mysql2-0.5.4.gem) = 7852afe449f6931d0dc6ceba542a49280170af56c9f2f1fa369224e1633b6cbd03c1dfeae9d7b2c2c3e0e63fe6dd386b030e0249c9c9de1863476729490c1c9b
SHA512 (mysql2-0.5.4-tests.txz) = edb50d29b17175ce475975630f01b1771c4bc109bf79f33b4af76f8b5db29d86270023f0991f8cec729479cf5cb7ef1319200d248f57ead0a2991033ad333348
SHA512 (mysql2-0.5.5.gem) = a3865bf670c8fbb1942b631ff6eea8c26a9fa8b4d25da0faca84cb9d9c7c44eb98cd29ace83a62596eec0a522899b01044715e900d1389809b65e40fb09b258f
SHA512 (mysql2-0.5.5-tests.txz) = 0d6a81324a6466dafb859bb05e6cfc50e9758ead5cf7b50afea16f61568e0a2b9c17f22820aaa4c36c285abe00f855e87a3c7bd0934602cebbb98f299680a2c5