1
0

Accepting request 242536 from devel:languages:ruby:extensions

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/242536
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rubygem-gem2rpm?expand=0&rev=13
This commit is contained in:
Stephan Kulow 2014-07-27 16:47:26 +00:00 committed by Git OBS Bridge
parent 1585e1c64c
commit 506a96abb0
13 changed files with 1054 additions and 115 deletions

View File

@ -0,0 +1,33 @@
From 91bc63e3fbba24a5f90c4fce4f74b371c4694657 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 16:46:19 +0200
Subject: [PATCH 1/7] - use the ID from os-release to use the proper template
---
bin/gem2rpm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/bin/gem2rpm b/bin/gem2rpm
index 736a645..fa7ce6b 100755
--- a/bin/gem2rpm
+++ b/bin/gem2rpm
@@ -68,6 +68,16 @@ rest = opts.permute(ARGV)
template = nil
if template_file.nil?
+ f = open("/etc/os-release", "r") if File.exists?("/etc/os-release")
+ if f
+ f.read.split('\n').each do |line|
+ line.match(%r{^ID=(.*)$}) { |m| template_file=m[1] }
+ end
+ f.close
+ f = nil
+ end
+end
+if template_file.nil?
template = Gem2Rpm::TEMPLATE
else
begin
--
1.8.4.5

View File

@ -0,0 +1,93 @@
From 1742038eb7ec8fcb25009ce8b270b420183875bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 16:54:45 +0200
Subject: [PATCH 2/7] added basic config file support to gem2rpm in yaml
format.
There is no validation as it is basically a hash where certain keys are
picked up by our templates.
---
bin/gem2rpm | 21 +++++++++++++++++++--
lib/gem2rpm.rb | 3 ++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/bin/gem2rpm b/bin/gem2rpm
index fa7ce6b..7f28603 100755
--- a/bin/gem2rpm
+++ b/bin/gem2rpm
@@ -8,6 +8,7 @@ require 'optparse'
require 'fileutils'
require 'open-uri'
require 'uri'
+require 'yaml'
opts = OptionParser.new("Usage: #{$0} [OPTIONS] GEM")
opts.separator(" Convert ruby Gems to source RPMs and specfiles")
@@ -23,6 +24,8 @@ deps = false
nongem = false
doc_subpackage = true
fetch = false
+config_file = nil
+config = {}
opts.separator("")
opts.separator(" Options:")
@@ -58,6 +61,9 @@ end
opts.on("--fetch", "Fetch the gem from rubygems.org") do |val|
fetch = true
end
+opts.on("--config FILE", "Path to gem2rpm.yaml") do |val|
+ config_file = val
+end
opts.separator("")
opts.separator(" Arguments:")
opts.separator(" GEM the path to locally stored gem package file or the name")
@@ -127,13 +133,24 @@ if srpm
end
end
+if config_file
+ begin
+ config = YAML.load_file(config_file)
+ config[:sources] ||= []
+ config[:sources] << File.basename(config_file)
+ rescue Exception => ex
+ $stderr.puts "Failed to load config file '#{config_file}': #{ex}"
+ exit 1
+ end
+end
+
# Produce a specfile
if output_file.nil?
- Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage) unless deps
+ Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage, config) unless deps
else
begin
out = open(output_file, "w")
- Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage)
+ Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, config)
ensure
out.close()
end
diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb
index 017ecd1..e5e2693 100644
--- a/lib/gem2rpm.rb
+++ b/lib/gem2rpm.rb
@@ -31,12 +31,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, config={})
package = Gem2Rpm::Package.new(fname)
# Deprecate, kept just for backward compatibility.
format = Gem2Rpm::Format.new(package)
spec = Gem2Rpm::Specification.new(package.spec)
spec.description ||= spec.summary
+ config ||= {}
download_path = ""
unless local
begin
--
1.8.4.5

View File

