Blob Blame History Raw
%global gem_name pcaprub

# Some test won't work without root permissions.
%global enable_network_tests 0

Name: rubygem-%{gem_name}
Version: 0.12.4
Release: 9%{?dist}
Summary: libpcap bindings for ruby
License: LGPLv2
URL: https://github.com/pcaprub/pcaprub
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby-devel
BuildRequires: libpcap-devel
BuildRequires: rubygem(test-unit)

%description
libpcap bindings for ruby with Ruby1.8, Ruby1.9, Ruby 2.x.


%package doc
Summary: Documentation for %{name}
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

%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}
cp -a .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/

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


# Run the test suite
%check
pushd .%{gem_instdir}
# Get rid of Bundler.
sed -i '/bundler\/setup/ s/^/#/' test/test_helper.rb

# We don't care about code coverage.
sed -i '/[Cc]overalls/ s/^/#/' test/test_helper.rb

# Lets go just with recent test-unit, it should be enough to run the test
# suite.
sed -i '/minitest/ s/^/#/' test/test_helper.rb

%if ! 0%{?enable_network_tests}
sed -i '/open_live/i\\n    omit "Requires root permissions."\n' test/test_pcaprub_unit.rb
sed -i '/o.activate/i\\n    omit "Cannot activate interface."\n' test/test_pcaprub_unit.rb
%endif

ruby -I$(dirs +1)%{gem_extdir_mri} -e 'Dir.glob "./test/**/test_*.rb", &method(:require)'
popd

%files
%dir %{gem_instdir}
%{gem_extdir_mri}
%exclude %{gem_instdir}/.*
%license %{gem_instdir}/LICENSE
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/FAQ.rdoc
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/README.rdoc
%{gem_instdir}/Rakefile
%doc %{gem_instdir}/USAGE.rdoc
%{gem_instdir}/examples
%{gem_instdir}/test

%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.4-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 0.12.4-8
- Rebuilt for switch to libxcrypt

* Thu Jan 04 2018 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.12.4-7
- F-28: rebuild for ruby25

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Thu Apr 06 2017 Vít Ondruch <vondruch@redhat.com> - 0.12.4-3
- Enable parts of the test suite (rhbz#1371845)
- Fix FTBFS in Rawhide and rebuild against Ruby 2.4 (rhbz#1424354).

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Jun 20 2016 Germano Massullo <germano.massullo@gmail.com> - 0.12.4-1
- Initial package