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: 10%{?dist}
Summary: libpcap bindings for ruby
License: LGPLv2
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby-devel
BuildRequires: libpcap-devel
BuildRequires: rubygem(test-unit)

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}.

gem unpack %{SOURCE0}

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

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

# 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

mkdir -p %{buildroot}%{gem_dir}
cp -a .%{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
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

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

%dir %{gem_instdir}
%exclude %{gem_instdir}/.*
%license %{gem_instdir}/LICENSE
%exclude %{gem_cache}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/FAQ.rdoc
%doc %{gem_instdir}/README.rdoc
%doc %{gem_instdir}/USAGE.rdoc

* Sat Jul 14 2018 Fedora Release Engineering <> - 0.12.4-10
- Rebuilt for

* Fri Feb 09 2018 Fedora Release Engineering <> - 0.12.4-9
- Rebuilt for

* Sat Jan 20 2018 Björn Esser <> - 0.12.4-8
- Rebuilt for switch to libxcrypt

* Thu Jan 04 2018 Mamoru TASAKA <> - 0.12.4-7
- F-28: rebuild for ruby25

* Thu Aug 03 2017 Fedora Release Engineering <> - 0.12.4-5
- Rebuilt for

* Thu Jul 27 2017 Fedora Release Engineering <> - 0.12.4-4
- Rebuilt for

* Thu Apr 06 2017 Vít Ondruch <> - 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 <> - 0.12.4-2
- Rebuilt for

* Mon Jun 20 2016 Germano Massullo <> - 0.12.4-1
- Initial package