@ -0,0 +1,475 @@
From 152e9ec100f30a3c46535a65fa411d014cb264e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 16:55:57 +0200
Subject: [PATCH 3/7] sle 12 templates. they require the config file support.
---
templates/sles12.gem_packages.spec.erb | 233 +++++++++++++++++++++++++++++++++
templates/sles12.spec.erb | 215 ++++++++++++++++++++++++++++++
2 files changed, 448 insertions(+)
create mode 100644 templates/sles12.gem_packages.spec.erb
create mode 100644 templates/sles12.spec.erb
diff --git a/templates/sles12.gem_packages.spec.erb b/templates/sles12.gem_packages.spec.erb
new file mode 100644
index 0000000..5b02f2c
--- /dev/null
+++ b/templates/sles12.gem_packages.spec.erb
@@ -0,0 +1,233 @@
+<%
+ def self.patch_mod_full_name(path, mod_full_name)
+ path.gsub(/\/-/, "/#{mod_full_name}")
+ end
+
+ def self.patch_libdir(path)
+ # path ? path.gsub(/\/usr\/lib(64)?/, '%{_libdir}') : path
+ path
+ end
+
+ def self.get_extension_doc_dir(gem_spec)
+ if gem_spec.respond_to? :extensions_dir
+ rp = gem_spec.extensions_dir.rpartition(gem_spec.base_dir)
+ return File.join(rp[1], 'doc', rp[2])
+ end
+ return nil
+ end
+
+ def self.get_mod_weight(spec)
+ versions=spec.version.to_s.split('.')
+ begin v1=Integer(versions[0]) rescue v1=1 end
+ begin v2=Integer(versions[1]) rescue v2=0 end
+ begin v3=Integer(versions[2]) rescue v3=0 end
+ weight=v1*10000+v2*100+v3
+ end
+
+ def self.filecontent_or_value(path)
+ (path and File.exists?(path)) ? File.read(path) : path
+ end
+
+ def self.parse_custom_pkgs(env_value)
+ custom_pkgs = {}
+ if env_value
+ list = env_value.split(/\s+/)
+ list.each do |element|
+ pkg_name,filelist_path, preamble, description = element.split(/\|/, 4)
+ filelist = filecontent_or_value(filelist_path)
+ preamble = filecontent_or_value(preamble)
+ description = filecontent_or_value(description)
+ custom_pkgs[pkg_name] = {
+ "filelist" => filelist,
+ "preamble" => preamble,
+ "description" => description,
+ }
+ end
+ end
+ custom_pkgs
+ end
+
+ rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '')
+ rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '')
+ pkg_basename = rb_pkgname + '-rubygem-' + spec.name
+
+ mod_full_name = "#{spec.name}-#{spec.version}"
+ mod_weight = get_mod_weight(spec)
+
+ gem_platform = Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s
+ rb_bindir = RbConfig::CONFIG['bindir']
+ rb_sysconfdir = RbConfig::CONFIG['sysconfdir']
+ docdir = '/usr/share/doc/packages'
+ gem_spec = Gem::Specification.new
+ gem_base_dir = patch_libdir(gem_spec.base_dir)
+ gem_cache_dir = patch_libdir(gem_spec.cache_dir)
+ gem_gems_dir = patch_libdir(gem_spec.gems_dir)
+ gem_spec_dir = patch_libdir(gem_spec.spec_dir)
+ gem_bin_dir = patch_libdir(patch_mod_full_name(gem_spec.bin_dir , mod_full_name ))
+ gem_doc_dir = patch_libdir(patch_mod_full_name(gem_spec.doc_dir, mod_full_name ))
+ gem_gem_dir = patch_libdir(patch_mod_full_name(gem_spec.gem_dir, mod_full_name ))
+ gem_ri_dir = patch_libdir(patch_mod_full_name(gem_spec.ri_dir, mod_full_name ))
+ #ruby2.1
+ gem_extensions_dir = gem_spec.respond_to?(:extensions_dir) ? patch_libdir(gem_spec.extensions_dir) : nil
+ gem_extension_dir = gem_spec.respond_to?(:extension_dir) ? patch_libdir(patch_mod_full_name(gem_spec.extension_dir, mod_full_name)) : nil
+ gem_extension_doc = patch_libdir(get_extension_doc_dir(gem_spec))
+ #/ruby2.1
+%>
+%package -n <%= pkg_basename %><%= config[:version_suffix] %>
+<% for req in spec.required_ruby_version -%>
+<% unless req.empty? -%>
+Requires: <%= rb_pkgname %> <%= req %>
+<% end -%>
+<% end -%>
+# MANUAL
+<% if config[:main] && config[:main][:preamble] -%>
+<%= config[:main][:preamble] %>
+<% end -%>
+# /MANUAL
+Summary: <%= config[:summary] or spec.summary %>
+Group: Development/Languages/Ruby
+<% unless spec.executables.empty? -%>
+PreReq: update-alternatives
+<% end -%>
+
+%description -n <%= pkg_basename %><%= config[:version_suffix] %>
+<%= config[:description] or spec.description -%>
+
+<% if spec.has_rdoc && not(config[:disable_docs]) -%>
+%package -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
+Summary: RDoc documentation for <%= spec.name %>
+Group: Development/Languages/Ruby
+Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
+
+%description -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
+Documentation generated at gem installation time.
+Usually in RDoc and RI formats.
+
+<% end -%>
+<% test_frameworks = Hash.new
+ docdirfiles = []
+ format.file_entries.each do |entry|
+ # new rubygems version has it different
+ if entry.kind_of?(Array)
+ path=entry[0]['path']
+ else
+ path=entry
+ end
+ path.gsub!(%r{^\./}, '')
+ %w(test spec).each { |framework|
+ test_frameworks[framework] = 1 if path.index(framework + "/") == 0
+ }
+ %w(changes copying history legal license mit-license changelog readme).each { |file|
+ bpath = path.downcase.gsub(%r{\.rdoc$}, '').gsub(%r{\.txt$}, '').gsub(%r{\.md$}, '')
+ #$stderr.puts "PATH #{path} #{bpath} #{file}"
+ docdirfiles << path if bpath == file
+ }
+ end
+
+ test_frameworks = test_frameworks.keys.sort
+-%>
+<% unless test_frameworks.empty? -%>
+%package -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
+Summary: Test suite for <%= spec.name %>
+Group: Development/Languages/Ruby
+Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
+
+%description -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
+Test::Unit or RSpec files, useful for developers.
+
+<% end -%>
+
+<% unless spec.executables.empty? -%>
+%post -n <%= pkg_basename %><%= config[:version_suffix] %>
+<% spec.executables.each do |executable| -%>
+/usr/sbin/update-alternatives --install \
+ <%= rb_bindir %>/<%= executable %> <%= executable %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
+/usr/sbin/update-alternatives --install \
+ <%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %> <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
+/usr/sbin/update-alternatives --install \
+ <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %> <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
+<% end -%>
+
+%preun -n <%= pkg_basename %><%= config[:version_suffix] %>
+if [ "$1" = 0 ] ; then
+<% spec.executables.each do |executable| -%>
+ /usr/sbin/update-alternatives --remove <%= executable %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
+ /usr/sbin/update-alternatives --remove <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
+ /usr/sbin/update-alternatives --remove <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
+<% end -%>
+fi
+<% end -%>
+
+%files -n <%= pkg_basename %><%= config[:version_suffix] %>
+%defattr(-,root,root,-)
+# MANUAL
+<% if config[:main] && config[:main][:filelist] -%>
+<%= config[:main][:filelist] -%>
+<% end -%>
+# /MANUAL
+<% unless docdirfiles.empty? -%>
+<%= docdir %>/<%= pkg_basename %><%= config[:version_suffix] %>
+<% end -%>
+<% spec.executables.each do |executable| -%>
+<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
+%ghost <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %>
+%ghost <%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %>
+%ghost <%= rb_bindir %>/<%= executable %>
+%ghost <%= rb_sysconfdir %>/alternatives/<%= executable %>
+%ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}#{rb_suffix}" %>
+%ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}-#{spec.version}" %>
+<% end -%>
+# cache file
+<%= gem_cache_dir %>/<%= mod_full_name %>.gem
+<%= gem_gem_dir %>
+<% unless spec.extensions.empty? or gem_extension_dir.nil? -%>
+<%= gem_extension_dir %>
+<% end -%>
+<% test_frameworks.each do |framework| -%>
+%exclude <%= File.join gem_gem_dir, framework %>
+<% end -%>
+<%= gem_spec_dir %>/<%= mod_full_name -%>.gemspec
+
+<% if spec.has_rdoc && not(config[:disable_docs]) -%>
+%files -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
+%defattr(-,root,root,-)
+%doc <%= gem_doc_dir %>
+<% unless spec.extensions.empty? or gem_extension_doc.nil? -%>
+%doc <%= gem_extension_doc %>
+<% end -%>
+<% end -%>
+
+<% unless test_frameworks.empty? -%>
+%files -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
+%defattr(-,root,root,-)
+<% test_frameworks.each do |framework| -%>
+<%= File.join gem_gem_dir, framework %>
+<% end -%>
+<% end -%>
+<%
+ if config[:custom_pkgs_ruby_versioned]
+ config[:custom_pkgs_ruby_versioned].each do |custom_pkg_name, data|
+-%>
+%package -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
+<% if data[:preamble] and data[:preamble] != '' -%>
+<%= data[:preamble] %>
+<% else %>
+Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
+Group: Development/Languages/Ruby
+<% end %>
+Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
+%description -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
+<% if data[:description] and data[:description] != '' -%>
+<%= data[:description] %>
+<% else %>
+<%= spec.description -%>
+
+This package holds the <%= custom_pkg_name %> sub package for <%= spec.name -%>
+<% end %>
+%files -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
+%defattr(-,root,root,-)
+<%= data['filelist'] -%>
+<%
+ end
+ end
+-%>
diff --git a/templates/sles12.spec.erb b/templates/sles12.spec.erb
new file mode 100644
index 0000000..25fdec3
--- /dev/null
+++ b/templates/sles12.spec.erb
@@ -0,0 +1,215 @@
+#
+# spec file for package rubygem-<%= spec.name %><%= config[:version_suffix] %>
+#
+# 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
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+<% if config && not(config.empty?) -%>
+#
+# This file was generated with a gem2rpm.yml and not just plain gem2rpm.
+# All sections marked as MANUAL, license headers, summaries and descriptions
+# can be maintained in that file. Please consult this file before editing any
+# of those fields
+#
+<% end -%>
+
+Name: <%= config[:name] ? config[:name] : "rubygem-#{spec.name}#{config[:version_suffix]}" %>
+Version: <%= spec.version %>
+Release: 0
+%define mod_name <%= spec.name %>
+%define mod_full_name %{mod_name}-%{version}
+<% if config[:version_suffix] -%>
+%define mod_version_suffix <%= config[:version_suffix] %>
+<% end -%>
+<% if config[:preamble] -%>
+# MANUAL
+<%= config[:preamble] %>
+# /MANUAL
+<% end -%>
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildRequires: ruby-macros >= 5
+<% for req in spec.required_ruby_version -%>
+<% unless req.empty? -%>
+<% if spec.extensions.empty? -%>
+BuildRequires: %{ruby <%= req %>}
+<% else -%>
+BuildRequires: %{rubydevel <%= req %>}
+<% end -%>
+<% else -%>
+<% if spec.extensions.empty? -%>
+BuildRequires: %{ruby}
+<% else -%>
+BuildRequires: %{rubydevel}
+<% end -%>
+<% end -%>
+<% 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 %>}
+<% end -%>
+<% end -%>
+<% end -%>
+BuildRequires: %{rubygem gem2rpm}
+<% unless spec.rdoc_options.empty? || config[:disable_automatic_rdoc_dep] -%>
+BuildRequires: %{rubygem rdoc > 3.10}
+<% end -%>
+<% unless spec.executables.empty? -%>
+BuildRequires: update-alternatives
+<% end -%>
+<% unless spec.homepage.nil? || spec.homepage.empty? -%>
+Url: <%= spec.homepage %>
+<% end -%>
+Source: http://rubygems.org/gems/%{mod_full_name}.gem
+<% if config[:sources]
+ config[:sources].each_with_index do |src, i| -%>
+Source<%= i+1 %>: <%= src %>
+<% end
+ end -%>
+<% if config[:patches] -%>
+# MANUAL
+<% config[:patches].each_with_index do |patch,i| -%>
+Patch<%= i %>: <%= patch[0] %>
+<% end -%>
+# /MANUAL
+<% end -%>
+Summary: <%= config[:summary] or spec.summary %>
+License: <%= config[:license] or (spec.licenses and spec.licenses.join(" and ")) or 'CHECK(Ruby)' %>
+Group: Development/Languages/Ruby
+<% unless spec.executables.empty? -%>
+PreReq: update-alternatives
+<% end -%>
+
+%description
+<%= config[:description] or spec.description -%>
+
+<% # TODO move into gem2rpm as gem_packages.sh also need this and we only leave it here for getting the docfiles list
+ test_frameworks = Hash.new
+ docdirfiles = []
+ format.file_entries.each do |entry|
+ # new rubygems version has it different
+ if entry.kind_of?(Array)
+ path=entry[0]['path']
+ else
+ path=entry
+ end
+ path.gsub!(%r{^\./}, '')
+ %w(test spec).each { |framework|
+ test_frameworks[framework] = 1 if path.index(framework + "/") == 0
+ }
+ %w(changes copying history legal license mit-license changelog readme).each { |file|
+ bpath = path.downcase.gsub(%r{\.rdoc$}, '').gsub(%r{\.txt$}, '').gsub(%r{\.md$}, '')
+ #$stderr.puts "PATH #{path} #{bpath} #{file}"
+ docdirfiles << path if bpath == file
+ }
+ end
+
+ test_frameworks = test_frameworks.keys.sort
+-%>
+%prep
+<% unless config[:patches].nil? or config[:patches].empty? -%>
+%gem_unpack
+<% config[:patches].each_with_index do |patch, i| -%>
+%patch<%= i %> <%= patch[1] if patch[1] %>
+<% end -%>
+%gem_build
+<% end -%>
+
+%build
+
+%install
+<% if config[:pre_install] -%>
+# MANUAL
+<%= config[:pre_install] %>
+# /MANUAL
+<% end -%>
+%gem_install \
+<% if config[:gem_install_args] -%>
+<%= config[:gem_install_args] %> \
+<% end -%>
+<% if config[:disable_docs] -%>
+ --no-rdoc --no-ri \
+<% end -%>
+<% unless spec.executables.empty? -%>
+ --symlink-binaries \
+<% end -%>
+<% unless docdirfiles.empty? -%>
+ --doc-files="<%= docdirfiles.join(' ') %>" \
+<% end -%>
+ -f
+<% unless spec.extensions.empty? -%>
+%gem_cleanup
+<% end -%>
+<% if config[:post_install] -%>
+# MANUAL
+<%= config[:post_install] %>
+# /MANUAL
+
+<% end -%>
+
+<% if config[:testsuite_command] -%>
+# MANUAL
+%check
+<%= config[:testsuite_command] %>
+#/ MANUAL
+
+<% end -%>
+<% if config[:filelist] -%>
+%files
+%defattr(-,root,root,-)
+<%= config[:filelist] %>
+
+<% end -%>
+<% if config[:scripts]
+ if config[:scripts].is_a? Hash
+ config[:scripts].each do |section, content| -%>
+%<%= section %>
+<%= content %>
+
+<% end
+ else -%>
+<%= config[:scripts] %>
+
+<% end
+ end
+-%>
+<% if config[:custom_pkgs]
+ config[:custom_pkgs].each do |custom_pkg_name, data|
+-%>
+%package <%= custom_pkg_name %><%= config[:version_suffix] %>
+<% if data[:preamble] and data[:preamble] != '' -%>
+<%= data[:preamble] %>
+<% else %>
+Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
+Group: Development/Languages/Ruby
+<% end %>
+# Requires: rubygem-<%= spec.name %><%= config[:version_suffix] %> = <%= spec.version %>
+%description <%= custom_pkg_name %><%= config[:version_suffix] %>
+<% if data[:description] and data[:description] != '' -%>
+<%= data[:description] %>
+<% else %>
+<%= spec.description -%>
+
+This package holds the <%= custom_pkg_name %> sub package for <%= spec.name -%>
+<% end %>
+%files <%= custom_pkg_name %><%= config[:version_suffix] %>
+%defattr(-,root,root,-)
+<%= data[:filelist] %>
+
+<% end
+ end
+-%>
+%gem_packages
+
+%changelog
--
1.8.4.5

