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

Name: rubygem-%{gem_name}
Version: 3.6.0
Release: 3%{?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.0 && tar czvf puma-3.6.0-tests.tgz test/
Source1: %{gem_name}-%{version}-tests.tgz
# Separate instructions from description section.
Source2: README.Fedora
# The puma gem doesn't ship with the examples used in test suite.
# tar czvf puma-3.6.0-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
# Set the default cipher list "PROFILE=SYSTEM".
# https://fedoraproject.org/wiki/Packaging:CryptoPolicies
Patch2: rubygem-puma-3.6.0-fedora-crypto-policy-cipher-list.patch
BuildRequires: openssl-devel
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby-devel >= 1.8.7
BuildRequires: rubygem(rack)
BuildRequires: rubygem(test-unit)
BuildRequires: rubygem(minitest)
BuildRequires: %{_bindir}/ragel

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


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

%description doc
Documentation for %{name}.

%prep
gem unpack %{SOURCE0}

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

gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec

%patch2 -p1

# Regenarate the parser.
# https://fedoraproject.org/wiki/Packaging:Guidelines#Use_of_pregenerated_code
rm -f ext/puma_http11/http11_parser.c
ragel ext/puma_http11/http11_parser.rl -C -G2 -I ext/puma_http11 \
  -o ext/puma_http11/http11_parser.c

%build
# Create the gem as gem install only works on a gem file
gem build %{gem_name}.gemspec

# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install

%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

cp -p %{SOURCE2} .

# 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
sed -i '/^  def test_phased_restart_via_pumactl$/,/^  end$/ s/^/#/' \
  test/test_integration.rb

# Skip test that needs internet.
# https://github.com/puma/puma/issues/1098
sed -i '/^  def test_timeout_in_data_phase$/,/^  end$/ s/^/#/' \
  test/test_puma_server.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.
RUBYOPT="-Ilib:test:.:$(dirs +1 -l)%{gem_extdir_mri}" ruby \
  -r 'minitest/autorun' \
  -e 'Dir.glob "./test/**/test_*.rb", &method(:require)' \
  -- -v

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

popd

%files
%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 README.Fedora
%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
* 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