3dda26a508
OBS-URL: https://build.opensuse.org/request/show/132173 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rubygem-gem2rpm?expand=0&rev=2
231 lines
7.5 KiB
Diff
231 lines
7.5 KiB
Diff
Index: gem2rpm-0.8.1/templates/opensuse.spec.erb
|
|
===================================================================
|
|
--- gem2rpm-0.8.1.orig/templates/opensuse.spec.erb
|
|
+++ gem2rpm-0.8.1/templates/opensuse.spec.erb
|
|
@@ -1,7 +1,7 @@
|
|
#
|
|
-# spec file for package rubygem-<%= spec.name %> (Version <%= spec.version %>)
|
|
+# spec file for package rubygem-<%= spec.name %>
|
|
#
|
|
-# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
+# Copyright (c) <%= Time.now.year %> SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
@@ -15,58 +15,106 @@
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
-# norootforbuild
|
|
+
|
|
Name: rubygem-<%= spec.name %>
|
|
Version: <%= spec.version %>
|
|
Release: 0
|
|
%define mod_name <%= spec.name %>
|
|
-#
|
|
-Group: Development/Languages/Ruby
|
|
-License: GPLv2+ or Ruby
|
|
-#
|
|
+%define mod_full_name %{mod_name}-%{version}
|
|
+
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
-BuildRequires: rubygems_with_buildroot_patch
|
|
-Requires: rubygems >= <%= Gem::RubyGemsVersion %>
|
|
-<%
|
|
-# no need to add a requires ruby >= 0 here. will be pulled in via rubygems already
|
|
- unless spec.required_ruby_version == ['']
|
|
--%>
|
|
-Requires: ruby <%= spec.required_ruby_version %>
|
|
-BuildRequires: ruby-devel <%= spec.required_ruby_version %>
|
|
+BuildRequires: ruby-macros >= 1
|
|
+<% for req in spec.required_ruby_version -%>
|
|
+<% unless req.empty? -%>
|
|
+Requires: ruby <%= req %>
|
|
+BuildRequires: ruby-devel <%= req %>
|
|
<% end -%>
|
|
-<% for d in spec.dependencies -%>
|
|
+<% end -%>
|
|
+<% for d in spec.runtime_dependencies -%>
|
|
+<% if ['rdoc'].include? d.name.to_s -%>
|
|
+# <%= d.name %> <%= d.__getobj__().requirement %>
|
|
<% for req in d.requirement -%>
|
|
-BuildRequires: rubygem-<%= d.name %> <%= req %>
|
|
-Requires: rubygem-<%= d.name %> <%= req %>
|
|
+BuildRequires: rubygem(<%= d.name %>) <%= req %>
|
|
<% end -%>
|
|
<% end -%>
|
|
-#
|
|
+<% end -%>
|
|
+<% unless spec.rdoc_options.empty? -%>
|
|
+BuildRequires: rubygem(rdoc) > 3.10
|
|
+<% end -%>
|
|
+<% unless spec.homepage.nil? || spec.homepage.empty? -%>
|
|
Url: <%= spec.homepage %>
|
|
-Source: %{mod_name}-%{version}.gem
|
|
-#
|
|
-Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
|
+<% end -%>
|
|
+Source: %{mod_full_name}.gem
|
|
+Summary: <%= spec.summary %>
|
|
+<% unless spec.licenses.empty? -%>
|
|
+License: <%= spec.licenses.join(" and ") %>
|
|
+<% else -%>
|
|
+License: CHECK(Ruby)
|
|
+<% end -%>
|
|
+Group: Development/Languages/Ruby
|
|
+
|
|
%description
|
|
-<%= spec.description %>
|
|
+<%= spec.description -%>
|
|
+
|
|
+<% if spec.has_rdoc -%>
|
|
+%package doc
|
|
+Summary: RDoc documentation for %{mod_name}
|
|
+Group: Development/Languages/Ruby
|
|
+Requires: %{name} = %{version}
|
|
+
|
|
+%description doc
|
|
+Documentation generated at gem installation time.
|
|
+Usually in RDoc and RI formats.
|
|
|
|
+<% end -%>
|
|
+<% test_frameworks = %w(test spec).select { |framework| format.file_entries.any? { |entry, data| path = entry['path'] ; path.index(framework + "/") == 0 } } -%>
|
|
+<% unless test_frameworks.empty? -%>
|
|
+%package testsuite
|
|
+Summary: Test suite for %{mod_name}
|
|
+Group: Development/Languages/Ruby
|
|
+Requires: %{name} = %{version}
|
|
+
|
|
+%description testsuite
|
|
+Test::Unit or RSpec files, useful for developers.
|
|
+
|
|
+<% end -%>
|
|
%prep
|
|
+#gem_unpack
|
|
+#if you need patches, apply them here and replace the # with a % sign in the surrounding lines
|
|
+#gem_build
|
|
+
|
|
%build
|
|
+
|
|
%install
|
|
-%gem_install %{S:0}
|
|
-<% unless spec.extensions.empty? %>
|
|
+%gem_install -f
|
|
+<% unless spec.extensions.empty? -%>
|
|
%gem_cleanup
|
|
-<% end %>
|
|
-
|
|
-%clean
|
|
-%{__rm} -rf %{buildroot}
|
|
+<% end -%>
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
-<% spec.executables.each do |executable| %>
|
|
+<% spec.executables.each do |executable| -%>
|
|
%{_bindir}/<%= executable %>
|
|
-<% end %>
|
|
-%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_name}-%{version}.gem
|
|
-%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/
|
|
-%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_name}-%{version}.gemspec
|
|
-%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_name}-%{version}/
|
|
+<% end -%>
|
|
+%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem
|
|
+%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/
|
|
+<% test_frameworks.each do |framework| -%>
|
|
+%exclude %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/<%= framework %>
|
|
+<% end -%>
|
|
+%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_full_name}.gemspec
|
|
+
|
|
+<% if spec.has_rdoc -%>
|
|
+%files doc
|
|
+%defattr(-,root,root,-)
|
|
+%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/
|
|
|
|
+<% end -%>
|
|
+<% unless test_frameworks.empty? -%>
|
|
+%files testsuite
|
|
+%defattr(-,root,root,-)
|
|
+<% test_frameworks.each do |framework| -%>
|
|
+%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/<%= framework %>
|
|
+<% end -%>
|
|
+
|
|
+<% end -%>
|
|
%changelog
|
|
Index: gem2rpm-0.8.1/lib/gem2rpm/specification.rb
|
|
===================================================================
|
|
--- gem2rpm-0.8.1.orig/lib/gem2rpm/specification.rb
|
|
+++ gem2rpm-0.8.1/lib/gem2rpm/specification.rb
|
|
@@ -6,7 +6,11 @@ module Gem2Rpm
|
|
class Specification < SimpleDelegator
|
|
# A long description of gem wrapped to 78 characters.
|
|
def description
|
|
- Helpers::word_wrap(super.to_s.chomp, 78) + "\n"
|
|
+ text=super
|
|
+ if text.nil? or text.empty?
|
|
+ text=self.__getobj__().summary
|
|
+ end
|
|
+ Helpers::word_wrap(text.to_s.chomp, 78) + "\n"
|
|
end
|
|
|
|
# A list of Gem::Dependency objects this gem depends on (includes every
|
|
@@ -15,6 +19,17 @@ module Gem2Rpm
|
|
super.map {|d| Gem2Rpm::Dependency.new d}
|
|
end
|
|
|
|
+ # a short summary trimmed to 70 characters
|
|
+ def summary
|
|
+ text = super
|
|
+ if text.length >= 70
|
|
+ text = text[0,70].split(/\s/)
|
|
+ text = text[0, text.length-1].join(" ")
|
|
+ end
|
|
+ text = text[0, text.length-1] if text[-1] == '.'
|
|
+ text
|
|
+ end
|
|
+
|
|
# List of dependencies that are used for development.
|
|
def development_dependencies
|
|
super.map {|d| Gem2Rpm::Dependency.new d}
|
|
Index: gem2rpm-0.8.1/lib/gem2rpm.rb
|
|
===================================================================
|
|
--- gem2rpm-0.8.1.orig/lib/gem2rpm.rb
|
|
+++ gem2rpm-0.8.1/lib/gem2rpm.rb
|
|
@@ -35,11 +35,13 @@ module Gem2Rpm
|
|
end
|
|
|
|
def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
|
|
- nongem=true, local=false, doc_subpackage = true)
|
|
+ nongem=true, local=false, doc_subpackage = true, oldlicense=nil)
|
|
format = Gem::Format.from_file_by_path(fname)
|
|
spec = Gem2Rpm::Specification.new(format.spec)
|
|
- spec.description ||= spec.summary
|
|
download_path = ""
|
|
+ if spec.licenses.empty? && oldlicense
|
|
+ spec.licenses = oldlicense.split(' and ')
|
|
+ end
|
|
unless local
|
|
begin
|
|
download_path = find_download_url(spec.name, spec.version)
|
|
Index: gem2rpm-0.8.1/bin/gem2rpm
|
|
===================================================================
|
|
--- gem2rpm-0.8.1.orig/bin/gem2rpm
|
|
+++ gem2rpm-0.8.1/bin/gem2rpm
|
|
@@ -132,9 +132,15 @@ end
|
|
if output_file.nil?
|
|
Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage) unless deps
|
|
else
|
|
+ oldfile=IO.readlines(output_file) if File.exists? output_file
|
|
+ oldlicense=nil
|
|
+ oldfile.each do |line|
|
|
+ m = line.match(%r{^License:\s*(\w.*)$})
|
|
+ oldlicense = m[1] if m
|
|
+ end if oldfile
|
|
begin
|
|
out = open(output_file, "w")
|
|
- Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage)
|
|
+ Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, oldlicense)
|
|
ensure
|
|
out.close()
|
|
end
|