|
|
5d599d |
%{?scl:%scl_package rubygem-%{gem_name}}
|
|
|
5d599d |
%{!?scl:%global pkg_name %{name}}
|
|
|
5d599d |
|
|
|
5d599d |
# Enable test. This includes RSpec into sources.
|
|
|
5d599d |
%bcond_with tests
|
|
|
5d599d |
|
|
|
5d599d |
# Generated from mysql2-0.3.11.gem by gem2rpm -*- rpm-spec -*-
|
|
|
5d599d |
%global gem_name mysql2
|
|
|
5d599d |
|
|
|
5d599d |
Name: %{?scl_prefix}rubygem-%{gem_name}
|
|
|
5d599d |
Version: 0.5.3
|
|
|
5d599d |
Release: 2%{?dist}
|
|
|
5d599d |
Summary: A simple, fast Mysql library for Ruby, binding to libmysql
|
|
|
5d599d |
License: MIT
|
|
|
5d599d |
URL: https://github.com/brianmario/mysql2
|
|
|
5d599d |
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
|
|
5d599d |
# git clone --no-checkout https://github.com/brianmario/mysql2.git
|
|
|
5d599d |
# cd mysql2 && git archive -v -o mysql2-0.5.3-tests.txz 0.5.3 spec/
|
|
|
5d599d |
Source1: %{gem_name}-%{version}-tests.txz
|
|
|
5d599d |
# Sources of RSpec for interanl tests. Don't import these.
|
|
|
5d599d |
%if %{with tests}
|
|
|
5d599d |
Source200: https://rubygems.org/gems/diff-lcs-1.3.gem
|
|
|
5d599d |
Source201: https://rubygems.org/gems/rspec-3.7.0.gem
|
|
|
5d599d |
Source202: https://rubygems.org/gems/rspec-core-3.7.0.gem
|
|
|
5d599d |
Source203: https://rubygems.org/gems/rspec-expectations-3.7.0.gem
|
|
|
5d599d |
Source204: https://rubygems.org/gems/rspec-mocks-3.7.0.gem
|
|
|
5d599d |
Source205: https://rubygems.org/gems/rspec-support-3.7.0.gem
|
|
|
5d599d |
%endif
|
|
|
5d599d |
# Fix a client option local_infile not enabled
|
|
|
5d599d |
# with mariadb-connector-c on big endian environment.
|
|
|
5d599d |
# We still needs this patch.
|
|
|
5d599d |
# https://github.com/brianmario/mysql2/pull/914
|
|
|
5d599d |
# https://github.com/MariaDB/mariadb-connector-c/commit/434b67e
|
|
|
5d599d |
Patch0: rubygem-mysql2-0.4.10-mariadb-connector-c-3.0.2-fix-wrong-local-infile-on-big-endian.patch
|
|
|
5d599d |
|
|
|
5d599d |
# Required in lib/mysql2.rb
|
|
|
5d599d |
Requires: %{?scl_prefix}rubygem(bigdecimal)
|
|
|
5d599d |
BuildRequires: %{?scl_prefix}ruby(release)
|
|
|
5d599d |
BuildRequires: %{?scl_prefix}rubygems-devel
|
|
|
5d599d |
BuildRequires: %{?scl_prefix}ruby-devel
|
|
|
5d599d |
BuildRequires: gcc
|
|
|
5d599d |
BuildRequires: mariadb-devel
|
|
|
5d599d |
%if %{with tests}
|
|
|
5d599d |
BuildRequires: mariadb-server
|
|
|
5d599d |
# Used in mysql_install_db
|
|
|
5d599d |
BuildRequires: hostname
|
|
|
5d599d |
BuildRequires: %{?scl_prefix}rubygem(bigdecimal)
|
|
|
5d599d |
# Used in spec/em/em_spec.rb
|
|
|
5d599d |
#BuildRequires: %%{?scl_prefix}rubygem(eventmachine)
|
|
|
5d599d |
%endif
|
|
|
5d599d |
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
|
|
|
5d599d |
|
|
|
5d599d |
%description
|
|
|
5d599d |
The Mysql2 gem is meant to serve the extremely common use-case of
|
|
|
5d599d |
connecting, querying and iterating on results. Some database libraries
|
|
|
5d599d |
out there serve as direct 1:1 mappings of the already complex C API\'s
|
|
|
5d599d |
available. This one is not.
|
|
|
5d599d |
|
|
|
5d599d |
|
|
|
5d599d |
%package doc
|
|
|
5d599d |
Summary: Documentation for %{pkg_name}
|
|
|
5d599d |
Requires: %{?scl_prefix}%{pkg_name} = %{version}-%{release}
|
|
|
5d599d |
BuildArch: noarch
|
|
|
5d599d |
|
|
|
5d599d |
%description doc
|
|
|
5d599d |
Documentation for %{pkg_name}
|
|
|
5d599d |
|
|
|
5d599d |
%prep
|
|
|
5d599d |
%{?scl:scl enable %{scl} - << \EOF}
|
|
|
5d599d |
set -ex
|
|
|
5d599d |
gem unpack %{SOURCE0}
|
|
|
5d599d |
|
|
|
5d599d |
%setup -q -D -T -n %{gem_name}-%{version} -b 1
|
|
|
5d599d |
|
|
|
5d599d |
%patch0 -p1
|
|
|
5d599d |
|
|
|
5d599d |
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
|
|
5d599d |
%{?scl:EOF}
|
|
|
5d599d |
|
|
|
5d599d |
%build
|
|
|
5d599d |
%{?scl:scl enable %{scl} - << \EOF}
|
|
|
5d599d |
set -ex
|
|
|
5d599d |
# Create the gem as gem install only works on a gem file
|
|
|
5d599d |
gem build %{gem_name}.gemspec
|
|
|
5d599d |
|
|
|
5d599d |
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
|
|
|
5d599d |
# by default, so that we can move it into the buildroot in %%install
|
|
|
5d599d |
%gem_install
|
|
|
5d599d |
%{?scl:EOF}
|
|
|
5d599d |
|
|
|
5d599d |
|
|
|
5d599d |
%install
|
|
|
5d599d |
mkdir -p %{buildroot}%{gem_dir}
|
|
|
5d599d |
cp -pa .%{gem_dir}/* \
|
|
|
5d599d |
%{buildroot}%{gem_dir}/
|
|
|
5d599d |
|
|
|
5d599d |
mkdir -p %{buildroot}%{gem_extdir_mri}
|
|
|
5d599d |
cp -a .%{gem_extdir_mri}/* %{buildroot}%{gem_extdir_mri}/
|
|
|
5d599d |
|
|
|
5d599d |
# Prevent dangling symlink in -debuginfo.
|
|
|
5d599d |
rm -rf %{buildroot}%{gem_instdir}/ext
|
|
|
5d599d |
|
|
|
5d599d |
|
|
|
5d599d |
%if %{with tests}
|
|
|
5d599d |
%check
|
|
|
5d599d |
%{?scl:scl enable %{scl} - << \EOF}
|
|
|
5d599d |
set -ex
|
|
|
5d599d |
pushd .%{gem_instdir}
|
|
|
5d599d |
# Move the tests into place
|
|
|
5d599d |
ln -s %{_builddir}/spec spec
|
|
|
5d599d |
|
|
|
5d599d |
pushd %{_sourcedir}
|
|
|
5d599d |
gem install rspec*.gem --local --no-document
|
|
|
5d599d |
popd
|
|
|
5d599d |
# Export path with locally installed rspec executable.
|
|
|
5d599d |
export PATH="~/bin:${PATH}"
|
|
|
5d599d |
|
|
|
5d599d |
TOP_DIR=$(pwd)
|
|
|
5d599d |
# Use testing port because the standard mysqld port 3306 is occupied.
|
|
|
5d599d |
# Assign a random port to consider a case of multi builds in parallel in a host.
|
|
|
5d599d |
# https://src.fedoraproject.org/rpms/rubygem-pg/pull-request/3
|
|
|
5d599d |
MYSQL_TEST_PORT="$((13306 + ${RANDOM} % 1000))"
|
|
|
5d599d |
MYSQL_TEST_USER=$(id -un)
|
|
|
5d599d |
MYSQL_TEST_DATA_DIR="${TOP_DIR}/data"
|
|
|
5d599d |
MYSQL_TEST_SOCKET="${TOP_DIR}/mysql.sock"
|
|
|
5d599d |
MYSQL_TEST_LOG="${TOP_DIR}/mysql.log"
|
|
|
5d599d |
MYSQL_TEST_PID_FILE="${TOP_DIR}/mysql.pid"
|
|
|
5d599d |
|
|
|
5d599d |
mkdir "${MYSQL_TEST_DATA_DIR}"
|
|
|
5d599d |
# Add the basedir option to avoid an error on mariadb <= 5.5.64.
|
|
|
5d599d |
# https://bugzilla.redhat.com/show_bug.cgi?id=1763343
|
|
|
5d599d |
mysql_install_db \
|
|
|
5d599d |
--datadir="${MYSQL_TEST_DATA_DIR}" \
|
|
|
5d599d |
--log-error="${MYSQL_TEST_LOG}" \
|
|
|
5d599d |
--basedir=/usr
|
|
|
5d599d |
|
|
|
5d599d |
%{?_root_libexecdir}%{!?_root_libexecdir:%{_libexecdir}}/mysqld \
|
|
|
5d599d |
--datadir="${MYSQL_TEST_DATA_DIR}" \
|
|
|
5d599d |
--log-error="${MYSQL_TEST_LOG}" \
|
|
|
5d599d |
--socket="${MYSQL_TEST_SOCKET}" \
|
|
|
5d599d |
--pid-file="${MYSQL_TEST_PID_FILE}" \
|
|
|
5d599d |
--port="${MYSQL_TEST_PORT}" \
|
|
|
5d599d |
--ssl &
|
|
|
5d599d |
|
|
|
5d599d |
for i in $(seq 10); do
|
|
|
5d599d |
sleep 1
|
|
|
5d599d |
if grep -q 'ready for connections.' "${MYSQL_TEST_LOG}"; then
|
|
|
5d599d |
break
|
|
|
5d599d |
fi
|
|
|
5d599d |
echo "Waiting connections... ${i}"
|
|
|
5d599d |
done
|
|
|
5d599d |
|
|
|
5d599d |
# See https://github.com/brianmario/mysql2/blob/master/.travis_setup.sh
|
|
|
5d599d |
mysql -u root \
|
|
|
5d599d |
-e 'DROP DATABASE test; CREATE DATABASE /*M!50701 IF NOT EXISTS */ test' \
|
|
|
5d599d |
-S "${MYSQL_TEST_SOCKET}" \
|
|
|
5d599d |
-P "${MYSQL_TEST_PORT}"
|
|
|
5d599d |
|
|
|
5d599d |
# See https://github.com/brianmario/mysql2/blob/master/tasks/rspec.rake
|
|
|
5d599d |
cat <<EOS > spec/configuration.yml
|
|
|
5d599d |
root:
|
|
|
5d599d |
host: localhost
|
|
|
5d599d |
username: root
|
|
|
5d599d |
password:
|
|
|
5d599d |
database: test
|
|
|
5d599d |
port: ${MYSQL_TEST_PORT}
|
|
|
5d599d |
socket: ${MYSQL_TEST_SOCKET}
|
|
|
5d599d |
|
|
|
5d599d |
user:
|
|
|
5d599d |
host: localhost
|
|
|
5d599d |
username: ${MYSQL_TEST_USER}
|
|
|
5d599d |
password:
|
|
|
5d599d |
database: mysql2_test
|
|
|
5d599d |
port: ${MYSQL_TEST_PORT}
|
|
|
5d599d |
socket: ${MYSQL_TEST_SOCKET}
|
|
|
5d599d |
EOS
|
|
|
5d599d |
|
|
|
5d599d |
# This test would require changes in host configuration.
|
|
|
5d599d |
sed -i '/^ it "should be able to connect via SSL options" do$/,/^ end$/ s/^/#/' \
|
|
|
5d599d |
spec/mysql2/client_spec.rb
|
|
|
5d599d |
|
|
|
5d599d |
# performance_schema.session_account_connect_attrs is unexpectedly empty.
|
|
|
5d599d |
# https://github.com/brianmario/mysql2/issues/965
|
|
|
5d599d |
sed -i '/^ it "should set default program_name in connect_attrs" do$/,/^ end$/ s/^/#/' \
|
|
|
5d599d |
spec/mysql2/client_spec.rb
|
|
|
5d599d |
sed -i '/^ it "should set custom connect_attrs" do$/,/^ end$/ s/^/#/' \
|
|
|
5d599d |
spec/mysql2/client_spec.rb
|
|
|
5d599d |
|
|
|
5d599d |
# TODO Fix this SCL specific issue.
|
|
|
5d599d |
sed -i '/^ it "should raise an exception if streaming ended due to a timeout" do$/,/^ end$/ s/^/#/' \
|
|
|
5d599d |
spec/mysql2/result_spec.rb
|
|
|
5d599d |
|
|
|
5d599d |
rspec -Ilib:%{buildroot}%{gem_extdir_mri} -f d spec
|
|
|
5d599d |
popd
|
|
|
5d599d |
|
|
|
5d599d |
# Clean up
|
|
|
5d599d |
MYSQL_TEST_PID=$(cat "${MYSQL_TEST_PID_FILE}")
|
|
|
5d599d |
kill "${MYSQL_TEST_PID}"
|
|
|
5d599d |
# Kill target process completely to avoid error on Copr.
|
|
|
5d599d |
# http://post-office.corp.redhat.com/archives/internal-copr/2017-December/msg00001.html
|
|
|
5d599d |
for i in $(seq 10); do
|
|
|
5d599d |
sleep 1
|
|
|
5d599d |
if ! kill -0 "${MYSQL_TEST_PID}"; then
|
|
|
5d599d |
break
|
|
|
5d599d |
fi
|
|
|
5d599d |
echo "Killing the mysql process... ${i}"
|
|
|
5d599d |
done
|
|
|
5d599d |
|
|
|
5d599d |
%{?scl:EOF}
|
|
|
5d599d |
%endif
|
|
|
5d599d |
|
|
|
5d599d |
%files
|
|
|
5d599d |
%dir %{gem_instdir}
|
|
|
5d599d |
%{gem_libdir}
|
|
|
5d599d |
%{gem_extdir_mri}
|
|
|
5d599d |
%exclude %{gem_cache}
|
|
|
5d599d |
%{gem_spec}
|
|
|
5d599d |
%exclude %{gem_instdir}/support
|
|
|
5d599d |
%license %{gem_instdir}/LICENSE
|
|
|
5d599d |
|
|
|
5d599d |
%files doc
|
|
|
5d599d |
%doc %{gem_docdir}
|
|
|
5d599d |
%doc %{gem_instdir}/README.md
|
|
|
5d599d |
%doc %{gem_instdir}/CHANGELOG.md
|
|
|
5d599d |
|
|
|
5d599d |
|
|
|
5d599d |
%changelog
|
|
|
5d599d |
* Wed Jan 27 2021 Jun Aruga <jaruga@redhat.com> - 0.5.3-2
|
|
|
5d599d |
- Add the basedir option to mysql_install_db to avoid an error on mariadb <= 5.5.64.
|
|
|
5d599d |
Resolves: rhbz#1903661
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Dec 19 2019 Jun Aruga <jaruga@redhat.com> - 0.5.3-1
|
|
|
5d599d |
- New upstream release 0.5.3
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Jul 19 2018 Jun Aruga <jaruga@redhat.com> - 0.5.2-1
|
|
|
5d599d |
- New upstream release 0.5.2
|
|
|
5d599d |
|
|
|
5d599d |
* Mon Feb 26 2018 Jun Aruga <jaruga@redhat.com> - 0.4.10-3
|
|
|
5d599d |
- Rebuilt for fixed ruby document generation issue.
|
|
|
5d599d |
|
|
|
5d599d |
* Fri Jan 05 2018 Jun Aruga <jaruga@redhat.com> - 0.4.10-2
|
|
|
5d599d |
- New upstream release 0.4.10
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.8-3
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.8-2
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Jul 13 2017 Adam Williamson <awilliam@redhat.com> - 0.4.8-1
|
|
|
5d599d |
- New upstream release 0.4.8 (builds against MariaDB 10.2)
|
|
|
5d599d |
|
|
|
5d599d |
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.4-3
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
|
|
5d599d |
|
|
|
5d599d |
* Wed Jan 11 2017 Vít Ondruch <vondruch@redhat.com> - 0.4.4-2
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Changes/Ruby_2.4
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Jun 09 2016 Miroslav Suchý <msuchy@redhat.com> - 0.4.4-1
|
|
|
5d599d |
- New upstream release 0.4.4
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-3
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
|
|
5d599d |
|
|
|
5d599d |
* Mon Jan 11 2016 Vít Ondruch <vondruch@redhat.com> - 0.4.0-2
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Changes/Ruby_2.3
|
|
|
5d599d |
|
|
|
5d599d |
* Tue Sep 8 2015 Miroslav Suchý <msuchy@redhat.com> 0.4.0-1
|
|
|
5d599d |
- rebase to mysql2-0.4.0
|
|
|
5d599d |
|
|
|
5d599d |
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.16-5
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
|
|
5d599d |
|
|
|
5d599d |
* Fri Jan 16 2015 Vít Ondruch <vondruch@redhat.com> - 0.3.16-4
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Changes/Ruby_2.2
|
|
|
5d599d |
|
|
|
5d599d |
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.16-3
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
|
|
5d599d |
|
|
|
5d599d |
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.16-2
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
|
|
5d599d |
|
|
|
5d599d |
* Mon May 26 2014 Miroslav Suchý <msuchy@redhat.com> 0.3.16-1
|
|
|
5d599d |
- rebase to mysql2-0.3.16
|
|
|
5d599d |
|
|
|
5d599d |
* Tue Apr 15 2014 Vít Ondruch <vondruch@redhat.com> - 0.3.15-3
|
|
|
5d599d |
- Rebuilt for https://fedoraproject.org/wiki/Changes/Ruby_2.1
|
|
|
5d599d |
|
|
|
5d599d |
* Tue Feb 11 2014 Miroslav Suchý <msuchy@redhat.com> 0.3.15-2
|
|
|
5d599d |
- rebase to mysql2-0.3.15
|
|
|
5d599d |
|
|
|
5d599d |
* Wed Sep 11 2013 Alexander Chernyakhovsky <achernya@mit.edu> - 0.3.13-1
|
|
|
5d599d |
- Initial package
|