Upgrade to rubygem-mysql2 0.5.4.

Resolves: rhbz#2081426
This commit is contained in:
Jarek Prokop 2022-05-04 15:56:34 +02:00
parent 184bbedf20
commit e21b5b958a
4 changed files with 14 additions and 99 deletions

View File

@ -1,22 +0,0 @@
From cca57b97ad6d1b1b985376be110b89d2b487dea6 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@ruby-lang.org>
Date: Tue, 30 Nov 2021 12:59:43 -0800
Subject: [PATCH] fix assertion on maria
downgrade psych
---
spec/mysql2/client_spec.rb | 2 +-
diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb
index 1519e0f5d..41fb834bf 100644
--- a/spec/mysql2/client_spec.rb
+++ b/spec/mysql2/client_spec.rb
@@ -573,7 +573,7 @@ def run_gc
end
expect do
@client.query("SELECT SLEEP(1)")
- end.to raise_error(Mysql2::Error, /Lost connection to MySQL server/)
+ end.to raise_error(Mysql2::Error, /Lost connection/)
if RUBY_PLATFORM !~ /mingw|mswin/
expect do

View File

@ -1,38 +0,0 @@
From 4dce466f3ff1c90099d3dc1bf610bfab840d3631 Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@gmail.com>
Date: Fri, 26 Nov 2021 13:17:05 +0100
Subject: [PATCH] Update Mysql2::Result spec for Ruby 3.1
Ruby 3.1 immediately raise a TypeError if you try to
instantiate a class that doesn't have an allocator,
which is what we want anyways.
---
spec/mysql2/result_spec.rb | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/spec/mysql2/result_spec.rb b/spec/mysql2/result_spec.rb
index 47a4a6de..2af6e609 100644
--- a/spec/mysql2/result_spec.rb
+++ b/spec/mysql2/result_spec.rb
@@ -6,11 +6,16 @@
end
it "should raise a TypeError exception when it doesn't wrap a result set" do
- r = Mysql2::Result.new
- expect { r.count }.to raise_error(TypeError)
- expect { r.fields }.to raise_error(TypeError)
- expect { r.size }.to raise_error(TypeError)
- expect { r.each }.to raise_error(TypeError)
+ if RUBY_VERSION >= "3.1"
+ expect { Mysql2::Result.new }.to raise_error(TypeError)
+ expect { Mysql2::Result.allocate }.to raise_error(TypeError)
+ else
+ r = Mysql2::Result.new
+ expect { r.count }.to raise_error(TypeError)
+ expect { r.fields }.to raise_error(TypeError)
+ expect { r.size }.to raise_error(TypeError)
+ expect { r.each }.to raise_error(TypeError)
+ end
end
it "should have included Enumerable" do

View File

@ -5,8 +5,8 @@
%global gem_name mysql2
Name: rubygem-%{gem_name}
Version: 0.5.3
Release: 12%{?dist}
Version: 0.5.4
Release: 1%{?dist}
Summary: A simple, fast Mysql library for Ruby, binding to libmysql
License: MIT
URL: https://github.com/brianmario/mysql2
@ -14,15 +14,6 @@ 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
# Ruby 3.1 immediately raises a TypeError if you try to instantiate a class
# that doesn't have an allocator, which is desired behaviour anyways.
# https://github.com/brianmario/mysql2/pull/1219
# https://github.com/brianmario/mysql2/commit/62003225f3b25c36c221f01f7905658848895410
# Modified to allow patch application.
Patch1: rubygem-mysql2-0.5.3-update-Mysql2_Result-spec.patch
# Fix test assertion for mariadb-connector-c
# https://github.com/brianmario/mysql2/commit/cca57b97ad6d1b1b985376be110b89d2b487dea6
Patch2: rubygem-mysql2-0.5.3-fix-assertion-mariadb-connector-c.patch
# Required in lib/mysql2.rb
Requires: rubygem(bigdecimal)
@ -59,11 +50,6 @@ Documentation for %{name}
%prep
%setup -q -n %{gem_name}-%{version} -b 1
pushd %{_builddir}/spec
%patch1 -p2
%patch2 -p2
popd
%build
gem build ../%{gem_name}-%{version}.gemspec
%gem_install
@ -133,6 +119,12 @@ mysql -u root \
-S "${MYSQL_TEST_SOCKET}" \
-P "${MYSQL_TEST_PORT}"
# This GC method call is problematic on ppc64le builders, stalling the tests execution.
# https://github.com/brianmario/mysql2/issues/1261
%ifarch ppc64le
sed -i -e '/GC.verify_compaction_references/ s/^/#/' spec/spec_helper.rb
%endif
# See https://github.com/brianmario/mysql2/blob/master/tasks/rspec.rake
cat <<EOF > spec/configuration.yml
root:
@ -152,27 +144,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
# This test was passing when going through `rescue` branch up to MariaDB 10.4.
# It fails since MariaDB 10.5.2 instroduced Performance Schema.
# https://github.com/brianmario/mysql2/issues/1152
sed -i '/stmt_count/a\\ pending "Does not work with MariaDB"' \
spec/mysql2/statement_spec.rb
# Since MariaDB 10.5. the return error message contains mangled input.
# https://github.com/brianmario/mysql2/issues/1152
sed -i '/expect(bad_err.message).to include/ s/^/#/' spec/mysql2/error_spec.rb
rspec -Ilib:%{buildroot}%{gem_extdir_mri} -f d spec
popd
@ -197,6 +168,10 @@ kill "$(cat "${MYSQL_TEST_PID_FILE}")"
%changelog
* Wed May 04 2022 Jarek Prokop <jprokop@redhat.com> - 0.5.4-1
- Upgrade to rubygem-mysql2 0.5.4.
Resolves: rhbz#2081426
* Wed Apr 06 2022 Jun Aruga <jaruga@redhat.com> - 0.5.3-12
- Remove gem_make.out and mkmf.log files from the binary RPM package.

View File

@ -1,2 +1,2 @@
SHA512 (mysql2-0.5.3-tests.txz) = 2922835f0ad27b5f693cbc920ee239cfe206d2a9f529b43d8e2a700f31f690956adab4c350ce32a40dace5ffb9530d78807a224e33d22aa3a3b6c56a080fd235
SHA512 (mysql2-0.5.3.gem) = 59a0ee00261b09e8bbfc586a6f75af840a465a94fd8c9463a3d7767e5ea6b7e64507c9571fb90c6d0cdde3cfff560c97fbf3f3c32b3916aca852ef5c41e1bce9
SHA512 (mysql2-0.5.4.gem) = 7852afe449f6931d0dc6ceba542a49280170af56c9f2f1fa369224e1633b6cbd03c1dfeae9d7b2c2c3e0e63fe6dd386b030e0249c9c9de1863476729490c1c9b
SHA512 (mysql2-0.5.4-tests.txz) = edb50d29b17175ce475975630f01b1771c4bc109bf79f33b4af76f8b5db29d86270023f0991f8cec729479cf5cb7ef1319200d248f57ead0a2991033ad333348