View File

@ -1,81 +1,16 @@
diff -ru gem2rpm-0.9.2.orig/bin/gem2rpm gem2rpm-0.9.2/bin/gem2rpm From fff45bc96294b974a25c99f626e2d5359c06d717 Mon Sep 17 00:00:00 2001
--- gem2rpm-0.9.2.orig/bin/gem2rpm 2013-04-30 13:31:08.586730796 +0200 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
+++ gem2rpm-0.9.2/bin/gem2rpm 2013-05-02 10:33:35.314236973 +0200 Date: Thu, 24 Jul 2014 17:01:17 +0200
@@ -121,9 +121,15 @@ Subject: [PATCH 4/7] openSUSE template fixes
if output_file.nil?
Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage) unless deps ---
else templates/opensuse.spec.erb | 194 ++++++++++++++++++++++++++++++++++++--------
+ oldfile=IO.readlines(output_file) if File.exists? output_file 1 file changed, 160 insertions(+), 34 deletions(-)
+ oldlicense=nil
+ oldfile.each do |line| diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb
+ m = line.match(%r{^License:\s*(\w.*)$}) index 37de592..2fb605d 100644
+ oldlicense = m[1] if m --- a/templates/opensuse.spec.erb
+ end if oldfile +++ b/templates/opensuse.spec.erb
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
Only in gem2rpm-0.9.2/bin: gem2rpm.orig
diff -ru gem2rpm-0.9.2.orig/lib/gem2rpm/specification.rb gem2rpm-0.9.2/lib/gem2rpm/specification.rb
--- gem2rpm-0.9.2.orig/lib/gem2rpm/specification.rb 2013-04-30 13:31:08.586730796 +0200
+++ gem2rpm-0.9.2/lib/gem2rpm/specification.rb 2013-05-02 10:33:35.314236973 +0200
@@ -6,7 +6,11 @@
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 @@
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}
diff -ru gem2rpm-0.9.2.orig/lib/gem2rpm.rb gem2rpm-0.9.2/lib/gem2rpm.rb
--- gem2rpm-0.9.2.orig/lib/gem2rpm.rb 2013-04-30 13:31:08.586730796 +0200
+++ gem2rpm-0.9.2/lib/gem2rpm.rb 2013-05-02 10:33:35.314236973 +0200
@@ -31,11 +31,14 @@
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)
package = Gem2Rpm::Package.new(fname)
format = Gem2Rpm::Format.new(package)
spec = Gem2Rpm::Specification.new(package.spec)
- spec.description ||= spec.summary
+ #spec.description ||= spec.summary
+ if spec.licenses.empty? && oldlicense
+ spec.licenses = oldlicense.split(' and ')
+ end
download_path = ""
unless local
begin
diff -ru gem2rpm-0.9.2.orig/templates/opensuse.spec.erb gem2rpm-0.9.2/templates/opensuse.spec.erb
--- gem2rpm-0.9.2.orig/templates/opensuse.spec.erb 2013-04-30 13:31:08.586730796 +0200
+++ gem2rpm-0.9.2/templates/opensuse.spec.erb 2014-02-06 12:50:30.021264515 +0100
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
# #
-# spec file for package rubygem-<%= spec.name %> (Version <%= spec.version %>) -# spec file for package rubygem-<%= spec.name %> (Version <%= spec.version %>)
@ -101,11 +36,11 @@ diff -ru gem2rpm-0.9.2.orig/templates/opensuse.spec.erb gem2rpm-0.9.2/templates/
-License: GPLv2+ or Ruby -License: GPLv2+ or Ruby
-# -#
+%define mod_full_name %{mod_name}-%{version} +%define mod_full_name %{mod_name}-%{version}
+<% unless spec.executables.empty? +<% unless spec.executables.empty?
+ versions=spec.version.to_s.split('.') + versions=spec.version.to_s.split('.')
+ begin v1=Integer(versions[0]) rescue v1=1 end + begin v1=Integer(versions[0]) rescue v1=1 end
+ begin v2=Integer(versions[1]) rescue v2=0 end + begin v2=Integer(versions[1]) rescue v2=0 end
+ begin v3=Integer(versions[2]) rescue v3=0 end + begin v3=Integer(versions[2]) rescue v3=0 end
+ weight=v1*10000+v2*100+v3 + weight=v1*10000+v2*100+v3
+ -%> + -%>
+%define mod_branch -%{version} +%define mod_branch -%{version}
@ -170,7 +105,7 @@ diff -ru gem2rpm-0.9.2.orig/templates/opensuse.spec.erb gem2rpm-0.9.2/templates/
%description %description
-<%= spec.description %> -<%= spec.description %>
+<%= spec.description -%> +<%= spec.description -%>
+
+<% if spec.has_rdoc -%> +<% if spec.has_rdoc -%>
+%package doc +%package doc
+Summary: RDoc documentation for %{mod_name} +Summary: RDoc documentation for %{mod_name}
@ -201,7 +136,7 @@ diff -ru gem2rpm-0.9.2.orig/templates/opensuse.spec.erb gem2rpm-0.9.2/templates/
+ docdirfiles << path if bpath == file + docdirfiles << path if bpath == file
+ } + }
+ end + end
+ +
+ test_frameworks = test_frameworks.keys.sort + test_frameworks = test_frameworks.keys.sort
+-%> +-%>
+<% unless test_frameworks.empty? -%> +<% unless test_frameworks.empty? -%>
@ -212,7 +147,7 @@ diff -ru gem2rpm-0.9.2.orig/templates/opensuse.spec.erb gem2rpm-0.9.2/templates/
+ +
+%description testsuite +%description testsuite
+Test::Unit or RSpec files, useful for developers. +Test::Unit or RSpec files, useful for developers.
+
+<% end -%> +<% end -%>
%prep %prep
+#gem_unpack +#gem_unpack
@ -303,4 +238,6 @@ diff -ru gem2rpm-0.9.2.orig/templates/opensuse.spec.erb gem2rpm-0.9.2/templates/
+ +
+<% end -%> +<% end -%>
%changelog %changelog
Only in gem2rpm-0.9.2/templates: opensuse.spec.erb~ --
1.8.4.5

