- refreshed patch series to match the git again:

M 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch
  M 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch
  A 0003-new-opensuse-templates.-they-require-the-config-file.patch
  A 0004-added-example-gem2rpm.yml.patch
  A 0005-properly-shorten-description-and-summary.patch
  A 0006-Preserve-the-license-header-found-in-the-output-file.patch
  A 0007-fixes-for-the-opensuse-template.patch
  A 0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch
  D 0003-sle-12-templates.-they-require-the-config-file-suppo.patch
  D 0004-openSUSE-template-fixes.patch
  D 0005-added-example-gem2rpm.yml.patch
  D 0006-properly-shorten-description-and-summary.patch
  D 0007-Preserve-the-license-header-found-in-the-output-file.patch
  D 0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch
  D 0009-rubinius-has-no-extensions-docdir.patch
  D 0010-switch-to-new-packaging-scheme-by-default.patch
  D 0011-fixes-for-the-opensuse-template.patch
- new patch for fixing usage of not() which breaks on 1.8

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/rubygem-gem2rpm?expand=0&rev=8
This commit is contained in:
Marcus Rückert 2014-10-21 13:08:21 +00:00 committed by Git OBS Bridge
parent 681bf2325c
commit ec53805b8a
14 changed files with 173 additions and 1408 deletions

View File

@ -1,7 +1,7 @@
From 91bc63e3fbba24a5f90c4fce4f74b371c4694657 Mon Sep 17 00:00:00 2001 From 91bc63e3fbba24a5f90c4fce4f74b371c4694657 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de> From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 16:46:19 +0200 Date: Thu, 24 Jul 2014 16:46:19 +0200
Subject: [PATCH 01/10] - use the ID from os-release to use the proper template Subject: [PATCH 1/8] - use the ID from os-release to use the proper template
--- ---
bin/gem2rpm | 10 ++++++++++ bin/gem2rpm | 10 ++++++++++

View File

@ -1,7 +1,7 @@
From 1742038eb7ec8fcb25009ce8b270b420183875bc Mon Sep 17 00:00:00 2001 From 1742038eb7ec8fcb25009ce8b270b420183875bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de> From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 16:54:45 +0200 Date: Thu, 24 Jul 2014 16:54:45 +0200
Subject: [PATCH 02/10] added basic config file support to gem2rpm in yaml Subject: [PATCH 2/8] added basic config file support to gem2rpm in yaml
format. format.
There is no validation as it is basically a hash where certain keys are There is no validation as it is basically a hash where certain keys are

View File

