Summary: Generate rpm specfiles from gems
Name: gem2rpm
Version: 0.8.1
-Release: 0.3
+Release: 0.4
License: GPL v2+
Group: Development/Languages
Source0: http://rubygems.org/gems/%{name}-%{version}.gem
# tar czvf gem2rpm-0.8.1-tests.tgz test/
Source1: %{name}-%{version}-tests.tgz
# Source1-md5: d7d8bc231dc405bbce00f570c89f530e
+Source2: pld.spec.erb
Patch0: gems.patch
+Patch1: pld.patch
URL: https://github.com/lutter/gem2rpm/
BuildRequires: rpm-rubyprov
BuildRequires: rpmbuild(macros) >= 1.656
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
+cp -p %{SOURCE2} templates
%build
%if %{with tests}
--- /dev/null
+# Generated from <%= format.gem_path %> by gem2rpm -*- rpm-spec -*-
+%define rbname <%= spec.name %>
+%define version <%= spec.version %>
+%define release 1
+
+Summary: <%= spec.summary %>
+Name: ruby-gems-%{rbname}
+
+Version: %{version}
+Release: %{release}
+Group: Development/Ruby
+License: Distributable
+URL: <%= spec.homepage %>
+Source0: %{rbname}-%{version}.gem
+# Make sure the spec template is included in the SRPM
+Source1: ruby-gems-%{rbname}.spec.in
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+Requires: ruby <%= spec.required_ruby_version %>
+Requires: ruby-gems >= <%= Gem::RubyGemsVersion %>
+<% for d in spec.dependencies -%>
+<% for req in d.requirement -%>
+Requires: ruby-gems-<%= d.name %> <%= req %>
+<% end -%>
+<% end -%>
+BuildRequires: ruby <%= spec.required_ruby_version %>
+BuildRequires: ruby-gems >= <%= Gem::RubyGemsVersion %>
+BuildArch: noarch
+Provides: ruby(<%= spec.name.capitalize %>) = %{version}
+
+%define gemdir <%= Gem.dir %>
+%define gembuilddir %{buildroot}%{gemdir}
+
+%description
+<%= spec.description %>
+
+%prep
+%setup -T -c
+
+%build
+
+%install
+%{__rm} -rf %{buildroot}
+mkdir -p %{gembuilddir}
+gem install --local --install-dir %{gembuilddir} --force %{SOURCE0}
+<% if ! spec.executables.empty? -%>
+mkdir -p %{buildroot}/%{_bindir}
+mv %{gembuilddir}/bin/* %{buildroot}/%{_bindir}
+rmdir %{gembuilddir}/bin
+<% end -%>
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%files
+%defattr(-, root, root)
+<% for f in spec.executables -%>
+%{_bindir}/<%= f %>
+<% end -%>
+<% format.file_entries.each do |entry, data| -%>
+<% path = entry['path'] -%>
+<% doc_prefix = spec.extra_rdoc_files.include?(path) ? "%doc " : "" -%>
+<%= doc_prefix %>%{gemdir}/gems/<%= spec.name %>-<%= spec.version %>/<%= path %>
+<% end %>
+
+%doc %{gemdir}/doc/<%= spec.name %>-<%= spec.version %>
+%{gemdir}/cache/<%= format.gem_path %>
+%{gemdir}/specifications/<%= format.gem_path %>spec
+
+%changelog