View File

@ -0,0 +1,90 @@
From 4eba3dc8c65e4298e650852eeb79461fb648b675 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 17:02:56 +0200
Subject: [PATCH 5/7] added example gem2rpm.yml
---
Rakefile | 2 +-
gem2rpm.yml.documentation | 70 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+), 1 deletion(-)
create mode 100644 gem2rpm.yml.documentation
diff --git a/gem2rpm.yml.documentation b/gem2rpm.yml.documentation
new file mode 100644
index 0000000..5e444eb
--- /dev/null
+++ b/gem2rpm.yml.documentation
@@ -0,0 +1,70 @@
+# ---
+# ## used by gem2rpm
+# :summary: this is a custom summary
+# ## used by gem2rpm
+# :description: |-
+# this is a custom description
+#
+# it can be multiline
+# ## used by gem2rpm
+# :license: MIT or Ruby
+# ## used by gem2rpm and gem_packages
+# :version_suffix: -x_y
+# ## used by gem2rpm and gem_packages
+# :disable_docs: true
+# ## used by gem2rpm
+# :disable_automatic_rdoc_dep: true
+# ## used by gem2rpm
+# :preamble: |-
+# BuildRequires: foobar
+# Requires: foobar
+# ## used by gem2rpm
+# :patches:
+# foo.patch: -p1
+# bar.patch:
+# ## used by gem2rpm
+# :sources:
+# - foo.desktop
+# - bar.desktop
+# :gem_install_args: '....'
+# ## used by gem2rpm
+# :pre_install: |-
+# %if 0%{?use_system_libev}
+# export USE_VENDORED_LIBEV="no"
+# %endif
+# ## used by gem2rpm
+# :post_install: |-
+# # delete custom files here or do other fancy stuff
+# install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse
+# ## used by gem2rpm
+# :testsuite_command: |-
+# (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test)
+# ## used by gem2rpm
+# :filelist: |-
+# /usr/bin/gem2rpm-opensuse
+# ## used by gem2rpm
+# :scripts:
+# :post: |-
+# /bin/echo foo
+# ## used by gem_packages
+# :main:
+# :preamble: |-
+# Requires: util-linux
+# Recommends: pwgen
+# :filelist: |-
+# /usr/bin/gem2rpm-opensuse
+# ## used by gem_packages
+# :custom:
+# apache:
+# :preamble: |-
+# Requires: .....
+# :filelist: |-
+# /etc/apache2/conf.d/passenger.conf
+# :summary: Custom summary is optional
+# :description: |-
+# Custom description is optional
+#
+# bar
+# :post: |-
+# /bin/echo foo
+#
--
1.8.4.5

