From 491a9f5875da1498316957cb4ebc72f3bb8396e6 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Thu, 30 May 2024 14:49:47 +0000 Subject: [PATCH] import UBI rubygem-mysql2-0.5.3-2.module+el8.10.0+21858+d19f3934 --- ...sql2-0.5.4-use-ssl-pem-files-in-repo.patch | 33 +++++++++++++ SPECS/rubygem-mysql2.spec | 49 ++++++++++++++++--- 2 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 SOURCES/rubygem-mysql2-0.5.4-use-ssl-pem-files-in-repo.patch diff --git a/SOURCES/rubygem-mysql2-0.5.4-use-ssl-pem-files-in-repo.patch b/SOURCES/rubygem-mysql2-0.5.4-use-ssl-pem-files-in-repo.patch new file mode 100644 index 0000000..8eb3527 --- /dev/null +++ b/SOURCES/rubygem-mysql2-0.5.4-use-ssl-pem-files-in-repo.patch @@ -0,0 +1,33 @@ +From 15607011344b4f38306befeeebae2fa906dc4860 Mon Sep 17 00:00:00 2001 +From: Jarek Prokop +Date: Fri, 8 Mar 2024 12:36:46 +0100 +Subject: [PATCH] Backport "Use the SSL pem files in the Git repository." to + 0.5.3. + +Backport patch from Fedora + +to resolve failing to start mariadb with SSL. +--- + 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 5a3b8a2..f2f7bec 100644 +--- a/spec/mysql2/client_spec.rb ++++ b/spec/mysql2/client_spec.rb +@@ -137,9 +137,9 @@ RSpec.describe Mysql2::Client do + ssl_client = nil + option_overrides = { + '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.43.0 + diff --git a/SPECS/rubygem-mysql2.spec b/SPECS/rubygem-mysql2.spec index 88cd46c..5a8f76f 100644 --- a/SPECS/rubygem-mysql2.spec +++ b/SPECS/rubygem-mysql2.spec @@ -6,7 +6,7 @@ Name: rubygem-%{gem_name} Version: 0.5.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A simple, fast Mysql library for Ruby, binding to libmysql License: MIT URL: https://github.com/brianmario/mysql2 @@ -14,6 +14,9 @@ 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 +# Use the SSL pem files in the upstream repositry for the SSL tests. +# https://github.com/brianmario/mysql2/pull/1293 +Patch3: 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 conflicting requests. # Nothing provides libruby.so.2.4()(64bit) needed by rubygem-eventmachine. #BuildRequires: rubygem(eventmachine) +# Used in spec/ssl/gen_certs.sh +BuildRequires: %{_bindir}/openssl %endif %description @@ -52,6 +57,9 @@ Documentation for %{name} %prep %setup -q -n %{gem_name}-%{version} -b 1 +pushd %{_builddir}/spec +%patch3 -p2 +popd %build # Create the gem as gem install only works on a gem file @@ -81,6 +89,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 @@ -104,15 +130,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,10 +170,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/^/#/' \ @@ -172,6 +201,10 @@ kill "$(cat "${MYSQL_TEST_PID_FILE}")" %changelog +* Fri Mar 08 2024 Jarek Prokop - 0.5.3-2 +- Fix SSL related test failure by backporting Fedora commit . + Related: RHEL-36189 + * Fri May 29 2020 Jun Aruga - 0.5.3-1 - New upstream release 0.5.3 by merging Fedora master branch (commit: 674d475) Resolves: rhbz#1817135