Blame SPECS/rubygem-mysql2.spec

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