@ -1,21 +1,21 @@
From 152e9ec100f30a3c46535a65fa411d014cb264e2 Mon Sep 17 00:00:00 2001 From 5e1e30e5addc99825b3bf873983ca48732493060 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de> From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 16:55:57 +0200 Date: Thu, 24 Jul 2014 16:55:57 +0200
Subject: [PATCH 03/10] sle 12 templates. they require the config file support. Subject: [PATCH 3/8] new opensuse templates. they require the config file
support.
--- ---
templates/sles12.gem_packages.spec.erb | 233 +++++++++++++++++++++++++++++++++ templates/gem_packages.spec.erb | 236 ++++++++++++++++++++++++++++++++++++++++
templates/sles12.spec.erb | 215 ++++++++++++++++++++++++++++++ templates/opensuse.spec.erb | 213 ++++++++++++++++++++++++++++++------
2 files changed, 448 insertions(+) 2 files changed, 414 insertions(+), 35 deletions(-)
create mode 100644 templates/sles12.gem_packages.spec.erb create mode 100644 templates/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 diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb
new file mode 100644 new file mode 100644
index 0000000..5b02f2c index 0000000..d1734db
--- /dev/null --- /dev/null
+++ b/templates/sles12.gem_packages.spec.erb +++ b/templates/gem_packages.spec.erb
@@ -0,0 +1,233 @@ @@ -0,0 +1,236 @@
+<% +<%
+ def self.patch_mod_full_name(path, mod_full_name) + def self.patch_mod_full_name(path, mod_full_name)
+ path.gsub(/\/-/, "/#{mod_full_name}") + path.gsub(/\/-/, "/#{mod_full_name}")
@ -27,7 +27,7 @@ index 0000000..5b02f2c
+ end + end
+ +
+ def self.get_extension_doc_dir(gem_spec) + def self.get_extension_doc_dir(gem_spec)
+ if gem_spec.respond_to? :extensions_dir + if gem_spec.respond_to?(:extensions_dir) && RUBY_ENGINE != 'rbx'
+ rp = gem_spec.extensions_dir.rpartition(gem_spec.base_dir) + rp = gem_spec.extensions_dir.rpartition(gem_spec.base_dir)
+ return File.join(rp[1], 'doc', rp[2]) + return File.join(rp[1], 'doc', rp[2])
+ end + end
@ -67,6 +67,9 @@ index 0000000..5b02f2c
+ +
+ rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '') + rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '')
+ rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '') + rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '')
+ if rb_suffix =~ /\A\d+\.\d+\z/
+ rb_suffix = '.ruby' + rb_suffix
+ end
+ pkg_basename = rb_pkgname + '-rubygem-' + spec.name + pkg_basename = rb_pkgname + '-rubygem-' + spec.name
+ +
+ mod_full_name = "#{spec.name}-#{spec.version}" + mod_full_name = "#{spec.name}-#{spec.version}"
@ -249,28 +252,24 @@ index 0000000..5b02f2c
+ end + end
+ end + end
+-%> +-%>
diff --git a/templates/sles12.spec.erb b/templates/sles12.spec.erb diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb
new file mode 100644 index 37de592..25fdec3 100644
index 0000000..25fdec3 --- a/templates/opensuse.spec.erb
--- /dev/null +++ b/templates/opensuse.spec.erb
+++ b/templates/sles12.spec.erb @@ -1,7 +1,7 @@
@@ -0,0 +1,215 @@ #
+# -# spec file for package rubygem-<%= spec.name %> (Version <%= spec.version %>)
+# spec file for package rubygem-<%= spec.name %><%= config[:version_suffix] %> +# spec file for package rubygem-<%= spec.name %><%= config[:version_suffix] %>
+# #
-# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) <%= Time.now.year %> 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 # All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the @@ -14,59 +14,202 @@
+# 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 # Please submit bugfixes or comments via http://bugs.opensuse.org/
+# 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?) -%> +<% if config && not(config.empty?) -%>
+# +#
+# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# This file was generated with a gem2rpm.yml and not just plain gem2rpm.
@ -279,11 +278,17 @@ index 0000000..25fdec3
+# of those fields +# of those fields
+# +#
+<% end -%> +<% end -%>
+
-# norootforbuild
-Name: rubygem-<%= spec.name %>
+Name: <%= config[:name] ? config[:name] : "rubygem-#{spec.name}#{config[:version_suffix]}" %> +Name: <%= config[:name] ? config[:name] : "rubygem-#{spec.name}#{config[:version_suffix]}" %>
+Version: <%= spec.version %> Version: <%= spec.version %>
+Release: 0 Release: 0
+%define mod_name <%= spec.name %> %define mod_name <%= spec.name %>
-#
-Group: Development/Languages/Ruby
-License: GPLv2+ or Ruby
-#
+%define mod_full_name %{mod_name}-%{version} +%define mod_full_name %{mod_name}-%{version}
+<% if config[:version_suffix] -%> +<% if config[:version_suffix] -%>
+%define mod_version_suffix <%= config[:version_suffix] %> +%define mod_version_suffix <%= config[:version_suffix] %>
@ -293,7 +298,15 @@ index 0000000..25fdec3
+<%= config[:preamble] %> +<%= config[:preamble] %>
+# /MANUAL +# /MANUAL
+<% end -%> +<% end -%>
+BuildRoot: %{_tmppath}/%{name}-%{version}-build 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 >= 5 +BuildRequires: ruby-macros >= 5
+<% for req in spec.required_ruby_version -%> +<% for req in spec.required_ruby_version -%>
+<% unless req.empty? -%> +<% unless req.empty? -%>
@ -309,14 +322,18 @@ index 0000000..25fdec3
+BuildRequires: %{rubydevel} +BuildRequires: %{rubydevel}
+<% end -%> +<% end -%>
+<% end -%> +<% end -%>
+<% end -%> <% end -%>
-<% for d in spec.dependencies -%>
+<% for d in spec.runtime_dependencies -%> +<% for d in spec.runtime_dependencies -%>
+<% if ['rdoc'].include? d.name.to_s -%> +<% if ['rdoc'].include? d.name.to_s -%>
+# <%= d.name %> <%= d.__getobj__().requirement %> +# <%= d.name %> <%= d.__getobj__().requirement %>
+<% for req in d.requirement -%> <% for req in d.requirement -%>
-BuildRequires: rubygem-<%= d.name %> <%= req %>
-Requires: rubygem-<%= d.name %> <%= req %>
+BuildRequires: %{rubygem <%= d.name %> <%= req %>} +BuildRequires: %{rubygem <%= d.name %> <%= req %>}
+<% end -%> <% end -%>
+<% end -%> <% end -%>
-#
+<% end -%> +<% end -%>
+BuildRequires: %{rubygem gem2rpm} +BuildRequires: %{rubygem gem2rpm}
+<% unless spec.rdoc_options.empty? || config[:disable_automatic_rdoc_dep] -%> +<% unless spec.rdoc_options.empty? || config[:disable_automatic_rdoc_dep] -%>
@ -326,7 +343,10 @@ index 0000000..25fdec3
+BuildRequires: update-alternatives +BuildRequires: update-alternatives
+<% end -%> +<% end -%>
+<% unless spec.homepage.nil? || spec.homepage.empty? -%> +<% unless spec.homepage.nil? || spec.homepage.empty? -%>
+Url: <%= spec.homepage %> Url: <%= spec.homepage %>
-Source: %{mod_name}-%{version}.gem
-#
-Summary: <%= spec.summary.gsub(/\.$/, "") %>
+<% end -%> +<% end -%>
+Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source: http://rubygems.org/gems/%{mod_full_name}.gem
+<% if config[:sources] +<% if config[:sources]
@ -348,7 +368,8 @@ index 0000000..25fdec3
+PreReq: update-alternatives +PreReq: update-alternatives
+<% end -%> +<% end -%>
+ +
+%description %description
-<%= spec.description %>
+<%= config[:description] or spec.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 +<% # TODO move into gem2rpm as gem_packages.sh also need this and we only leave it here for getting the docfiles list
@ -371,10 +392,10 @@ index 0000000..25fdec3
+ docdirfiles << path if bpath == file + docdirfiles << path if bpath == file
+ } + }
+ end + end
+
+ test_frameworks = test_frameworks.keys.sort + test_frameworks = test_frameworks.keys.sort
+-%> +-%>
+%prep %prep
+<% unless config[:patches].nil? or config[:patches].empty? -%> +<% unless config[:patches].nil? or config[:patches].empty? -%>
+%gem_unpack +%gem_unpack
+<% config[:patches].each_with_index do |patch, i| -%> +<% config[:patches].each_with_index do |patch, i| -%>
@ -383,9 +404,11 @@ index 0000000..25fdec3
+%gem_build +%gem_build
+<% end -%> +<% end -%>
+ +
+%build %build
+ +
+%install %install
-%gem_install %{S:0}
-<% unless spec.extensions.empty? %>
+<% if config[:pre_install] -%> +<% if config[:pre_install] -%>
+# MANUAL +# MANUAL
+<%= config[:pre_install] %> +<%= config[:pre_install] %>
@ -406,7 +429,8 @@ index 0000000..25fdec3
+<% end -%> +<% end -%>
+ -f + -f
+<% unless spec.extensions.empty? -%> +<% unless spec.extensions.empty? -%>
+%gem_cleanup %gem_cleanup
-<% end %>
+<% end -%> +<% end -%>
+<% if config[:post_install] -%> +<% if config[:post_install] -%>
+# MANUAL +# MANUAL
@ -414,17 +438,21 @@ index 0000000..25fdec3
+# /MANUAL +# /MANUAL
+ +
+<% end -%> +<% end -%>
+
-%clean
-%{__rm} -rf %{buildroot}
+<% if config[:testsuite_command] -%> +<% if config[:testsuite_command] -%>
+# MANUAL +# MANUAL
+%check +%check
+<%= config[:testsuite_command] %> +<%= config[:testsuite_command] %>
+#/ MANUAL +#/ MANUAL
+
+<% end -%> +<% end -%>
+<% if config[:filelist] -%> +<% if config[:filelist] -%>
+%files %files
+%defattr(-,root,root,-) %defattr(-,root,root,-)
-<% spec.executables.each do |executable| %>
-%{_bindir}/<%= executable %>
+<%= config[:filelist] %> +<%= config[:filelist] %>
+ +
+<% end -%> +<% end -%>
@ -450,7 +478,11 @@ index 0000000..25fdec3
+<% else %> +<% else %>
+Summary: <%= custom_pkg_name %> sub package for <%= spec.name %> +Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
+Group: Development/Languages/Ruby +Group: Development/Languages/Ruby
+<% end %> <% 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}/
+# Requires: rubygem-<%= spec.name %><%= config[:version_suffix] %> = <%= spec.version %> +# Requires: rubygem-<%= spec.name %><%= config[:version_suffix] %> = <%= spec.version %>
+%description <%= custom_pkg_name %><%= config[:version_suffix] %> +%description <%= custom_pkg_name %><%= config[:version_suffix] %>
+<% if data[:description] and data[:description] != '' -%> +<% if data[:description] and data[:description] != '' -%>
@ -468,8 +500,8 @@ index 0000000..25fdec3
+ end + end
+-%> +-%>
+%gem_packages +%gem_packages
+
+%changelog %changelog
-- --
1.8.4.5 1.8.4.5

