Last active
August 29, 2015 14:01
-
-
Save thwarted/0f5e2596e0e9e78e35c6 to your computer and use it in GitHub Desktop.
/usr/lib64/ruby/gems/2.1.0/gems/gem2rpm-0.10.1/templates/fedora.spec.erb that works better with ruby-2.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
cd ~/rpmbuild/SOURCES | |
function doit() { | |
local gemname="$1" | |
gem2rpm --fetch $gemname --output ../SPECS/rubygem-$gemname.spec | |
pushd ../SPECS | |
if ! rpmbuild -bb rubygem-$gemname.spec; then | |
popd | |
return 1 | |
fi | |
if ! rpmbuild -bs rubygem-$gemname.spec; then | |
popd | |
return 1 | |
fi | |
popd | |
} | |
rm /vagrant/gems.failed | |
GEMS=${1:-bundler foreman core-source dotenv json minitar mkmfmf rgen ruby-shadow spork spork-testunit test-unit thor} | |
for gem in $GEMS; do | |
if ! doit $gem; then | |
echo "$gem failed" >> /vagrant/gems.failed | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- fedora.spec.erb.1.8 2014-05-21 16:35:13.281388765 -0700 | |
+++ fedora.spec.erb.2.1 2014-05-21 16:12:45.717920561 -0700 | |
@@ -7,21 +7,21 @@ | |
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) | |
%global geminstdir %{gemdir}/gems/%{gemname}-%{version} | |
<%# TODO: Try to check against spec.required_ruby_version -%> | |
-%global rubyabi 1.8 | |
+%global rubyabi 2.1 | |
Summary: <%= spec.summary.gsub(/\.$/, "") %> | |
Name: rubygem-%{gemname} | |
Version: <%= spec.version %> | |
Release: 1%{?dist} | |
Group: Development/Languages | |
-License: <%= spec.licenses.join(" and ") %> | |
+License: <%= (spec.licenses.empty? ? ["Unknown"] : spec.licenses).join(" and ") %> | |
<% if spec.homepage -%> | |
URL: <%= spec.homepage %> | |
<% end -%> | |
Source0: <%= download_path %>%{gemname}-%{version}.gem | |
Requires: ruby(abi) = %{rubyabi} | |
<% for req in spec.required_rubygems_version -%> | |
-Requires: ruby(rubygems) <%= req %> | |
+Requires: rubygems <%= req %> | |
<% end -%> | |
<% for d in spec.runtime_dependencies -%> | |
<% for req in d.requirement -%> | |
@@ -30,7 +30,7 @@ | |
<% end -%> | |
BuildRequires: ruby(abi) = %{rubyabi} | |
<% for req in spec.required_rubygems_version -%> | |
-BuildRequires: ruby(rubygems) <%= req %> | |
+BuildRequires: rubygems <%= req %> | |
<% end -%> | |
<%# TODO: Unfortunatelly this do not match with ruby(abi) yet -%> | |
<% for req in spec.required_ruby_version -%> | |
@@ -105,18 +105,22 @@ | |
<% end -%> | |
<% end # if nongem -%> | |
+echo <% spec.extensions.join(", ") -%> | |
+ | |
%files | |
-%dir %{geminstdir} | |
+%dir %{gemdir} | |
+%{geminstdir} | |
<% unless spec.executables.nil? or spec.executables.empty? -%> | |
<% for f in spec.executables -%> | |
%{_bindir}/<%= f %> | |
<% end -%> | |
-%{geminstdir}/bin | |
+#%{geminstdir}/bin | |
<% end -%> | |
-%{geminstdir}/lib | |
+#%{geminstdir}/lib | |
<% unless spec.extensions.empty? -%> | |
<%# TODO: Is it possible to delete the folder specified by the spec.extensions? -%> | |
-%exclude %{geminstdir}/ext | |
+%exclude %{gemdir}/extensions | |
+%exclude %{gemdir}/doc/extensions | |
<% end -%> | |
<% unless doc_subpackage -%> | |
%doc %{gemdir}/doc/%{gemname}-%{version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated from <%= package.spec.file_name %> by gem2rpm -*- rpm-spec -*- | |
%global gemname <%= spec.name %> | |
<% if nongem -%> | |
%global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']") | |
<% end -%> | |
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) | |
%global geminstdir %{gemdir}/gems/%{gemname}-%{version} | |
<%# TODO: Try to check against spec.required_ruby_version -%> | |
%global rubyabi 2.1 | |
Summary: <%= spec.summary.gsub(/\.$/, "") %> | |
Name: rubygem-%{gemname} | |
Version: <%= spec.version %> | |
Release: 1%{?dist} | |
Group: Development/Languages | |
License: <%= (spec.licenses.empty? ? ["Unknown"] : spec.licenses).join(" and ") %> | |
<% if spec.homepage -%> | |
URL: <%= spec.homepage %> | |
<% end -%> | |
Source0: <%= download_path %>%{gemname}-%{version}.gem | |
Requires: ruby(abi) = %{rubyabi} | |
<% for req in spec.required_rubygems_version -%> | |
Requires: rubygems <%= req %> | |
<% end -%> | |
<% for d in spec.runtime_dependencies -%> | |
<% for req in d.requirement -%> | |
Requires: rubygem(<%= d.name %>) <%= req %> | |
<% end -%> | |
<% end -%> | |
BuildRequires: ruby(abi) = %{rubyabi} | |
<% for req in spec.required_rubygems_version -%> | |
BuildRequires: rubygems <%= req %> | |
<% end -%> | |
<%# TODO: Unfortunatelly this do not match with ruby(abi) yet -%> | |
<% for req in spec.required_ruby_version -%> | |
BuildRequires: ruby<%= "-devel" unless spec.extensions.empty? %> <%= req %> | |
<% end -%> | |
<% if spec.extensions.empty? -%> | |
BuildArch: noarch | |
<% end -%> | |
Provides: rubygem(%{gemname}) = %{version} | |
%description | |
<%= spec.description %> | |
<% if doc_subpackage -%> | |
%package doc | |
Summary: Documentation for %{name} | |
Group: Documentation | |
Requires: %{name} = %{version}-%{release} | |
BuildArch: noarch | |
%description doc | |
Documentation for %{name} | |
<% end # if doc_subpackage -%> | |
<% if nongem -%> | |
%package -n ruby-%{gemname} | |
Summary: <%= spec.summary.gsub(/\.$/, "") %> | |
Group: Development/Languages | |
Requires: rubygem(%{gemname}) = %{version} | |
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.reject { |f| f =~ /\.rb$/ }.collect { |f| File::basename(f) }.each do |p| -%> | |
Provides: ruby(<%= p %>) = %{version} | |
<% end -%> | |
%description -n ruby-%{gemname} | |
<%= spec.description -%> | |
<% end # if nongem -%> | |
%prep | |
%setup -q -c -T | |
mkdir -p .%{gemdir} | |
<% unless spec.extensions.empty? -%> | |
export CONFIGURE_ARGS="--with-cflags='%{optflags}'" | |
<% end -%> | |
gem install --local --install-dir .%{gemdir} \ | |
<% unless spec.executables.nil? or spec.executables.empty? -%> | |
--bindir .%{_bindir} \ | |
<% end -%> | |
<% unless spec.extensions.empty? -%> | |
-V \ | |
<% end -%> | |
--force %{SOURCE0} | |
%build | |
%install | |
mkdir -p %{buildroot}%{gemdir} | |
cp -pa .%{gemdir}/* \ | |
%{buildroot}%{gemdir}/ | |
<% unless spec.executables.nil? or spec.executables.empty? -%> | |
mkdir -p %{buildroot}%{_bindir} | |
cp -pa .%{_bindir}/* \ | |
%{buildroot}%{_bindir}/ | |
<% end -%> | |
<% unless spec.executables.empty? -%> | |
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x | |
<% end -%> | |
<% if nongem -%> | |
mkdir -p %{buildroot}%{ruby_sitelib} | |
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.each do |p| -%> | |
ln -s %{gemdir}/gems/%{gemname}-%{version}/<%= p %> %{buildroot}%{ruby_sitelib} | |
<% end -%> | |
<% end # if nongem -%> | |
echo <% spec.extensions.join(", ") -%> | |
%files | |
%dir %{gemdir} | |
%{geminstdir} | |
<% unless spec.executables.nil? or spec.executables.empty? -%> | |
<% for f in spec.executables -%> | |
%{_bindir}/<%= f %> | |
<% end -%> | |
#%{geminstdir}/bin | |
<% end -%> | |
#%{geminstdir}/lib | |
<% unless spec.extensions.empty? -%> | |
<%# TODO: Is it possible to delete the folder specified by the spec.extensions? -%> | |
%exclude %{gemdir}/extensions | |
%exclude %{gemdir}/doc/extensions | |
<% end -%> | |
<% unless doc_subpackage -%> | |
%doc %{gemdir}/doc/%{gemname}-%{version} | |
<% for f in spec.extra_rdoc_files -%> | |
%doc %{geminstdir}/<%= f %> | |
<% end -%> | |
<% end -%> | |
%exclude %{gemdir}/cache/%{gemname}-%{version}.gem | |
%{gemdir}/specifications/%{gemname}-%{version}.gemspec | |
<% if doc_subpackage -%> | |
%files doc | |
%doc %{gemdir}/doc/%{gemname}-%{version} | |
<% for f in spec.extra_rdoc_files -%> | |
%doc %{geminstdir}/<%= f %> | |
<% end -%> | |
<% end # if doc_subpackage -%> | |
<% if nongem -%> | |
%files -n ruby-%{gemname} | |
%{ruby_sitelib}/* | |
<% end # if nongem -%> | |
%changelog | |
* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1 | |
- Initial package |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment