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 53e6804..6fb78b3 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 01/10] - use the ID from os-release to use the proper template +Subject: [PATCH 1/9] - 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 cf392cc..fee5c61 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 02/10] added basic config file support to gem2rpm in yaml +Subject: [PATCH 2/9] 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-new-opensuse-templates.-they-require-the-config-file.patch similarity index 84% rename from 0003-sle-12-templates.-they-require-the-config-file-suppo.patch rename to 0003-new-opensuse-templates.-they-require-the-config-file.patch index 354f2ab..f5395af 100644 --- a/0003-sle-12-templates.-they-require-the-config-file-suppo.patch +++ b/0003-new-opensuse-templates.-they-require-the-config-file.patch @@ -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?= 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/9] new opensuse 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 + templates/gem_packages.spec.erb | 236 ++++++++++++++++++++++++++++++++++++++++ + templates/opensuse.spec.erb | 213 ++++++++++++++++++++++++++++++------ + 2 files changed, 414 insertions(+), 35 deletions(-) + create mode 100644 templates/gem_packages.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 -index 0000000..5b02f2c +index 0000000..d1734db --- /dev/null -+++ b/templates/sles12.gem_packages.spec.erb -@@ -0,0 +1,233 @@ ++++ 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}") @@ -27,7 +27,7 @@ index 0000000..5b02f2c + 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 @@ -67,6 +67,9 @@ index 0000000..5b02f2c + + 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}" @@ -249,28 +252,24 @@ index 0000000..5b02f2c + 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 @@ -+# +diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb +index 37de592..25fdec3 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 %><%= config[:version_suffix] %> -+# + # +-# 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 -+# 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/ -+# + # + # All modifications and additions to the file contributed by third parties + # remain the property of their copyright owners, unless otherwise agreed +@@ -14,59 +14,202 @@ + + # 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. @@ -279,11 +278,17 @@ index 0000000..25fdec3 +# of those fields +# +<% end -%> -+ + +-# norootforbuild +-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 %> + 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} +<% if config[:version_suffix] -%> +%define mod_version_suffix <%= config[:version_suffix] %> @@ -293,7 +298,15 @@ index 0000000..25fdec3 +<%= config[:preamble] %> +# /MANUAL +<% 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 +<% for req in spec.required_ruby_version -%> +<% unless req.empty? -%> @@ -309,14 +322,18 @@ index 0000000..25fdec3 +BuildRequires: %{rubydevel} +<% end -%> +<% end -%> -+<% end -%> + <% end -%> +-<% for d in spec.dependencies -%> +<% for d in spec.runtime_dependencies -%> +<% if ['rdoc'].include? d.name.to_s -%> +# <%= 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 %>} -+<% end -%> -+<% end -%> + <% end -%> + <% end -%> +-# +<% end -%> +BuildRequires: %{rubygem gem2rpm} +<% unless spec.rdoc_options.empty? || config[:disable_automatic_rdoc_dep] -%> @@ -326,7 +343,10 @@ index 0000000..25fdec3 +BuildRequires: update-alternatives +<% end -%> +<% unless spec.homepage.nil? || spec.homepage.empty? -%> -+Url: <%= spec.homepage %> + Url: <%= spec.homepage %> +-Source: %{mod_name}-%{version}.gem +-# +-Summary: <%= spec.summary.gsub(/\.$/, "") %> +<% end -%> +Source: http://rubygems.org/gems/%{mod_full_name}.gem +<% if config[:sources] @@ -348,7 +368,8 @@ index 0000000..25fdec3 +PreReq: update-alternatives +<% end -%> + -+%description + %description +-<%= 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 @@ -371,10 +392,10 @@ index 0000000..25fdec3 + docdirfiles << path if bpath == file + } + end -+ + + test_frameworks = test_frameworks.keys.sort +-%> -+%prep + %prep +<% unless config[:patches].nil? or config[:patches].empty? -%> +%gem_unpack +<% config[:patches].each_with_index do |patch, i| -%> @@ -383,9 +404,11 @@ index 0000000..25fdec3 +%gem_build +<% end -%> + -+%build + %build + -+%install + %install +-%gem_install %{S:0} +-<% unless spec.extensions.empty? %> +<% if config[:pre_install] -%> +# MANUAL +<%= config[:pre_install] %> @@ -406,7 +429,8 @@ index 0000000..25fdec3 +<% end -%> + -f +<% unless spec.extensions.empty? -%> -+%gem_cleanup + %gem_cleanup +-<% end %> +<% end -%> +<% if config[:post_install] -%> +# MANUAL @@ -414,17 +438,21 @@ index 0000000..25fdec3 +# /MANUAL + +<% end -%> -+ + +-%clean +-%{__rm} -rf %{buildroot} +<% if config[:testsuite_command] -%> +# MANUAL +%check +<%= config[:testsuite_command] %> +#/ MANUAL -+ + +<% end -%> +<% if config[:filelist] -%> -+%files -+%defattr(-,root,root,-) + %files + %defattr(-,root,root,-) +-<% spec.executables.each do |executable| %> +-%{_bindir}/<%= executable %> +<%= config[:filelist] %> + +<% end -%> @@ -450,7 +478,11 @@ index 0000000..25fdec3 +<% else %> +Summary: <%= custom_pkg_name %> sub package for <%= spec.name %> +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 %> +%description <%= custom_pkg_name %><%= config[:version_suffix] %> +<% if data[:description] and data[:description] != '' -%> @@ -468,8 +500,8 @@ index 0000000..25fdec3 + end +-%> +%gem_packages -+ -+%changelog + + %changelog -- 1.8.4.5 diff --git a/0005-added-example-gem2rpm.yml.patch b/0004-added-example-gem2rpm.yml.patch similarity index 95% rename from 0005-added-example-gem2rpm.yml.patch rename to 0004-added-example-gem2rpm.yml.patch index dc2907f..99e7ee1 100644 --- a/0005-added-example-gem2rpm.yml.patch +++ b/0004-added-example-gem2rpm.yml.patch @@ -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?= Date: Thu, 24 Jul 2014 17:02:56 +0200 -Subject: [PATCH 05/10] added example gem2rpm.yml +Subject: [PATCH 4/9] added example gem2rpm.yml --- Rakefile | 2 +- diff --git a/0004-openSUSE-template-fixes.patch b/0004-openSUSE-template-fixes.patch deleted file mode 100644 index f0506e9..0000000 --- a/0004-openSUSE-template-fixes.patch +++ /dev/null @@ -1,243 +0,0 @@ -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 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 - diff --git a/0006-properly-shorten-description-and-summary.patch b/0005-properly-shorten-description-and-summary.patch similarity index 93% rename from 0006-properly-shorten-description-and-summary.patch rename to 0005-properly-shorten-description-and-summary.patch index ad3c6c7..01b5175 100644 --- a/0006-properly-shorten-description-and-summary.patch +++ b/0005-properly-shorten-description-and-summary.patch @@ -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?= Date: Thu, 24 Jul 2014 17:09:35 +0200 -Subject: [PATCH 06/10] properly shorten description and summary +Subject: [PATCH 5/9] 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/0006-Preserve-the-license-header-found-in-the-output-file.patch similarity index 93% rename from 0007-Preserve-the-license-header-found-in-the-output-file.patch rename to 0006-Preserve-the-license-header-found-in-the-output-file.patch index dc0482c..6569298 100644 --- a/0007-Preserve-the-license-header-found-in-the-output-file.patch +++ b/0006-Preserve-the-license-header-found-in-the-output-file.patch @@ -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?= 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/9] Preserve the license header found in the output file --- bin/gem2rpm | 13 +++++++++++-- diff --git a/0011-fixes-for-the-opensuse-template.patch b/0007-fixes-for-the-opensuse-template.patch similarity index 75% rename from 0011-fixes-for-the-opensuse-template.patch rename to 0007-fixes-for-the-opensuse-template.patch index aacfbb1..36af9b2 100644 --- a/0011-fixes-for-the-opensuse-template.patch +++ b/0007-fixes-for-the-opensuse-template.patch @@ -1,13 +1,16 @@ -commit eed51b54253c303c593d9466ed8ed17523bda3d1 -Author: Stephan Kulow -Date: Wed Oct 15 10:38:29 2014 +0200 +From eed51b54253c303c593d9466ed8ed17523bda3d1 Mon Sep 17 00:00:00 2001 +From: Stephan Kulow +Date: Wed, 15 Oct 2014 10:38:29 +0200 +Subject: [PATCH 7/9] 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 - removes it as old license comment - - don't %ghost %_bindir +- 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 +--- + 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 index d1734db..058660b 100644 @@ -48,3 +51,6 @@ index 25fdec3..8bc281c 100644 <% end end -%> <% if config[:patches] -%> +-- +1.8.4.5 + diff --git a/0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch b/0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch new file mode 100644 index 0000000..a76aafd --- /dev/null +++ b/0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch @@ -0,0 +1,34 @@ +From ba7932c7d7bc6a70a45ac6ebb841a9e1bf8bb86b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcus=20R=C3=BCckert?= +Date: Tue, 21 Oct 2014 14:54:55 +0200 +Subject: [PATCH 8/9] 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 + 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 deleted file mode 100644 index b0abc25..0000000 --- a/0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch +++ /dev/null @@ -1,27 +0,0 @@ -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-No-longer-require-the-ruby-version-inside-the-subpac.patch b/0009-No-longer-require-the-ruby-version-inside-the-subpac.patch new file mode 100644 index 0000000..2c093c2 --- /dev/null +++ b/0009-No-longer-require-the-ruby-version-inside-the-subpac.patch @@ -0,0 +1,31 @@ +From 13b02a1596a744ed70687dae0ffb465e1979221e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcus=20R=C3=BCckert?= +Date: Tue, 21 Oct 2014 15:13:31 +0200 +Subject: [PATCH 9/9] No longer require the ruby version inside the subpackage + +With the buildrequires we already make sure that the package is only +built if we find a recent enough ABI. then the normal $interpreter(abi) +requires generated by rpm is enough +--- + templates/gem_packages.spec.erb | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +index 94d4005..29873e5 100644 +--- a/templates/gem_packages.spec.erb ++++ b/templates/gem_packages.spec.erb +@@ -77,11 +77,6 @@ + #/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] %> +-- +1.8.4.5 + diff --git a/0009-rubinius-has-no-extensions-docdir.patch b/0009-rubinius-has-no-extensions-docdir.patch deleted file mode 100644 index b947727..0000000 --- a/0009-rubinius-has-no-extensions-docdir.patch +++ /dev/null @@ -1,25 +0,0 @@ -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-Try-to-load-rbconfigpackagingsupport-and-fail-gracef.patch b/0010-Try-to-load-rbconfigpackagingsupport-and-fail-gracef.patch new file mode 100644 index 0000000..4f57ce5 --- /dev/null +++ b/0010-Try-to-load-rbconfigpackagingsupport-and-fail-gracef.patch @@ -0,0 +1,28 @@ +From 953ff66677490c78ceff14afc0365f832079333a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcus=20R=C3=BCckert?= +Date: Tue, 21 Oct 2014 17:55:23 +0200 +Subject: [PATCH 10/16] Try to load rbconfigpackagingsupport and fail + gracefully if not available + +The file will patch ruby_install_name on unversioned ruby installations. +--- + templates/gem_packages.spec.erb | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +index 29873e5..a6ab58b 100644 +--- a/templates/gem_packages.spec.erb ++++ b/templates/gem_packages.spec.erb +@@ -1,4 +1,9 @@ + <% ++ ++ begin ++ require 'rbconfigpackagingsupport' ++ rescue LoadError => ex ++ end + def self.patch_mod_full_name(path, mod_full_name) + path.gsub(/\/-/, "/#{mod_full_name}") + end +-- +2.2.2 + diff --git a/0010-switch-to-new-packaging-scheme-by-default.patch b/0010-switch-to-new-packaging-scheme-by-default.patch deleted file mode 100644 index 259a66d..0000000 --- a/0010-switch-to-new-packaging-scheme-by-default.patch +++ /dev/null @@ -1,1029 +0,0 @@ -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-Add-support-for-scripts-pre-post-for-subpackages.patch b/0011-Add-support-for-scripts-pre-post-for-subpackages.patch new file mode 100644 index 0000000..626f74c --- /dev/null +++ b/0011-Add-support-for-scripts-pre-post-for-subpackages.patch @@ -0,0 +1,44 @@ +From 0ee368bc6c4ea35d233dadbe1f2c7048a99d3dc4 Mon Sep 17 00:00:00 2001 +From: Theo chatzimichos +Date: Fri, 5 Dec 2014 17:11:47 +0200 +Subject: [PATCH 11/16] Add support for :scripts: (pre/post) for subpackages + +With this commit we can add pre/post/(etc) scripts in gem2rpm.yml for +subpackages, as in the example below: + +:custom_pkgs: + apache: + :scripts: + :pre: |- + some_command + :post: + another_command +--- + templates/opensuse.spec.erb | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb +index 8bc281c..af04eaf 100644 +--- a/templates/opensuse.spec.erb ++++ b/templates/opensuse.spec.erb +@@ -209,6 +209,17 @@ This package holds the <%= custom_pkg_name %> sub package for <%= spec.name -%> + %defattr(-,root,root,-) + <%= data[:filelist] %> + ++<% if data[:scripts] ++ if data[:scripts].is_a? Hash ++ data[:scripts].each do |section, content| -%> ++%<%=section %> <%=custom_pkg_name %> ++<%= content %> ++ ++<% end ++ end ++ end ++-%> ++ + <% end + end + -%> +-- +2.2.2 + diff --git a/0012-typo-in-gem2rpm.yml.documentation-custom_pkgs-instea.patch b/0012-typo-in-gem2rpm.yml.documentation-custom_pkgs-instea.patch new file mode 100644 index 0000000..9ed33c3 --- /dev/null +++ b/0012-typo-in-gem2rpm.yml.documentation-custom_pkgs-instea.patch @@ -0,0 +1,26 @@ +From 092f7ca4ff1f954dd8982acf7199cd15636e87f3 Mon Sep 17 00:00:00 2001 +From: Theo Chatzimichos +Date: Fri, 5 Dec 2014 17:16:41 +0200 +Subject: [PATCH 12/16] typo in gem2rpm.yml.documentation: :custom_pkgs: + instead of :custom: + +--- + gem2rpm.yml.documentation | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gem2rpm.yml.documentation b/gem2rpm.yml.documentation +index 5e444eb..376eacd 100644 +--- a/gem2rpm.yml.documentation ++++ b/gem2rpm.yml.documentation +@@ -54,7 +54,7 @@ + # :filelist: |- + # /usr/bin/gem2rpm-opensuse + # ## used by gem_packages +-# :custom: ++# :custom_pkgs: + # apache: + # :preamble: |- + # Requires: ..... +-- +2.2.2 + diff --git a/0013-Also-tag-LICENSE-MIT-as-docfile.patch b/0013-Also-tag-LICENSE-MIT-as-docfile.patch new file mode 100644 index 0000000..6e59c64 --- /dev/null +++ b/0013-Also-tag-LICENSE-MIT-as-docfile.patch @@ -0,0 +1,40 @@ +From dad615aa35cbbe0d7351ea66af44a8548853a2da Mon Sep 17 00:00:00 2001 +From: Dirk Mueller +Date: Mon, 12 Jan 2015 15:34:26 +0100 +Subject: [PATCH 13/16] Also tag LICENSE-MIT as docfile + +Some packages (e.g. rubygem-http_parser) name it that way +--- + templates/gem_packages.spec.erb | 2 +- + templates/opensuse.spec.erb | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +index a6ab58b..15500a0 100644 +--- a/templates/gem_packages.spec.erb ++++ b/templates/gem_packages.spec.erb +@@ -120,7 +120,7 @@ Usually in RDoc and RI formats. + %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| ++ %w(changes copying history legal license license-mit 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 +diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb +index af04eaf..8eb7fee 100644 +--- a/templates/opensuse.spec.erb ++++ b/templates/opensuse.spec.erb +@@ -110,7 +110,7 @@ PreReq: update-alternatives + %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| ++ %w(changes copying history legal license license-mit 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 +-- +2.2.2 + diff --git a/0014-Refactor-into-multiple-lines.patch b/0014-Refactor-into-multiple-lines.patch new file mode 100644 index 0000000..683ea91 --- /dev/null +++ b/0014-Refactor-into-multiple-lines.patch @@ -0,0 +1,58 @@ +From 5bb494a7d6911754e485f6b729861771181bf2a0 Mon Sep 17 00:00:00 2001 +From: Dirk Mueller +Date: Mon, 12 Jan 2015 15:51:08 +0100 +Subject: [PATCH 14/16] Refactor into multiple lines + +Makes this easier to extend/read imho. +--- + templates/gem_packages.spec.erb | 11 ++++++++++- + templates/opensuse.spec.erb | 11 ++++++++++- + 2 files changed, 20 insertions(+), 2 deletions(-) + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +index 15500a0..d3a43fd 100644 +--- a/templates/gem_packages.spec.erb ++++ b/templates/gem_packages.spec.erb +@@ -120,7 +120,16 @@ Usually in RDoc and RI formats. + %w(test spec).each { |framework| + test_frameworks[framework] = 1 if path.index(framework + "/") == 0 + } +- %w(changes copying history legal license license-mit mit-license changelog readme).each { |file| ++ %w(changes ++ copying ++ history ++ legal ++ license ++ license-mit ++ 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 +diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb +index 8eb7fee..88e7356 100644 +--- a/templates/opensuse.spec.erb ++++ b/templates/opensuse.spec.erb +@@ -110,7 +110,16 @@ PreReq: update-alternatives + %w(test spec).each { |framework| + test_frameworks[framework] = 1 if path.index(framework + "/") == 0 + } +- %w(changes copying history legal license license-mit mit-license changelog readme).each { |file| ++ %w(changes ++ copying ++ history ++ legal ++ license ++ license-mit ++ 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 +-- +2.2.2 + diff --git a/0015-Add-licence-to-the-list-of-license-files-as-well.patch b/0015-Add-licence-to-the-list-of-license-files-as-well.patch new file mode 100644 index 0000000..72db40e --- /dev/null +++ b/0015-Add-licence-to-the-list-of-license-files-as-well.patch @@ -0,0 +1,38 @@ +From b10341f5c13d71271e195101e46213026f628048 Mon Sep 17 00:00:00 2001 +From: Dirk Mueller +Date: Mon, 12 Jan 2015 15:52:34 +0100 +Subject: [PATCH 15/16] Add 'licence' to the list of license files as well + +This is a misspelling, but seems to be common enough still +--- + templates/gem_packages.spec.erb | 1 + + templates/opensuse.spec.erb | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +index d3a43fd..b772d02 100644 +--- a/templates/gem_packages.spec.erb ++++ b/templates/gem_packages.spec.erb +@@ -124,6 +124,7 @@ Usually in RDoc and RI formats. + copying + history + legal ++ licence + license + license-mit + mit-license +diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb +index 88e7356..8d14e38 100644 +--- a/templates/opensuse.spec.erb ++++ b/templates/opensuse.spec.erb +@@ -114,6 +114,7 @@ PreReq: update-alternatives + copying + history + legal ++ licence + license + license-mit + mit-license +-- +2.2.2 + diff --git a/0016-add-two-more-ways-to-express-changes.patch b/0016-add-two-more-ways-to-express-changes.patch new file mode 100644 index 0000000..8e95087 --- /dev/null +++ b/0016-add-two-more-ways-to-express-changes.patch @@ -0,0 +1,39 @@ +From 814a7133ce8ab7271cf0bf31ad6d4de94fec8863 Mon Sep 17 00:00:00 2001 +From: Stephan Kulow +Date: Wed, 11 Feb 2015 02:05:31 +0100 +Subject: [PATCH 16/16] add two more ways to express changes + +--- + templates/gem_packages.spec.erb | 2 ++ + templates/opensuse.spec.erb | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb +index b772d02..0cd92e2 100644 +--- a/templates/gem_packages.spec.erb ++++ b/templates/gem_packages.spec.erb +@@ -129,6 +129,8 @@ Usually in RDoc and RI formats. + license-mit + mit-license + changelog ++ news ++ release_notes + readme + ).each { |file| + bpath = path.downcase.gsub(%r{\.rdoc$}, '').gsub(%r{\.txt$}, '').gsub(%r{\.md$}, '') +diff --git a/templates/opensuse.spec.erb b/templates/opensuse.spec.erb +index 8d14e38..b1251c5 100644 +--- a/templates/opensuse.spec.erb ++++ b/templates/opensuse.spec.erb +@@ -119,6 +119,8 @@ PreReq: update-alternatives + license-mit + mit-license + changelog ++ news ++ release_notes + readme + ).each { |file| + bpath = path.downcase.gsub(%r{\.rdoc$}, '').gsub(%r{\.txt$}, '').gsub(%r{\.md$}, '') +-- +2.2.2 + diff --git a/rubygem-gem2rpm.changes b/rubygem-gem2rpm.changes index 2f73095..b178025 100644 --- a/rubygem-gem2rpm.changes +++ b/rubygem-gem2rpm.changes @@ -1,3 +1,48 @@ +------------------------------------------------------------------- +Wed Feb 11 01:23:45 UTC 2015 - coolo@suse.com + +- more patches from git: +A 0010-Try-to-load-rbconfigpackagingsupport-and-fail-gracef.patch +A 0011-Add-support-for-scripts-pre-post-for-subpackages.patch +A 0012-typo-in-gem2rpm.yml.documentation-custom_pkgs-instea.patch +A 0013-Also-tag-LICENSE-MIT-as-docfile.patch +A 0014-Refactor-into-multiple-lines.patch +A 0015-Add-licence-to-the-list-of-license-files-as-well.patch +A 0016-add-two-more-ways-to-express-changes.patch + +------------------------------------------------------------------- +Tue Oct 21 13:15:04 UTC 2014 - mrueckert@suse.de + +- added 0009-No-longer-require-the-ruby-version-inside-the-subpac.patch + No longer require the ruby version inside the subpackage + + With the buildrequires we already make sure that the package is + only built if we find a recent enough ABI. then the normal + $interpreter(abi) requires generated by rpm is enough + +------------------------------------------------------------------- +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 diff --git a/rubygem-gem2rpm.spec b/rubygem-gem2rpm.spec index cf34edd..620681c 100644 --- a/rubygem-gem2rpm.spec +++ b/rubygem-gem2rpm.spec @@ -1,7 +1,7 @@ # # spec file for package rubygem-gem2rpm # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -14,6 +14,8 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + + %bcond_without gem2rpm_bootstrap %bcond_with ruby18 %bcond_with ruby19 @@ -31,8 +33,8 @@ Release: 0 %define mod_weight 1001 #define rb_build_versions %{rb_default_ruby} BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 5 BuildRequires: %{ruby} +BuildRequires: ruby-macros >= 5 %if %{with gem2rpm_bootstrap} #!BuildIgnore: rubygem(gem2rpm) rubygem(ruby:2.1.0:gem2rpm) rubygem(ruby:2.2.0:gem2rpm) rubygem(rbx:2.2:gem2rpm) %else @@ -46,15 +48,20 @@ Source2: gem2rpm-opensuse Source3: series 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 -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 +Patch2: 0003-new-opensuse-templates.-they-require-the-config-file.patch +Patch3: 0004-added-example-gem2rpm.yml.patch +Patch4: 0005-properly-shorten-description-and-summary.patch +Patch5: 0006-Preserve-the-license-header-found-in-the-output-file.patch +Patch6: 0007-fixes-for-the-opensuse-template.patch +Patch7: 0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch +Patch8: 0010-Try-to-load-rbconfigpackagingsupport-and-fail-gracef.patch +Patch9: 0011-Add-support-for-scripts-pre-post-for-subpackages.patch +Patch10: 0012-typo-in-gem2rpm.yml.documentation-custom_pkgs-instea.patch +Patch11: 0013-Also-tag-LICENSE-MIT-as-docfile.patch +Patch12: 0014-Refactor-into-multiple-lines.patch +Patch13: 0015-Add-licence-to-the-list-of-license-files-as-well.patch +Patch14: 0016-add-two-more-ways-to-express-changes.patch +Patch15: 0009-No-longer-require-the-ruby-version-inside-the-subpac.patch Summary: Generate rpm specfiles from gems License: GPL-2.0+ Group: Development/Languages/Ruby @@ -77,6 +84,11 @@ The spec file tries to follow the gem as closely as possible %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 %build %gem_build