View File

@ -0,0 +1,58 @@
From b6a01a354d9b7fb0f1c9cb68c3ea58ffc34240ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 17:09:35 +0200
Subject: [PATCH 6/7] properly shorten description and summary
This also includes the description if we reuse the summary.
---
lib/gem2rpm.rb | 1 -
lib/gem2rpm/specification.rb | 14 ++++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb
index e5e2693..5261ae1 100644
--- a/lib/gem2rpm.rb
+++ b/lib/gem2rpm.rb
@@ -36,7 +36,6 @@ module Gem2Rpm
# Deprecate, kept just for backward compatibility.
format = Gem2Rpm::Format.new(package)
spec = Gem2Rpm::Specification.new(package.spec)
- spec.description ||= spec.summary
config ||= {}
download_path = ""
unless local
diff --git a/lib/gem2rpm/specification.rb b/lib/gem2rpm/specification.rb
index 9a8d5a1..2e4f7b2 100644
--- a/lib/gem2rpm/specification.rb
+++ b/lib/gem2rpm/specification.rb
@@ -7,6 +7,9 @@ module Gem2Rpm
# A long description of gem wrapped to 78 characters.
def description
d = super.to_s.chomp
+ if d.nil? or d.empty?
+ d=self.__getobj__().summary
+ end
d.gsub!(/([^.])\Z/, "\\1.")
Helpers::word_wrap(d, 78) + "\n"
end
@@ -17,6 +20,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}
--
1.8.4.5

