Blob Blame History Raw
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

# Generated from puma-3.6.0.gem by gem2rpm -*- rpm-spec -*-
%global gem_name puma

Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 3.6.2
Release: 2%{?dist}
Summary: A simple, fast, threaded, and highly concurrent HTTP 1.1 server
Group: Development/Languages
License: BSD
URL: http://puma.io
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# The puma gem doesn't ship with the test suite.
# git clone https://github.com/puma/puma.git && cd puma
# git checkout v3.6.2 && tar czvf puma-3.6.2-tests.tgz test/
Source1: %{gem_name}-%{version}-tests.tgz
# The puma gem doesn't ship with the examples used in test suite.
# tar czvf puma-3.6.2-examples.tgz examples/
Source3: %{gem_name}-%{version}-examples.tgz
# Enable log_requests to pass integration tests
# https://github.com/puma/puma/commit/9bc7514
Patch0: rubygem-puma-3.6.0-enable-log-for-tests.patch

Requires: %{?scl_prefix_ruby}ruby(release)
Requires: %{?scl_prefix_ruby}ruby(rubygems)
BuildRequires: openssl-devel
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}ruby(rubygems)
BuildRequires: %{?scl_prefix_ruby}ruby
BuildRequires: %{?scl_prefix_ruby}ruby-devel >= 1.8.7
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildRequires: %{?scl_prefix}rubygem(rack)
BuildRequires: %{?scl_prefix_ruby}rubygem(test-unit)
BuildRequires: %{?scl_prefix_ruby}rubygem(minitest)
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}

# Explicitly require runtime subpackage, as long as older scl-utils do not generate it
%{?scl:Requires: %{?scl_prefix}runtime}

%description
A simple, fast, threaded, and highly concurrent HTTP 1.1 server for
Ruby/Rack applications.

%package doc
Summary: Documentation for %{pkg_name}
Group: Documentation
Requires: %{?scl_prefix}%{pkg_name} = %{version}-%{release}
BuildArch: noarch

%description doc
Documentation for %{pkg_name}.

%prep
%{?scl:scl enable %{scl} - << \EOF}
set -e
gem unpack %{SOURCE0}

%setup -q -D -T -n  %{gem_name}-%{version}

gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%{?scl:EOF}

%build
%{?scl:scl enable %{scl} - << \EOF}
set -e
gem build %{gem_name}.gemspec

%gem_install
%{?scl:EOF}

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/

mkdir -p %{buildroot}%{gem_extdir_mri}/puma
cp -a .%{gem_extdir_mri}/gem.build_complete %{buildroot}%{gem_extdir_mri}/
cp -a .%{gem_extdir_mri}/puma/*.so %{buildroot}%{gem_extdir_mri}/puma

# Prevent dangling symlink in -debuginfo (rhbz#878863).
rm -rf %{buildroot}%{gem_instdir}/ext/

mkdir -p %{buildroot}%{_bindir}
cp -pa .%{_bindir}/* \
        %{buildroot}%{_bindir}/

find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x

# Run the test suite

%check
pushd .%{gem_instdir}
tar xzf %{SOURCE1}
tar xzf %{SOURCE3}

patch -p1 < %{PATCH0}

# Skip failed tests on upstream.
# https://github.com/puma/puma/issues/1044
sed -i '/^  def test_control_clustered$/,/^  end$/ s/^/#/' \
  test/test_cli.rb

# Log stdout and stderr of the test to detect an error easily.
sed -i '/ruby / s| > /dev/null 2>&1||' test/shell/run.sh

# Make binary exension available in Ruby load path.
# Enable verbose mode to check unstable tests easily.
export RUBYOPT="-Ilib:test:.:$(dirs +1 -l)%{gem_extdir_mri}"
%{?scl:scl enable %{scl} - << \EOF}
set -e
ruby \
  -r 'minitest/autorun' \
  -e 'Dir.glob "./test/**/test_*.rb", &method(:require)' \
  -- -v
%{?scl:EOF}

# Integration test
pushd test/shell
# Make binary exension available in Ruby load path.
export RUBYOPT="-I$(dirs +2 -l)%{gem_extdir_mri}"
%{?scl:scl enable %{scl} - << \EOF}
sh -x run.sh
%{?scl:EOF}
popd

popd

%files
# There is no %%license macro on RHEL6.
# https://bugzilla.redhat.com/show_bug.cgi?id=1386246
%{!?_licensedir:%global license %%doc}

%dir %{gem_instdir}
%{_bindir}/puma
%{_bindir}/pumactl
%{gem_extdir_mri}
%license %{gem_instdir}/LICENSE
%{gem_instdir}/bin
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/DEPLOYMENT.md
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/History.txt
%doc %{gem_instdir}/Manifest.txt
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%doc %{gem_instdir}/docs
%{gem_instdir}/puma.gemspec
%{gem_instdir}/tools

%changelog
* Fri Feb 17 2017 Jun Aruga <jaruga@redhat.com> - 3.6.2-2
- Remove README.Fedora, as the content is already mentioned in README.md

* Wed Jan 18 2017 Jun Aruga <jaruga@redhat.com> - 3.6.2-1
- Update to Puma 3.6.2.

* Wed Sep 21 2016 Jun Aruga <jaruga@redhat.com> - 3.6.0-3
- Skip test that needs internet.

* Mon Sep 19 2016 Jun Aruga <jaruga@redhat.com> - 3.6.0-2
- Add openssl-devel dependency to enable HTTPS support.
- Add regenerated parser logic.
- Improve Ruby load path to run test suite.
- Improve files section.

* Thu Aug 11 2016 Jun Aruga <jaruga@redhat.com> - 3.6.0-1
- Initial package