View File

@ -1,7 +1,7 @@
From 4eba3dc8c65e4298e650852eeb79461fb648b675 Mon Sep 17 00:00:00 2001 From f408e57b282cd55d59c1317240ee9e0dc679373c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de> From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 17:02:56 +0200 Date: Thu, 24 Jul 2014 17:02:56 +0200
Subject: [PATCH 05/10] added example gem2rpm.yml Subject: [PATCH 4/8] added example gem2rpm.yml
--- ---
Rakefile | 2 +- Rakefile | 2 +-

View File

@ -1,243 +0,0 @@
From fff45bc96294b974a25c99f626e2d5359c06d717 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 17:01:17 +0200
Subject: [PATCH 04/10] openSUSE template fixes
---
templates/opensuse.spec.erb | 194 ++++++++++++++++++++++++++++++++++++--------
1 file changed, 160 insertions(+), 34 deletions(-)
diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb
index 37de592..2fb605d 100644
--- a/templates/opensuse.spec.erb
+++ b/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,184 @@
# 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}
+<% unless spec.executables.empty?
+ 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
+ -%>
+%define mod_branch -%{version}
+%define mod_weight <%= weight %>
+<% end -%>
+
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 >= 3
+<% for req in spec.required_ruby_version -%>
+<% unless req.empty? -%>
+Requires: ruby <%= req %>
+BuildRequires: ruby <%= req %>
<% end -%>
-<% for d in spec.dependencies -%>
+<% end -%>
+<% unless spec.extensions.empty? -%>
+BuildRequires: ruby-devel
+<% 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.executables.empty? -%>
+BuildRequires: update-alternatives
+<% end -%>
+<% unless spec.homepage.nil? || spec.homepage.empty? -%>
Url: <%= spec.homepage %>
-Source: %{mod_name}-%{version}.gem
-#
-Summary: <%= spec.summary.gsub(/\.$/, "") %>
+<% end -%>
+Source: http://rubygems.org/gems/%{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
+<% unless spec.executables.empty? -%>
+PreReq: update-alternatives
+<% end -%>
+
%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 = 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 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 %>
+<% end -%>
+<% unless spec.executables.empty? -%>
+mkdir -p %{buildroot}%{_sysconfdir}/alternatives
+<% end -%>
+<% spec.executables.each do |executable| -%>
+mv %{buildroot}%{_bindir}/<%= executable %>{,%{mod_branch}}
+touch %{buildroot}%{_sysconfdir}/alternatives/<%= executable %>
+ln -s %{_sysconfdir}/alternatives/<%= executable %> %{buildroot}%{_bindir}/<%= executable %>
-%clean
-%{__rm} -rf %{buildroot}
+<% end -%>
+<% unless docdirfiles.empty? -%>
+mkdir -p %{buildroot}%{_docdir}/%{name}
+<% docdirfiles.each do |file| -%>
+ln -s %{gem_base}/gems/%{mod_full_name}/<%= file %> %buildroot/%{_docdir}/%{name}/<%= file %>
+<% end -%>
+<% end -%>
+<% unless spec.executables.empty? -%>
+
+%post
+<% spec.executables.each do |executable| -%>
+/usr/sbin/update-alternatives --install \
+ %{_bindir}/<%= executable %> <%= executable %> %{_bindir}/<%= executable %>%{mod_branch} %{mod_weight}
+<% end -%>
+
+%preun
+<% spec.executables.each do |executable| -%>
+if [ "$1" = 0 ] ; then
+ /usr/sbin/update-alternatives --remove <%= executable %> %{_bindir}/<%= executable %>%{mod_branch}
+fi
+<% end -%>
+<% end -%>
%files
%defattr(-,root,root,-)
-<% spec.executables.each do |executable| %>
+<% unless docdirfiles.empty? -%>
+%{_docdir}/%{name}
+<% end -%>
+<% spec.executables.each do |executable| -%>
+%{_bindir}/<%= executable %>%{mod_branch}
%{_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}/
+%ghost %{_sysconfdir}/alternatives/<%= executable %>
+<% end -%>
+%{gem_base}/cache/%{mod_full_name}.gem
+%{gem_base}/gems/%{mod_full_name}/
+<% unless spec.extensions.empty? -%>
+%{gem_extensions}/%{mod_full_name}
+<% end -%>
+<% test_frameworks.each do |framework| -%>
+%exclude %{gem_base}/gems/%{mod_full_name}/<%= framework %>
+<% end -%>
+%{gem_base}/specifications/%{mod_full_name}.gemspec
+<% if spec.has_rdoc -%>
+%files doc
+%defattr(-,root,root,-)
+%doc %{gem_base}/doc
+
+<% end -%>
+<% unless test_frameworks.empty? -%>
+%files testsuite
+%defattr(-,root,root,-)
+<% test_frameworks.each do |framework| -%>
+%{gem_base}/gems/%{mod_full_name}/<%= framework %>
+<% end -%>
+
+<% end -%>
%changelog
--
1.8.4.5