View File

@ -0,0 +1,61 @@
From 3f955d9ed723ecf5a72bc73f3252b0d247329648 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 17:17:33 +0200
Subject: [PATCH 7/7] Preserve the license header found in the output file
---
bin/gem2rpm | 13 +++++++++++--
lib/gem2rpm.rb | 5 ++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/bin/gem2rpm b/bin/gem2rpm
index 7f28603..8a6db05 100755
--- a/bin/gem2rpm
+++ b/bin/gem2rpm
@@ -145,12 +145,21 @@ if config_file
end
# Produce a specfile
+oldlicense = nil
if output_file.nil?
- Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage, config) unless deps
+ Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage, oldlicense, config) unless deps
else
begin
+ if File.exists?(output_file)
+ File.open(output_file, 'r') do |oldfile|
+ oldfile.each_line do |line|
+ m = line.match(%r{^License:\s*(\w.*)$})
+ oldlicense = m[1] if m
+ end
+ end
+ end
out = open(output_file, "w")
- Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, config)
+ Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, oldlicense, config)
ensure
out.close()
end
diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb
index 5261ae1..d30e0f6 100644
--- a/lib/gem2rpm.rb
+++ b/lib/gem2rpm.rb
@@ -31,11 +31,14 @@ module Gem2Rpm
end
def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
- nongem=true, local=false, doc_subpackage = true, config={})
+ nongem=true, local=false, doc_subpackage = true, oldlicense=nil, config={})
package = Gem2Rpm::Package.new(fname)
# Deprecate, kept just for backward compatibility.
format = Gem2Rpm::Format.new(package)
spec = Gem2Rpm::Specification.new(package.spec)
+ if spec.licenses.empty? && oldlicense
+ spec.licenses = oldlicense.split(' and ')
+ end
config ||= {}
download_path = ""
unless local
--
1.8.4.5

