rubygem-gem2rpm/rubygem-gem2rpm.spec
2020-03-06 18:07:55 +08:00

81 lines
2.1 KiB
RPMSpec

%global gem_name gem2rpm
%global debug_package %{nil}
Name: rubygem-gem2rpm
Version: 1.0.1
Release: 1
Summary: Generate rpm specfiles from gems
License: GPLv2+
URL: https://github.com/fedora-ruby/gem2rpm
Source0: https://rubygems.org/gems/gem2rpm-%{version}.gem
Source1: gem2rpm-%{version}-tests.tgz
# Fix Ruby 2.6 test failure.
# https://github.com/rubygems/rubygems/issues/2627
# https://github.com/fedora-ruby/gem2rpm/pull/99/commits/4b40d342761a3fdc402fbddccccaa99f38c50ddd
Patch0: sort-dependencies-in-the-test-case.patch
BuildRequires: ruby rubygems-devel rubygem-minitest rpmdevtools
Requires: rpmdevtools
%description
Generate source rpms and rpm spec files from a Ruby Gem. The spec file
tries to follow the gem as closely as possible, and be compliant with the
Fedora rubygem packaging guidelines.
%package doc
Summary: Documentation for %{name}
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%description doc
Documentation for %{name}.
%prep
%setup -q -n gem2rpm-%{version}
%build
# Create the gem as gem install only works on a gem file
gem build ../gem2rpm-%{version}.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}%{_bindir}
cp -a .%{_bindir}/* %{buildroot}%{_bindir}/
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
%check
pushd .%{gem_instdir}
tar xzvf %{SOURCE1}
cat %{PATCH0} | patch -p1
TEST_GEM2RPM_LOCAL=1 ruby -Itest -e 'Dir.glob "./test/**/test_*.rb", &method(:require)'
popd
%files
%dir %{gem_instdir}
%doc %{gem_instdir}/README.md
%doc %{gem_instdir}/AUTHORS
%license %{gem_instdir}/LICENSE
%{_bindir}/gem2rpm
%{gem_instdir}/bin
%{gem_libdir}
%{gem_instdir}/templates
%{gem_spec}
%exclude %{gem_cache}
%files doc
%doc %{gem_docdir}
%changelog
* Fri Mar 6 2020 hexiujun <hexiujun1@huawei.com> - 1.0.1-1
- Package init