View File

@ -1,7 +1,7 @@
From b6a01a354d9b7fb0f1c9cb68c3ea58ffc34240ba Mon Sep 17 00:00:00 2001 From da07cd470611c3c6b70fc863e2d82a2862a068e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de> From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 17:09:35 +0200 Date: Thu, 24 Jul 2014 17:09:35 +0200
Subject: [PATCH 06/10] properly shorten description and summary Subject: [PATCH 5/8] properly shorten description and summary
This also includes the description if we reuse the summary. This also includes the description if we reuse the summary.
--- ---

View File

@ -1,7 +1,7 @@
From 3f955d9ed723ecf5a72bc73f3252b0d247329648 Mon Sep 17 00:00:00 2001 From 0f22d81f982e02523c852521a5b94db657fe6673 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de> From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Thu, 24 Jul 2014 17:17:33 +0200 Date: Thu, 24 Jul 2014 17:17:33 +0200
Subject: [PATCH 07/10] Preserve the license header found in the output file Subject: [PATCH 6/8] Preserve the license header found in the output file
--- ---
bin/gem2rpm | 13 +++++++++++-- bin/gem2rpm | 13 +++++++++++--

View File

@ -1,13 +1,16 @@
commit eed51b54253c303c593d9466ed8ed17523bda3d1 From eed51b54253c303c593d9466ed8ed17523bda3d1 Mon Sep 17 00:00:00 2001
Author: Stephan Kulow <coolo@suse.de> From: Stephan Kulow <coolo@suse.de>
Date: Wed Oct 15 10:38:29 2014 +0200 Date: Wed, 15 Oct 2014 10:38:29 +0200
Subject: [PATCH 7/8] fixes for the opensuse template:
fixes for the opensuse template: - add one more space for sources
- add empty lines in front of the warning preamble - otherwise format_spec_file
- add one more space for sources
- add empty lines in front of the warning preamble - otherwise format_spec_file
removes it as old license comment removes it as old license comment
- don't %ghost %_bindir - don't %ghost %_bindir
---
templates/gem_packages.spec.erb | 6 +++---
templates/opensuse.spec.erb | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb
index d1734db..058660b 100644 index d1734db..058660b 100644
@ -48,3 +51,6 @@ index 25fdec3..8bc281c 100644
<% end <% end
end -%> end -%>
<% if config[:patches] -%> <% if config[:patches] -%>
--
1.8.4.5

