diff --git a/0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch b/0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch index f835e51..53e6804 100644 --- a/0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch +++ b/0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch @@ -1,7 +1,7 @@ From 91bc63e3fbba24a5f90c4fce4f74b371c4694657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= Date: Thu, 24 Jul 2014 16:46:19 +0200 -Subject: [PATCH 1/7] - use the ID from os-release to use the proper template +Subject: [PATCH 01/10] - use the ID from os-release to use the proper template --- bin/gem2rpm | 10 ++++++++++ diff --git a/0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch b/0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch index 746c188..cf392cc 100644 --- a/0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch +++ b/0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch @@ -1,7 +1,7 @@ From 1742038eb7ec8fcb25009ce8b270b420183875bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= Date: Thu, 24 Jul 2014 16:54:45 +0200 -Subject: [PATCH 2/7] added basic config file support to gem2rpm in yaml +Subject: [PATCH 02/10] added basic config file support to gem2rpm in yaml format. There is no validation as it is basically a hash where certain keys are diff --git a/0003-sle-12-templates.-they-require-the-config-file-suppo.patch b/0003-sle-12-templates.-they-require-the-config-file-suppo.patch index 6a6da04..354f2ab 100644 --- a/0003-sle-12-templates.-they-require-the-config-file-suppo.patch +++ b/0003-sle-12-templates.-they-require-the-config-file-suppo.patch @@ -1,7 +1,7 @@ From 152e9ec100f30a3c46535a65fa411d014cb264e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= Date: Thu, 24 Jul 2014 16:55:57 +0200 -Subject: [PATCH 3/7] sle 12 templates. they require the config file support. +Subject: [PATCH 03/10] sle 12 templates. they require the config file support. --- templates/sles12.gem_packages.spec.erb | 233 +++++++++++++++++++++++++++++++++ diff --git a/0004-openSUSE-template-fixes.patch b/0004-openSUSE-template-fixes.patch index 8f39d0d..f0506e9 100644 --- a/0004-openSUSE-template-fixes.patch +++ b/0004-openSUSE-template-fixes.patch @@ -1,7 +1,7 @@ From fff45bc96294b974a25c99f626e2d5359c06d717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= Date: Thu, 24 Jul 2014 17:01:17 +0200 -Subject: [PATCH 4/7] openSUSE template fixes +Subject: [PATCH 04/10] openSUSE template fixes --- templates/opensuse.spec.erb | 194 ++++++++++++++++++++++++++++++++++++-------- diff --git a/0005-added-example-gem2rpm.yml.patch b/0005-added-example-gem2rpm.yml.patch index 0fa4d78..dc2907f 100644 --- a/0005-added-example-gem2rpm.yml.patch +++ b/0005-added-example-gem2rpm.yml.patch @@ -1,7 +1,7 @@ From 4eba3dc8c65e4298e650852eeb79461fb648b675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= Date: Thu, 24 Jul 2014 17:02:56 +0200 -Subject: [PATCH 5/7] added example gem2rpm.yml +Subject: [PATCH 05/10] added example gem2rpm.yml --- Rakefile | 2 +- diff --git a/0006-properly-shorten-description-and-summary.patch b/0006-properly-shorten-description-and-summary.patch index 0d067b2..ad3c6c7 100644 --- a/0006-properly-shorten-description-and-summary.patch +++ b/0006-properly-shorten-description-and-summary.patch @@ -1,7 +1,7 @@ From b6a01a354d9b7fb0f1c9cb68c3ea58ffc34240ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= Date: Thu, 24 Jul 2014 17:09:35 +0200 -Subject: [PATCH 6/7] properly shorten description and summary +Subject: [PATCH 06/10] properly shorten description and summary This also includes the description if we reuse the summary. --- diff --git a/0007-Preserve-the-license-header-found-in-the-output-file.patch b/0007-Preserve-the-license-header-found-in-the-output-file.patch index d8d468d..dc0482c 100644 --- a/0007-Preserve-the-license-header-found-in-the-output-file.patch +++ b/0007-Preserve-the-license-header-found-in-the-output-file.patch @@ -1,7 +1,7 @@ From 3f955d9ed723ecf5a72bc73f3252b0d247329648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= Date: Thu, 24 Jul 2014 17:17:33 +0200 -Subject: [PATCH 7/7] Preserve the license header found in the output file +Subject: [PATCH 07/10] Preserve the license header found in the output file --- bin/gem2rpm | 13 +++++++++++-- diff --git a/0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch b/0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch new file mode 100644 index 0000000..b0abc25 --- /dev/null +++ b/0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch @@ -0,0 +1,27 @@ +From 3bd29ca337636665ecca5b68590d0c32fd11e92d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcus=20R=C3=BCckert?= +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 + diff --git a/0009-rubinius-has-no-extensions-docdir.patch b/0009-rubinius-has-no-extensions-docdir.patch new file mode 100644 index 0000000..b947727 --- /dev/null +++ b/0009-rubinius-has-no-extensions-docdir.patch @@ -0,0 +1,25 @@ +From 0abcc03623950eafddf0dd2bd1a96cea6756063f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcus=20R=C3=BCckert?= +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 + diff --git a/0010-switch-to-new-packaging-scheme-by-default.patch b/0010-switch-to-new-packaging-scheme-by-default.patch new file mode 100644 index 0000000..259a66d --- /dev/null +++ b/0010-switch-to-new-packaging-scheme-by-default.patch @@ -0,0 +1,1029 @@ +From 75252d49a39cf0bbcd0f971340bdf12d8c002794 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcus=20R=C3=BCckert?= +Date: Mon, 13 Oct 2014 15:40:37 +0200 +Subject: [PATCH 10/10] switch to new packaging scheme by default + +--- + templates/gem_packages.spec.erb | 236 +++++++++++++++++++++++++++++++++ + templates/opensuse.spec.erb | 233 +++++++++++++++++--------------- + templates/sles12.gem_packages.spec.erb | 236 --------------------------------- + templates/sles12.spec.erb | 215 ------------------------------ + 4 files changed, 361 insertions(+), 559 deletions(-) + create mode 100644 templates/gem_packages.spec.erb + delete mode 100644 templates/sles12.gem_packages.spec.erb + delete mode 100644 templates/sles12.spec.erb + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +new file mode 100644 +index 0000000..d1734db +--- /dev/null ++++ b/templates/gem_packages.spec.erb +@@ -0,0 +1,236 @@ ++<% ++ 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) && RUBY_ENGINE != 'rbx' ++ 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\./, '') ++ 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}" ++ 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/opensuse.spec.erb b/templates/opensuse.spec.erb +index 2fb605d..25fdec3 100644 +--- a/templates/opensuse.spec.erb ++++ b/templates/opensuse.spec.erb +@@ -1,5 +1,5 @@ + # +-# spec file for package rubygem-<%= spec.name %> ++# spec file for package rubygem-<%= spec.name %><%= config[:version_suffix] %> + # + # Copyright (c) <%= Time.now.year %> SUSE LINUX Products GmbH, Nuernberg, Germany. + # +@@ -14,45 +14,56 @@ + + # 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: rubygem-<%= spec.name %> ++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} +-<% 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 %> ++<% 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 >= 3 ++BuildRequires: ruby-macros >= 5 + <% for req in spec.required_ruby_version -%> +-<% unless req.empty? -%> +-Requires: ruby <%= req %> +-BuildRequires: ruby <%= req %> +-<% end -%> +-<% end -%> +-<% unless spec.extensions.empty? -%> +-BuildRequires: ruby-devel ++<% 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 %> ++BuildRequires: %{rubygem <%= d.name %> <%= req %>} + <% end -%> + <% end -%> + <% end -%> +-<% unless spec.rdoc_options.empty? -%> +-BuildRequires: rubygem(rdoc) > 3.10 ++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 +@@ -61,32 +72,30 @@ BuildRequires: update-alternatives + Url: <%= spec.homepage %> + <% 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 -%> ++<% 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 +-<%= spec.description -%> +- +-<% if spec.has_rdoc -%> +-%package doc +-Summary: RDoc documentation for %{mod_name} +-Group: Development/Languages/Ruby +-Requires: %{name} = %{version} ++<%= config[:description] or spec.description -%> + +-%description doc +-Documentation generated at gem installation time. +-Usually in RDoc and RI formats. +- +-<% end -%> +-<% test_frameworks = Hash.new ++<% # 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 +@@ -108,91 +117,99 @@ Usually in RDoc and RI formats. + + 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 ++<% 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 +-%gem_install -f +-<% unless spec.extensions.empty? -%> +-%gem_cleanup ++<% if config[:pre_install] -%> ++# MANUAL ++<%= config[:pre_install] %> ++# /MANUAL + <% end -%> +-<% unless spec.executables.empty? -%> +-mkdir -p %{buildroot}%{_sysconfdir}/alternatives ++%gem_install \ ++<% if config[:gem_install_args] -%> ++<%= config[:gem_install_args] %> \ + <% 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 %> +- ++<% if config[:disable_docs] -%> ++ --no-rdoc --no-ri \ ++<% end -%> ++<% unless spec.executables.empty? -%> ++ --symlink-binaries \ + <% 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 %> ++ --doc-files="<%= docdirfiles.join(' ') %>" \ + <% end -%> ++ -f ++<% unless spec.extensions.empty? -%> ++%gem_cleanup + <% end -%> +-<% unless spec.executables.empty? -%> ++<% if config[:post_install] -%> ++# MANUAL ++<%= config[:post_install] %> ++# /MANUAL + +-%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 -%> ++<% if config[:testsuite_command] -%> ++# MANUAL ++%check ++<%= config[:testsuite_command] %> ++#/ MANUAL + ++<% end -%> ++<% if config[:filelist] -%> + %files + %defattr(-,root,root,-) +-<% unless docdirfiles.empty? -%> +-%{_docdir}/%{name} +-<% end -%> +-<% spec.executables.each do |executable| -%> +-%{_bindir}/<%= executable %>%{mod_branch} +-%{_bindir}/<%= executable %> +-%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 %> ++<%= config[:filelist] %> ++ + <% end -%> +-%{gem_base}/specifications/%{mod_full_name}.gemspec ++<% if config[:scripts] ++ if config[:scripts].is_a? Hash ++ config[:scripts].each do |section, content| -%> ++%<%= section %> ++<%= content %> + +-<% if spec.has_rdoc -%> +-%files doc +-%defattr(-,root,root,-) +-%doc %{gem_base}/doc ++<% end ++ else -%> ++<%= config[:scripts] %> + +-<% end -%> +-<% unless test_frameworks.empty? -%> +-%files testsuite ++<% 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,-) +-<% test_frameworks.each do |framework| -%> +-%{gem_base}/gems/%{mod_full_name}/<%= framework %> +-<% end -%> ++<%= data[:filelist] %> ++ ++<% end ++ end ++-%> ++%gem_packages + +-<% end -%> + %changelog +diff --git a/templates/sles12.gem_packages.spec.erb b/templates/sles12.gem_packages.spec.erb +deleted file mode 100644 +index d1734db..0000000 +--- a/templates/sles12.gem_packages.spec.erb ++++ /dev/null +@@ -1,236 +0,0 @@ +-<% +- 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) && RUBY_ENGINE != 'rbx' +- 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\./, '') +- 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}" +- 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 +deleted file mode 100644 +index 25fdec3..0000000 +--- a/templates/sles12.spec.erb ++++ /dev/null +@@ -1,215 +0,0 @@ +-# +-# 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 + diff --git a/0011-fixes-for-the-opensuse-template.patch b/0011-fixes-for-the-opensuse-template.patch new file mode 100644 index 0000000..aacfbb1 --- /dev/null +++ b/0011-fixes-for-the-opensuse-template.patch @@ -0,0 +1,50 @@ +commit eed51b54253c303c593d9466ed8ed17523bda3d1 +Author: Stephan Kulow +Date: Wed Oct 15 10:38:29 2014 +0200 + + fixes for the opensuse template: + + - 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 + - don't %ghost %_bindir + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +index d1734db..058660b 100644 +--- a/templates/gem_packages.spec.erb ++++ b/templates/gem_packages.spec.erb +@@ -173,9 +173,9 @@ fi + <% 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 %> ++<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %> ++<%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %> ++<%= rb_bindir %>/<%= executable %> + %ghost <%= rb_sysconfdir %>/alternatives/<%= executable %> + %ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}#{rb_suffix}" %> + %ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}-#{spec.version}" %> +diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb +index 25fdec3..8bc281c 100644 +--- a/templates/opensuse.spec.erb ++++ b/templates/opensuse.spec.erb +@@ -15,6 +15,8 @@ + # 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 +@@ -74,7 +76,7 @@ Url: <%= spec.homepage %> + Source: http://rubygems.org/gems/%{mod_full_name}.gem + <% if config[:sources] + config[:sources].each_with_index do |src, i| -%> +-Source<%= i+1 %>: <%= src %> ++Source<%= i+1 %>: <%= src %> + <% end + end -%> + <% if config[:patches] -%> diff --git a/rubygem-gem2rpm.changes b/rubygem-gem2rpm.changes index 0eb173d..2f73095 100644 --- a/rubygem-gem2rpm.changes +++ b/rubygem-gem2rpm.changes @@ -1,3 +1,40 @@ +------------------------------------------------------------------- +Wed Oct 15 08:44:14 UTC 2014 - coolo@suse.com + +- add 0011-fixes-for-the-opensuse-template.patch to survive + format_spec formatting + +------------------------------------------------------------------- +Mon Oct 13 13:46:58 UTC 2014 - mrueckert@suse.de + +- added 0009-rubinius-has-no-extensions-docdir.patch + special casing for rubinius +- added 0010-switch-to-new-packaging-scheme-by-default.patch + move to new packaging templates by default + +------------------------------------------------------------------- +Mon Sep 22 16:12:08 UTC 2014 - mrueckert@suse.de + +- added ruby 1.9 support + +------------------------------------------------------------------- +Wed Sep 17 16:16:59 UTC 2014 - mrueckert@suse.de + +- added ruby 1.8 support +- also guarded the 2.1 part + +------------------------------------------------------------------- +Wed Sep 17 14:55:33 UTC 2014 - mrueckert@suse.de + +- added 0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch + Dont allow an suffix with just a plain number. prefix it with + ruby. + +------------------------------------------------------------------- +Wed Sep 17 13:25:27 UTC 2014 - mrueckert@suse.de + +- added ruby 2.0 support + ------------------------------------------------------------------- Mon Sep 8 11:02:50 UTC 2014 - mrueckert@suse.de diff --git a/rubygem-gem2rpm.spec b/rubygem-gem2rpm.spec index 8925245..cf34edd 100644 --- a/rubygem-gem2rpm.spec +++ b/rubygem-gem2rpm.spec @@ -15,6 +15,10 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %bcond_without gem2rpm_bootstrap +%bcond_with ruby18 +%bcond_with ruby19 +%bcond_with ruby20 +%bcond_with ruby21 %bcond_with ruby22 %bcond_with rubinius22 @@ -47,6 +51,10 @@ 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 +Patch7: 0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.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 License: GPL-2.0+ Group: Development/Languages/Ruby @@ -65,6 +73,10 @@ The spec file tries to follow the gem as closely as possible %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 %build %gem_build @@ -73,10 +85,10 @@ The spec file tries to follow the gem as closely as possible %gem_install -f --symlink-binaries --doc-files="AUTHORS LICENSE README" for i in %{buildroot}%{_docdir}/*rubygem-gem2rpm*/ ; do install -m 0644 %{S:1} $i/gem2rpm.yml - install -m 0644 %{mod_full_name}/templates/sles12*.spec.erb $i/ done %if %{with gem2rpm_bootstrap} +%if %{with ruby21} %package -n ruby2.1-rubygem-gem2rpm Summary: Generate rpm specfiles from gems Group: Development/Languages/Ruby @@ -130,6 +142,175 @@ fi %files -n ruby2.1-rubygem-gem2rpm-doc %defattr(-,root,root,-) %doc %{_libdir}/ruby/gems/2.1.0/doc/gem2rpm-%{version} +%endif + +%if %{with ruby18} +%package -n ruby1.8-rubygem-gem2rpm +Summary: Generate rpm specfiles from gems +Group: Development/Languages/Ruby +PreReq: update-alternatives + +%description -n ruby1.8-rubygem-gem2rpm +Generate source rpms and rpm spec files from a Ruby Gem. +The spec file tries to follow the gem as closely as possible + +%package -n ruby1.8-rubygem-gem2rpm-doc +Summary: RDoc documentation for %{mod_name} +Group: Development/Languages/Ruby +Requires: ruby1.8-rubygem-gem2rpm = %{version} + +%description -n ruby1.8-rubygem-gem2rpm-doc +Documentation generated at gem installation time. +Usually in RDoc and RI formats. + + +%post -n ruby1.8-rubygem-gem2rpm +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm gem2rpm %{_bindir}/gem2rpm.ruby1.8-%{version} %{mod_weight} +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm-%{version} gem2rpm-%{version} %{_bindir}/gem2rpm.ruby1.8-%{version} %{mod_weight} +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm.ruby1.8 gem2rpm.ruby1.8 %{_bindir}/gem2rpm.ruby1.8-%{version} %{mod_weight} + +%preun -n ruby1.8-rubygem-gem2rpm +if [ "$1" = 0 ] ; then + /usr/sbin/update-alternatives --remove gem2rpm %{_bindir}/gem2rpm.ruby1.8-%{version} + /usr/sbin/update-alternatives --remove gem2rpm-%{version} %{_bindir}/gem2rpm.ruby1.8-%{version} + /usr/sbin/update-alternatives --remove gem2rpm.ruby1.8 %{_bindir}/gem2rpm.ruby1.8-%{version} +fi + +%files -n ruby1.8-rubygem-gem2rpm +%defattr(-,root,root,-) +%{_docdir}/ruby1.8-rubygem-gem2rpm +#{_bindir}/gem2rpm-opensuse +%{_bindir}/gem2rpm.ruby1.8-%{version} +%ghost %{_bindir}/gem2rpm.ruby1.8 +%ghost %{_bindir}/gem2rpm-%{version} +%ghost %{_bindir}/gem2rpm +%ghost %{_sysconfdir}/alternatives/gem2rpm +%ghost %{_sysconfdir}/alternatives/gem2rpm.ruby1.8 +%ghost %{_sysconfdir}/alternatives/gem2rpm-%{version} +# cache file +%{_libdir}/ruby/gems/1.8/cache/gem2rpm-%{version}.gem +%{_libdir}/ruby/gems/1.8/gems/gem2rpm-%{version} +%{_libdir}/ruby/gems/1.8/specifications/gem2rpm-%{version}.gemspec + +%files -n ruby1.8-rubygem-gem2rpm-doc +%defattr(-,root,root,-) +%doc %{_libdir}/ruby/gems/1.8/doc/gem2rpm-%{version} +%endif + +%if %{with ruby19} +%package -n ruby1.9-rubygem-gem2rpm +Summary: Generate rpm specfiles from gems +Group: Development/Languages/Ruby +PreReq: update-alternatives + +%description -n ruby1.9-rubygem-gem2rpm +Generate source rpms and rpm spec files from a Ruby Gem. +The spec file tries to follow the gem as closely as possible + +%package -n ruby1.9-rubygem-gem2rpm-doc +Summary: RDoc documentation for %{mod_name} +Group: Development/Languages/Ruby +Requires: ruby1.9-rubygem-gem2rpm = %{version} + +%description -n ruby1.9-rubygem-gem2rpm-doc +Documentation generated at gem installation time. +Usually in RDoc and RI formats. + + +%post -n ruby1.9-rubygem-gem2rpm +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm gem2rpm %{_bindir}/gem2rpm.ruby1.9-%{version} %{mod_weight} +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm-%{version} gem2rpm-%{version} %{_bindir}/gem2rpm.ruby1.9-%{version} %{mod_weight} +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm.ruby1.9 gem2rpm.ruby1.9 %{_bindir}/gem2rpm.ruby1.9-%{version} %{mod_weight} + +%preun -n ruby1.9-rubygem-gem2rpm +if [ "$1" = 0 ] ; then + /usr/sbin/update-alternatives --remove gem2rpm %{_bindir}/gem2rpm.ruby1.9-%{version} + /usr/sbin/update-alternatives --remove gem2rpm-%{version} %{_bindir}/gem2rpm.ruby1.9-%{version} + /usr/sbin/update-alternatives --remove gem2rpm.ruby1.9 %{_bindir}/gem2rpm.ruby1.9-%{version} +fi + +%files -n ruby1.9-rubygem-gem2rpm +%defattr(-,root,root,-) +%{_docdir}/ruby1.9-rubygem-gem2rpm +#{_bindir}/gem2rpm-opensuse +%{_bindir}/gem2rpm.ruby1.9-%{version} +%ghost %{_bindir}/gem2rpm.ruby1.9 +%ghost %{_bindir}/gem2rpm-%{version} +%ghost %{_bindir}/gem2rpm +%ghost %{_sysconfdir}/alternatives/gem2rpm +%ghost %{_sysconfdir}/alternatives/gem2rpm.ruby1.9 +%ghost %{_sysconfdir}/alternatives/gem2rpm-%{version} +# cache file +%{_libdir}/ruby/gems/1.9.1/cache/gem2rpm-%{version}.gem +%{_libdir}/ruby/gems/1.9.1/gems/gem2rpm-%{version} +%{_libdir}/ruby/gems/1.9.1/specifications/gem2rpm-%{version}.gemspec + +%files -n ruby1.9-rubygem-gem2rpm-doc +%defattr(-,root,root,-) +%doc %{_libdir}/ruby/gems/1.9.1/doc/gem2rpm-%{version} +%endif + +%if %{with ruby20} +%package -n ruby2.0-rubygem-gem2rpm +Summary: Generate rpm specfiles from gems +Group: Development/Languages/Ruby +PreReq: update-alternatives + +%description -n ruby2.0-rubygem-gem2rpm +Generate source rpms and rpm spec files from a Ruby Gem. +The spec file tries to follow the gem as closely as possible + +%package -n ruby2.0-rubygem-gem2rpm-doc +Summary: RDoc documentation for %{mod_name} +Group: Development/Languages/Ruby +Requires: ruby2.0-rubygem-gem2rpm = %{version} + +%description -n ruby2.0-rubygem-gem2rpm-doc +Documentation generated at gem installation time. +Usually in RDoc and RI formats. + + +%post -n ruby2.0-rubygem-gem2rpm +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm gem2rpm %{_bindir}/gem2rpm.ruby2.0-%{version} %{mod_weight} +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm-%{version} gem2rpm-%{version} %{_bindir}/gem2rpm.ruby2.0-%{version} %{mod_weight} +/usr/sbin/update-alternatives --install \ + %{_bindir}/gem2rpm.ruby2.0 gem2rpm.ruby2.0 %{_bindir}/gem2rpm.ruby2.0-%{version} %{mod_weight} + +%preun -n ruby2.0-rubygem-gem2rpm +if [ "$1" = 0 ] ; then + /usr/sbin/update-alternatives --remove gem2rpm %{_bindir}/gem2rpm.ruby2.0-%{version} + /usr/sbin/update-alternatives --remove gem2rpm-%{version} %{_bindir}/gem2rpm.ruby2.0-%{version} + /usr/sbin/update-alternatives --remove gem2rpm.ruby2.0 %{_bindir}/gem2rpm.ruby2.0-%{version} +fi + +%files -n ruby2.0-rubygem-gem2rpm +%defattr(-,root,root,-) +%{_docdir}/ruby2.0-rubygem-gem2rpm +#{_bindir}/gem2rpm-opensuse +%{_bindir}/gem2rpm.ruby2.0-%{version} +%ghost %{_bindir}/gem2rpm.ruby2.0 +%ghost %{_bindir}/gem2rpm-%{version} +%ghost %{_bindir}/gem2rpm +%ghost %{_sysconfdir}/alternatives/gem2rpm +%ghost %{_sysconfdir}/alternatives/gem2rpm.ruby2.0 +%ghost %{_sysconfdir}/alternatives/gem2rpm-%{version} +# cache file +%{_libdir}/ruby/gems/2.0.0/cache/gem2rpm-%{version}.gem +%{_libdir}/ruby/gems/2.0.0/gems/gem2rpm-%{version} +%{_libdir}/ruby/gems/2.0.0/specifications/gem2rpm-%{version}.gemspec + +%files -n ruby2.0-rubygem-gem2rpm-doc +%defattr(-,root,root,-) +%doc %{_libdir}/ruby/gems/2.0.0/doc/gem2rpm-%{version} +%endif %if %{with ruby22} %package -n ruby2.2-rubygem-gem2rpm diff --git a/series b/series index 453f035..6bff879 100644 --- a/series +++ b/series @@ -5,3 +5,6 @@ 0005-added-example-gem2rpm.yml.patch -p1 0006-properly-shorten-description-and-summary.patch -p1 0007-Preserve-the-license-header-found-in-the-output-file.patch -p1 +0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch -p1 +0009-rubinius-has-no-extensions-docdir.patch -p1 +0010-switch-to-new-packaging-scheme-by-default.patch -p1