Blame SPECS/rubygem-mysql2.spec

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