View File

@ -0,0 +1,34 @@
From ba7932c7d7bc6a70a45ac6ebb841a9e1bf8bb86b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <darix@nordisch.org>
Date: Tue, 21 Oct 2014 14:54:55 +0200
Subject: [PATCH 8/8] do not use not(). not supported on 1.8 e.g.
---
templates/gem_packages.spec.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb
index 058660b..94d4005 100644
--- a/templates/gem_packages.spec.erb
+++ b/templates/gem_packages.spec.erb
@@ -96,7 +96,7 @@ PreReq: update-alternatives
%description -n <%= pkg_basename %><%= config[:version_suffix] %>
<%= config[:description] or spec.description -%>
-<% if spec.has_rdoc && not(config[:disable_docs]) -%>
+<% if spec.has_rdoc && !(config[:disable_docs]) -%>
%package -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
Summary: RDoc documentation for <%= spec.name %>
Group: Development/Languages/Ruby
@@ -191,7 +191,7 @@ fi
<% end -%>
<%= gem_spec_dir %>/<%= mod_full_name -%>.gemspec
-<% if spec.has_rdoc && not(config[:disable_docs]) -%>
+<% if spec.has_rdoc && !(config[:disable_docs]) -%>
%files -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
%defattr(-,root,root,-)
%doc <%= gem_doc_dir %>
--
1.8.4.5