BIN
gem2rpm-0.10.1.gem (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b2529e2e2091f2746fd426722bf0da459b7257d4c4a9fa3dfa81e3532b96498
size 13312

View File

@ -1,22 +0,0 @@
Index: gem2rpm-0.8.1/bin/gem2rpm
===================================================================
--- gem2rpm-0.8.1.orig/bin/gem2rpm
+++ gem2rpm-0.8.1/bin/gem2rpm
@@ -69,6 +69,16 @@ rest = opts.permute(ARGV)
template = nil
if template_file.nil?
+ f = open("/etc/os-release", "r") if File.exists?("/etc/os-release")
+ if f
+ f.read.split('\n').each do |line|
+ line.match(%r{^ID=(.*)$}) { |m| template_file=m[1] }
+ end
+ f.close
+ f = nil
+ end
+end
+if template_file.nil?
template = Gem2Rpm::TEMPLATE
else
begin

70
gem2rpm.yml.documentation Normal file
View File

@ -0,0 +1,70 @@
# ---
# ## used by gem2rpm
# :summary: this is a custom summary
# ## used by gem2rpm
# :description: |-
# this is a custom description
#
# it can be multiline
# ## used by gem2rpm
# :license: MIT or Ruby
# ## used by gem2rpm and gem_packages
# :version_suffix: -x_y
# ## used by gem2rpm and gem_packages
# :disable_docs: true
# ## used by gem2rpm
# :disable_automatic_rdoc_dep: true
# ## used by gem2rpm
# :preamble: |-
# BuildRequires: foobar
# Requires: foobar
# ## used by gem2rpm
# :patches:
# foo.patch: -p1
# bar.patch:
# ## used by gem2rpm
# :sources:
# - foo.desktop
# - bar.desktop
# :gem_install_args: '....'
# ## used by gem2rpm
# :pre_install: |-
# %if 0%{?use_system_libev}
# export USE_VENDORED_LIBEV="no"
# %endif
# ## used by gem2rpm
# :post_install: |-
# # delete custom files here or do other fancy stuff
# install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse
# ## used by gem2rpm
# :testsuite_command: |-
# (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test)
# ## used by gem2rpm
# :filelist: |-
# /usr/bin/gem2rpm-opensuse
# ## used by gem2rpm
# :scripts:
# :post: |-
# /bin/echo foo
# ## used by gem_packages
# :main:
# :preamble: |-
# Requires: util-linux
# Recommends: pwgen
# :filelist: |-
# /usr/bin/gem2rpm-opensuse
# ## used by gem_packages
# :custom:
# apache:
# :preamble: |-
# Requires: .....
# :filelist: |-
# /etc/apache2/conf.d/passenger.conf
# :summary: Custom summary is optional
# :description: |-
# Custom description is optional
#
# bar
# :post: |-
# /bin/echo foo
#

View File

@ -1,3 +1,131 @@
-------------------------------------------------------------------
Thu Jul 24 15:30:14 UTC 2014 - mrueckert@suse.de
- update to 0.10.1
- Migrate test suite to Minitest 5.x.
- Move gem binary extension and gem.build_complete file.
- Merge pull request #31 from axilleas/add_check_macro
- Add %check macro, fix typos
- Remove Requires/Provides which are now autogenerated.
- Simplify binary extensions installation according to the new
guidelines.
- Clone new template for F21 and above. Rename the old one.
- "cp -a" implies -p.
- Better open mode handling.
- Test always against rawhide template.
- List development dependencies as BuildRequires.
- Cache rendered template in tests.
- Prevent dangling symlink in -debuginfo.
- Ignore release file encoding with older Ruby (fixes #23).
- Fix generating SRPM.
- Add description dot test case.
- Add description ending dot in #description method.
- Avoid 'method is redefined' warning.
- Test against current template.
- Merge pull request #25 from xsuchy/pull-req-dot
- description should end with dot
- Merge pull request #24 from strzibny/master
- Escape % in comment
- rebased gem2rpm-change-default-template.diff, new name:
0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch
- rebased gem2rpm-0.9.2_config_file_support.patch, new name
0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch
- rebased gem2rpm-0.9.2_sles12_template.patch, new name:
0003-sle-12-templates.-they-require-the-config-file-suppo.patch
- rebased and splitted gem2rpm-fix-opensuse-template.diff, new
name:
0004-openSUSE-template-fixes.patch
0005-added-example-gem2rpm.yml.patch
0006-properly-shorten-description-and-summary.patch
0007-Preserve-the-license-header-found-in-the-output-file.patch
-------------------------------------------------------------------
Wed Jul 23 09:06:02 UTC 2014 - mrueckert@suse.de
- make sure the sle12 template is also installed
-------------------------------------------------------------------
Mon Jul 21 11:32:38 UTC 2014 - mrueckert@suse.de
- renamed gem2rpm.yml to gem2rpm.yml.documentation:
this is just documentation and not the gem2rpm.yml that gem2rpm
should pick up.
-------------------------------------------------------------------
Mon Jul 21 09:23:55 UTC 2014 - mrueckert@suse.de
- added gem2rpm-0.9.2_sles12_template.patch:
initial template for sle12 ruby packaging
-------------------------------------------------------------------
Tue Jul 15 18:43:12 UTC 2014 - mrueckert@suse.de
- added gem2rpm.yml and install it to the installed documentation
-------------------------------------------------------------------
Tue Jul 15 18:38:35 UTC 2014 - mrueckert@suse.de
- sles 12 template
- allow changing the master package name with config[:name]
This is mostly useful if you want the actual main package to
have real content after building. all the subpackages will
ignore config[:name] and still use the gem name.
-------------------------------------------------------------------
Tue Jul 15 17:21:42 UTC 2014 - mrueckert@suse.de
- sles 12 template
- add version suffix to the "spec file for ..." line
- move the preamble up so we can actually use
%define rb_build_versions ...
- config[:disable_automatic_rdoc_dep] to disable adding automatic
rdoc dependency. This is mostly needed for building rdoc itself
and avoiding a bootstrap cycle.
- actually print the patch name in the preamble
- the scripts entry in gem2rpm.yml can now be a hash or a string.
-------------------------------------------------------------------
Tue Jul 15 14:27:57 UTC 2014 - mrueckert@suse.de
- sles 12 template
- no longer print the gem2rpm.yml warning when the config is empty
- add back mod_version_suffix to the spec file
(needed for gem_install)
- converted buildrequires for ruby and ruby-devel to the macros so
we can easily pull multiple ruby versions and also easily limit
the ruby versions
- always buildrequire gem2rpm in generated spec files. It is the
only clean way to solve the "have choive for rubygem(gem2rpm)"
and still maintaining the multiversion ability
- handle config[:disable_docs] and pass --no-rdoc --no-ri to
gem_install in that case. (mostly a workaround for the rdoc bug
with the fastthread gem)
- added support to specify the content of the %check section.
-------------------------------------------------------------------
Fri Jul 11 08:23:20 UTC 2014 - mrueckert@suse.de
- if the config is nil, set it to an empty hash. this allows for
less noisy template files.
- more updates for the sle 12 template.
-------------------------------------------------------------------
Thu Jul 10 16:27:03 UTC 2014 - mrueckert@suse.de
- added new tag :sources in the yaml file to track additional
sources. this makde the next change much easier.
- make sure the config file that is passed to gem2rpm is also
appended to the sources list automatically.
- added template for sles12 (gem2rpm-0.9.2_sles12_template.patch)
-------------------------------------------------------------------
Thu Jul 10 14:52:01 UTC 2014 - mrueckert@suse.de
- added gem2rpm-0.9.2_config_file_support.patch:
added basic config file support to gem2rpm in yaml format. there
is no validation as it is basically a hash where certain keys
are picked up by our templates.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 6 11:52:43 UTC 2014 - coolo@suse.com Thu Feb 6 11:52:43 UTC 2014 - coolo@suse.com

View File

@ -17,25 +17,32 @@
Name: rubygem-gem2rpm Name: rubygem-gem2rpm
Version: 0.9.2 Version: 0.10.1
Release: 0 Release: 0
%define mod_name gem2rpm %define mod_name gem2rpm
%define mod_full_name %{mod_name}-%{version} %define mod_full_name %{mod_name}-%{version}
%define mod_branch -%{version}
%define mod_weight 1001
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: ruby-macros >= 1 BuildRequires: ruby-macros >= 1
%rubygems_requires %rubygems_requires
Url: https://github.com/lutter/gem2rpm/ Url: https://github.com/lutter/gem2rpm/
Source: http://rubygems.org/gems/%{mod_full_name}.gem Source: http://rubygems.org/gems/%{mod_full_name}.gem
Source1: gem2rpm.yml.documentation
Source2: gem2rpm-opensuse Source2: gem2rpm-opensuse
Patch0: gem2rpm-fix-opensuse-template.diff
Patch1: gem2rpm-change-default-template.diff
Patch0: 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch
Patch1: 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch
Patch2: 0003-sle-12-templates.-they-require-the-config-file-suppo.patch
Patch3: 0004-openSUSE-template-fixes.patch
Patch4: 0005-added-example-gem2rpm.yml.patch
Patch5: 0006-properly-shorten-description-and-summary.patch
Patch6: 0007-Preserve-the-license-header-found-in-the-output-file.patch
Summary: Generate rpm specfiles from gems Summary: Generate rpm specfiles from gems
License: GPL-2.0+ License: GPL-2.0+
Group: Development/Languages/Ruby Group: Development/Languages/Ruby
%define mod_branch -%{version}
%define mod_weight 9
PreReq: update-alternatives PreReq: update-alternatives
%description %description
@ -55,6 +62,11 @@ Usually in RDoc and RI formats.
%gem_unpack %gem_unpack
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build %build
%gem_build %gem_build
@ -64,6 +76,9 @@ Usually in RDoc and RI formats.
%{__install} -D -m 0755 %{S:2} %{buildroot}%{_bindir}/gem2rpm-opensuse %{__install} -D -m 0755 %{S:2} %{buildroot}%{_bindir}/gem2rpm-opensuse
mv %{buildroot}%{_bindir}/gem2rpm{,%{mod_branch}} mv %{buildroot}%{_bindir}/gem2rpm{,%{mod_branch}}
ln -s gem2rpm%{mod_branch} %{buildroot}%{_bindir}/gem2rpm ln -s gem2rpm%{mod_branch} %{buildroot}%{_bindir}/gem2rpm
cp %{S:1} gem2rpm.yml
install -m 0644 %{mod_full_name}/templates/sles12*.spec.erb \
%{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/templates/
%post %post
/usr/sbin/update-alternatives --install \ /usr/sbin/update-alternatives --install \
@ -76,6 +91,7 @@ fi
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc gem2rpm.yml %{mod_full_name}/templates/sles12*.spec.erb
%{_bindir}/gem2rpm%{mod_branch} %{_bindir}/gem2rpm%{mod_branch}
%ghost %{_bindir}/gem2rpm %ghost %{_bindir}/gem2rpm
%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem %{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem