New upstream release 0.5.2

This commit is contained in:
Jun Aruga 2018-04-23 18:07:04 +02:00
parent 1d20ba1b64
commit 38b9b71fae
6 changed files with 18 additions and 238 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/mysql2-0.4.4.gem /mysql2-0.4.4.gem
/mysql2-0.4.8.gem /mysql2-0.4.8.gem
/mysql2-0.4.10.gem /mysql2-0.4.10.gem
/mysql2-0.5.2.gem

View File

@ -1,15 +0,0 @@
diff --git a/spec/mysql2/statement_spec.rb b/spec/mysql2/statement_spec.rb
index 50b2e99..3db7886 100644
--- a/spec/mysql2/statement_spec.rb
+++ b/spec/mysql2/statement_spec.rb
@@ -731,7 +731,6 @@ RSpec.describe Mysql2::Statement do
it 'should return number of rows affected by an insert' do
stmt = @client.prepare 'INSERT INTO lastIdTest (blah) VALUES (?)'
- expect(stmt.affected_rows).to eq 0
stmt.execute 1
expect(stmt.affected_rows).to eq 1
end
--
2.14.3

View File

@ -1,162 +0,0 @@
From 235eaa482ce2cfa0dfbe1e4e7123d1a1f6bbf136 Mon Sep 17 00:00:00 2001
From: Jun Aruga <junaruga@users.noreply.github.com>
Date: Sat, 25 Nov 2017 20:10:10 +0100
Subject: [PATCH 1/2] Suppress Fixnum and Bignum warnings on Ruby 2.4. (#907)
---
spec/mysql2/client_spec.rb | 8 ++++----
spec/mysql2/result_spec.rb | 12 ++++++------
spec/mysql2/statement_spec.rb | 12 ++++++------
spec/spec_helper.rb | 4 ++++
4 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb
index dfb92a2..9de040b 100644
--- a/spec/mysql2/client_spec.rb
+++ b/spec/mysql2/client_spec.rb
@@ -572,7 +572,7 @@ RSpec.describe Mysql2::Client do
end
it "#socket should return a Fixnum (file descriptor from C)" do
- expect(@client.socket).to be_an_instance_of(Fixnum)
+ expect(@client.socket).to be_an_instance_of(0.class)
expect(@client.socket).not_to eql(0)
end
@@ -852,7 +852,7 @@ RSpec.describe Mysql2::Client do
info = @client.info
expect(info).to be_an_instance_of(Hash)
expect(info).to have_key(:id)
- expect(info[:id]).to be_an_instance_of(Fixnum)
+ expect(info[:id]).to be_an_instance_of(0.class)
expect(info).to have_key(:version)
expect(info[:version]).to be_an_instance_of(String)
end
@@ -883,7 +883,7 @@ RSpec.describe Mysql2::Client do
server_info = @client.server_info
expect(server_info).to be_an_instance_of(Hash)
expect(server_info).to have_key(:id)
- expect(server_info[:id]).to be_an_instance_of(Fixnum)
+ expect(server_info[:id]).to be_an_instance_of(0.class)
expect(server_info).to have_key(:version)
expect(server_info[:version]).to be_an_instance_of(String)
end
@@ -974,7 +974,7 @@ RSpec.describe Mysql2::Client do
end
it "#thread_id should be a Fixnum" do
- expect(@client.thread_id).to be_an_instance_of(Fixnum)
+ expect(@client.thread_id).to be_an_instance_of(0.class)
end
it "should respond to #ping" do
diff --git a/spec/mysql2/result_spec.rb b/spec/mysql2/result_spec.rb
index c8e26c5..e8ee8d0 100644
--- a/spec/mysql2/result_spec.rb
+++ b/spec/mysql2/result_spec.rb
@@ -204,7 +204,7 @@ RSpec.describe Mysql2::Result do
end
it "should return Fixnum for a TINYINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['tiny_int_test'].class)
+ expect(num_classes).to include(@test_result['tiny_int_test'].class)
expect(@test_result['tiny_int_test']).to eql(1)
end
@@ -248,27 +248,27 @@ RSpec.describe Mysql2::Result do
end
it "should return Fixnum for a SMALLINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['small_int_test'].class)
+ expect(num_classes).to include(@test_result['small_int_test'].class)
expect(@test_result['small_int_test']).to eql(10)
end
it "should return Fixnum for a MEDIUMINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['medium_int_test'].class)
+ expect(num_classes).to include(@test_result['medium_int_test'].class)
expect(@test_result['medium_int_test']).to eql(10)
end
it "should return Fixnum for an INT value" do
- expect([Fixnum, Bignum]).to include(@test_result['int_test'].class)
+ expect(num_classes).to include(@test_result['int_test'].class)
expect(@test_result['int_test']).to eql(10)
end
it "should return Fixnum for a BIGINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['big_int_test'].class)
+ expect(num_classes).to include(@test_result['big_int_test'].class)
expect(@test_result['big_int_test']).to eql(10)
end
it "should return Fixnum for a YEAR value" do
- expect([Fixnum, Bignum]).to include(@test_result['year_test'].class)
+ expect(num_classes).to include(@test_result['year_test'].class)
expect(@test_result['year_test']).to eql(2009)
end
diff --git a/spec/mysql2/statement_spec.rb b/spec/mysql2/statement_spec.rb
index e0fccad..50b2e99 100644
--- a/spec/mysql2/statement_spec.rb
+++ b/spec/mysql2/statement_spec.rb
@@ -372,7 +372,7 @@ RSpec.describe Mysql2::Statement do
end
it "should return Fixnum for a TINYINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['tiny_int_test'].class)
+ expect(num_classes).to include(@test_result['tiny_int_test'].class)
expect(@test_result['tiny_int_test']).to eql(1)
end
@@ -420,27 +420,27 @@ RSpec.describe Mysql2::Statement do
end
it "should return Fixnum for a SMALLINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['small_int_test'].class)
+ expect(num_classes).to include(@test_result['small_int_test'].class)
expect(@test_result['small_int_test']).to eql(10)
end
it "should return Fixnum for a MEDIUMINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['medium_int_test'].class)
+ expect(num_classes).to include(@test_result['medium_int_test'].class)
expect(@test_result['medium_int_test']).to eql(10)
end
it "should return Fixnum for an INT value" do
- expect([Fixnum, Bignum]).to include(@test_result['int_test'].class)
+ expect(num_classes).to include(@test_result['int_test'].class)
expect(@test_result['int_test']).to eql(10)
end
it "should return Fixnum for a BIGINT value" do
- expect([Fixnum, Bignum]).to include(@test_result['big_int_test'].class)
+ expect(num_classes).to include(@test_result['big_int_test'].class)
expect(@test_result['big_int_test']).to eql(10)
end
it "should return Fixnum for a YEAR value" do
- expect([Fixnum, Bignum]).to include(@test_result['year_test'].class)
+ expect(num_classes).to include(@test_result['year_test'].class)
expect(@test_result['year_test']).to eql(2009)
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 53c098a..045e783 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -36,6 +36,10 @@ RSpec.configure do |config|
end
end
+ def num_classes
+ 0.class == Integer ? [Integer] : [Fixnum, Bignum]
+ end
+
config.before :each do
@client = new_client
end
--
2.14.3

View File

@ -1,37 +0,0 @@
diff --git a/ext/mysql2/result.c b/ext/mysql2/result.c
index ccb49a5..67f75be 100644
--- a/ext/mysql2/result.c
+++ b/ext/mysql2/result.c
@@ -278,12 +278,12 @@ static void rb_mysql_result_alloc_result_buffers(VALUE self, MYSQL_FIELD *fields
wrapper->result_buffers[i].buffer_length = sizeof(signed char);
break;
case MYSQL_TYPE_SHORT: // short int
+ case MYSQL_TYPE_YEAR: // short int
wrapper->result_buffers[i].buffer = xcalloc(1, sizeof(short int));
wrapper->result_buffers[i].buffer_length = sizeof(short int);
break;
case MYSQL_TYPE_INT24: // int
case MYSQL_TYPE_LONG: // int
- case MYSQL_TYPE_YEAR: // int
wrapper->result_buffers[i].buffer = xcalloc(1, sizeof(int));
wrapper->result_buffers[i].buffer_length = sizeof(int);
break;
@@ -413,6 +413,7 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co
}
break;
case MYSQL_TYPE_SHORT: // short int
+ case MYSQL_TYPE_YEAR: // short int
if (result_buffer->is_unsigned) {
val = UINT2NUM(*((unsigned short int*)result_buffer->buffer));
} else {
@@ -421,7 +422,6 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co
break;
case MYSQL_TYPE_INT24: // int
case MYSQL_TYPE_LONG: // int
- case MYSQL_TYPE_YEAR: // int
if (result_buffer->is_unsigned) {
val = UINT2NUM(*((unsigned int*)result_buffer->buffer));
} else {
--
2.14.3

View File

@ -5,33 +5,25 @@
%global gem_name mysql2 %global gem_name mysql2
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Version: 0.4.10 Version: 0.5.2
Release: 5%{?dist} Release: 1%{?dist}
Summary: A simple, fast Mysql library for Ruby, binding to libmysql Summary: A simple, fast Mysql library for Ruby, binding to libmysql
License: MIT License: MIT
URL: http://github.com/brianmario/mysql2 URL: https://github.com/brianmario/mysql2
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Fix a client option local_infile not enabled # Fix a client option local_infile not enabled
# with mariadb-connector-c 3.0.2 on big endian environment. # with mariadb-connector-c on big endian environment.
# Temporary patch until mariadb-connector-c version 3.0.3 released. # We still needs this patch.
# https://github.com/brianmario/mysql2/pull/914 # https://github.com/brianmario/mysql2/pull/914
# https://github.com/MariaDB/mariadb-connector-c/commit/434b67e # https://github.com/MariaDB/mariadb-connector-c/commit/434b67e
Patch0: rubygem-mysql2-0.4.10-mariadb-connector-c-3.0.2-fix-wrong-local-infile-on-big-endian.patch Patch0: rubygem-mysql2-0.4.10-mariadb-connector-c-3.0.2-fix-wrong-local-infile-on-big-endian.patch
# Fix YEAR type wrong value on big endian environment.
# https://github.com/brianmario/mysql2/pull/921
Patch1: rubygem-mysql2-0.4.10-fix-wrong-type-year-value-on-big-endian.patch
# Suppress Fixnum and Bignum warnings on Ruby 2.4.
# https://github.com/brianmario/mysql2/commit/0e4fcc3
Patch2: rubygem-mysql2-0.4.10-Suppress-Fixnum-and-Bignum-warnings-on-Ruby2.4.patch
# Skip test to prepare statement and no query on MariaDB 10.2.
# https://github.com/brianmario/mysql2/commit/a2fadb6
Patch3: rubygem-mysql2-0.4.10-Skip-statement-and-no-query-test-on-MariaDB-10.2.patch
# Required in lib/mysql2.rb # Required in lib/mysql2.rb
Requires: rubygem(bigdecimal) Requires: rubygem(bigdecimal)
BuildRequires: ruby(release) BuildRequires: ruby(release)
BuildRequires: rubygems-devel BuildRequires: rubygems-devel
BuildRequires: ruby-devel BuildRequires: ruby-devel
BuildRequires: gcc
BuildRequires: mariadb-connector-c-devel BuildRequires: mariadb-connector-c-devel
%if %{with tests} %if %{with tests}
BuildRequires: mariadb-server BuildRequires: mariadb-server
@ -64,7 +56,6 @@ gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version} %setup -q -D -T -n %{gem_name}-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
@ -148,18 +139,17 @@ user:
socket: ${MYSQL_TEST_SOCKET} socket: ${MYSQL_TEST_SOCKET}
EOF EOF
cat "%{PATCH2}" | patch -p1
cat "%{PATCH3}" | patch -p1
# Comment out an issue (maybe test specified issue) for coredump or
# SystemStackError: stack level too deep.
sed -i '/^ it "returns error messages and sql state in Encoding.default_internal if set" do$/,/^ end$/ s/^/#/' \
spec/mysql2/error_spec.rb
# This test would require changes in host configuration. # This test would require changes in host configuration.
sed -i '/^ it "should be able to connect via SSL options" do$/,/^ end$/ s/^/#/' \ sed -i '/^ it "should be able to connect via SSL options" do$/,/^ end$/ s/^/#/' \
spec/mysql2/client_spec.rb 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 rspec -Ilib:%{buildroot}%{gem_extdir_mri} -f d spec
popd popd
@ -186,6 +176,9 @@ kill "$(cat "${MYSQL_TEST_PID_FILE}")"
%changelog %changelog
* Thu Jul 19 2018 Jun Aruga <jaruga@redhat.com> - 0.5.2-1
- New upstream release 0.5.2
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.10-5 * Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.10-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (mysql2-0.4.10.gem) = 1f9c8eb1b120cfc940b3aa26b2dff54735ccdf54fd6e6745e347179d29803b4a4d1f3b80a86f92dd534089f625ffcd6055458f27aaefebe58f8332890a842b43 SHA512 (mysql2-0.5.2.gem) = 6013b0c862f24f0c20b22c50a17390a7a22390e661d0f1afb613177febfbf854f63aea9bc9aa8defc9521896144fbc035a8e16b135abb47384453a23dfd99566