View File

@ -1,27 +0,0 @@
From 3bd29ca337636665ecca5b68590d0c32fd11e92d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Wed, 17 Sep 2014 16:50:21 +0200
Subject: [PATCH 08/10] dont allow suffixes with just a plain number. prefix
them with ruby.
---
templates/sles12.gem_packages.spec.erb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/templates/sles12.gem_packages.spec.erb b/templates/sles12.gem_packages.spec.erb
index 5b02f2c..e148494 100644
--- a/templates/sles12.gem_packages.spec.erb
+++ b/templates/sles12.gem_packages.spec.erb
@@ -49,6 +49,9 @@
rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '')
rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '')
+ if rb_suffix =~ /\A\d+\.\d+\z/
+ rb_suffix = '.ruby' + rb_suffix
+ end
pkg_basename = rb_pkgname + '-rubygem-' + spec.name
mod_full_name = "#{spec.name}-#{spec.version}"
--
1.8.4.5

View File

@ -1,25 +0,0 @@
From 0abcc03623950eafddf0dd2bd1a96cea6756063f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Wed, 17 Sep 2014 17:11:52 +0200
Subject: [PATCH 09/10] rubinius has no extensions docdir
---
templates/sles12.gem_packages.spec.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/sles12.gem_packages.spec.erb b/templates/sles12.gem_packages.spec.erb
index e148494..d1734db 100644
--- a/templates/sles12.gem_packages.spec.erb
+++ b/templates/sles12.gem_packages.spec.erb
@@ -9,7 +9,7 @@
end
def self.get_extension_doc_dir(gem_spec)
- if gem_spec.respond_to? :extensions_dir
+ if gem_spec.respond_to?(:extensions_dir) && RUBY_ENGINE != 'rbx'
rp = gem_spec.extensions_dir.rpartition(gem_spec.base_dir)
return File.join(rp[1], 'doc', rp[2])
end
--
1.8.4.5

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Tue Oct 21 13:06:09 UTC 2014 - mrueckert@suse.de
- refreshed patch series to match the git again:
M 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch
M 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch
A 0003-new-opensuse-templates.-they-require-the-config-file.patch
A 0004-added-example-gem2rpm.yml.patch
A 0005-properly-shorten-description-and-summary.patch
A 0006-Preserve-the-license-header-found-in-the-output-file.patch
A 0007-fixes-for-the-opensuse-template.patch
A 0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch
D 0003-sle-12-templates.-they-require-the-config-file-suppo.patch
D 0004-openSUSE-template-fixes.patch
D 0005-added-example-gem2rpm.yml.patch
D 0006-properly-shorten-description-and-summary.patch
D 0007-Preserve-the-license-header-found-in-the-output-file.patch
D 0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch
D 0009-rubinius-has-no-extensions-docdir.patch
D 0010-switch-to-new-packaging-scheme-by-default.patch
D 0011-fixes-for-the-opensuse-template.patch
- new patch for fixing usage of not() which breaks on 1.8
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Oct 15 08:44:14 UTC 2014 - coolo@suse.com Wed Oct 15 08:44:14 UTC 2014 - coolo@suse.com

View File

@ -46,15 +46,12 @@ Source2: gem2rpm-opensuse
Source3: series Source3: series
Patch0: 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch 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 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 Patch2: 0003-new-opensuse-templates.-they-require-the-config-file.patch
Patch3: 0004-openSUSE-template-fixes.patch Patch3: 0004-added-example-gem2rpm.yml.patch
Patch4: 0005-added-example-gem2rpm.yml.patch Patch4: 0005-properly-shorten-description-and-summary.patch
Patch5: 0006-properly-shorten-description-and-summary.patch Patch5: 0006-Preserve-the-license-header-found-in-the-output-file.patch
Patch6: 0007-Preserve-the-license-header-found-in-the-output-file.patch Patch6: 0007-fixes-for-the-opensuse-template.patch
Patch7: 0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch Patch7: 0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch
Patch8: 0009-rubinius-has-no-extensions-docdir.patch
Patch9: 0010-switch-to-new-packaging-scheme-by-default.patch
Patch10: 0011-fixes-for-the-opensuse-template.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
@ -74,9 +71,6 @@ The spec file tries to follow the gem as closely as possible
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build %build
%gem_build %gem_build