Hello community, here is the log from the commit of package rubygem-gem2rpm for openSUSE:Factory checked in at 2015-02-16 21:21:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-gem2rpm (Old) and /work/SRC/openSUSE:Factory/.rubygem-gem2rpm.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-gem2rpm" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-gem2rpm/rubygem-gem2rpm.changes 2014-10-20 07:26:55.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-gem2rpm.new/rubygem-gem2rpm.changes 2015-02-16 21:21:55.000000000 +0100 @@ -1,0 +2,45 @@ +Wed Feb 11 01:23:45 UTC 2015 - [email protected] + +- 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 - [email protected] + +- 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 - [email protected] + +- 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 + +------------------------------------------------------------------- Old: ---- 0003-sle-12-templates.-they-require-the-config-file-suppo.patch 0004-openSUSE-template-fixes.patch 0005-added-example-gem2rpm.yml.patch 0006-properly-shorten-description-and-summary.patch 0007-Preserve-the-license-header-found-in-the-output-file.patch 0008-dont-allow-suffixes-with-just-a-plain-number.-prefix.patch 0009-rubinius-has-no-extensions-docdir.patch 0010-switch-to-new-packaging-scheme-by-default.patch 0011-fixes-for-the-opensuse-template.patch New: ---- 0003-new-opensuse-templates.-they-require-the-config-file.patch 0004-added-example-gem2rpm.yml.patch 0005-properly-shorten-description-and-summary.patch 0006-Preserve-the-license-header-found-in-the-output-file.patch 0007-fixes-for-the-opensuse-template.patch 0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch 0009-No-longer-require-the-ruby-version-inside-the-subpac.patch 0010-Try-to-load-rbconfigpackagingsupport-and-fail-gracef.patch 0011-Add-support-for-scripts-pre-post-for-subpackages.patch 0012-typo-in-gem2rpm.yml.documentation-custom_pkgs-instea.patch 0013-Also-tag-LICENSE-MIT-as-docfile.patch 0014-Refactor-into-multiple-lines.patch 0015-Add-licence-to-the-list-of-license-files-as-well.patch 0016-add-two-more-ways-to-express-changes.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-gem2rpm.spec ++++++ --- /var/tmp/diff_new_pack.zzMQZ5/_old 2015-02-16 21:21:56.000000000 +0100 +++ /var/tmp/diff_new_pack.zzMQZ5/_new 2015-02-16 21:21:56.000000000 +0100 @@ -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 @@ %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 @@ 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 @@ %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 %build %gem_build ++++++ 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch ++++++ --- /var/tmp/diff_new_pack.zzMQZ5/_old 2015-02-16 21:21:56.000000000 +0100 +++ /var/tmp/diff_new_pack.zzMQZ5/_new 2015-02-16 21:21:56.000000000 +0100 @@ -1,7 +1,7 @@ From 91bc63e3fbba24a5f90c4fce4f74b371c4694657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <[email protected]> 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 ++++++++++ ++++++ 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch ++++++ --- /var/tmp/diff_new_pack.zzMQZ5/_old 2015-02-16 21:21:56.000000000 +0100 +++ /var/tmp/diff_new_pack.zzMQZ5/_new 2015-02-16 21:21:56.000000000 +0100 @@ -1,7 +1,7 @@ From 1742038eb7ec8fcb25009ce8b270b420183875bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <[email protected]> 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 ++++++ 0003-new-opensuse-templates.-they-require-the-config-file.patch ++++++ >From 5e1e30e5addc99825b3bf873983ca48732493060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <[email protected]> Date: Thu, 24 Jul 2014 16:55:57 +0200 Subject: [PATCH 3/9] new opensuse templates. they require the config file support. --- 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/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 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 @@ -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. +# 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 -%> -# 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 %> -# -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] %> +<% end -%> +<% if config[:preamble] -%> +# MANUAL +<%= config[:preamble] %> +# /MANUAL +<% 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 >= 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.dependencies -%> +<% 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 -%> +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 %> -Source: %{mod_name}-%{version}.gem -# -Summary: <%= spec.summary.gsub(/\.$/, "") %> +<% 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 -<%= 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 + 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 -%gem_install %{S:0} -<% unless spec.extensions.empty? %> +<% 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 %> +<% end -%> +<% if config[:post_install] -%> +# MANUAL +<%= config[:post_install] %> +# /MANUAL + +<% end -%> -%clean -%{__rm} -rf %{buildroot} +<% if config[:testsuite_command] -%> +# MANUAL +%check +<%= config[:testsuite_command] %> +#/ MANUAL +<% end -%> +<% if config[:filelist] -%> %files %defattr(-,root,root,-) -<% spec.executables.each do |executable| %> -%{_bindir}/<%= executable %> +<%= 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 %> -%{_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] != '' -%> +<%= 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 ++++++ 0005-added-example-gem2rpm.yml.patch -> 0004-added-example-gem2rpm.yml.patch ++++++ --- /work/SRC/openSUSE:Factory/rubygem-gem2rpm/0005-added-example-gem2rpm.yml.patch 2014-10-20 07:26:54.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-gem2rpm.new/0004-added-example-gem2rpm.yml.patch 2015-02-16 21:21:54.000000000 +0100 @@ -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?= <[email protected]> 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 +- ++++++ 0006-properly-shorten-description-and-summary.patch -> 0005-properly-shorten-description-and-summary.patch ++++++ --- /work/SRC/openSUSE:Factory/rubygem-gem2rpm/0006-properly-shorten-description-and-summary.patch 2014-10-20 07:26:54.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-gem2rpm.new/0005-properly-shorten-description-and-summary.patch 2015-02-16 21:21:54.000000000 +0100 @@ -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?= <[email protected]> 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. --- ++++++ 0007-Preserve-the-license-header-found-in-the-output-file.patch -> 0006-Preserve-the-license-header-found-in-the-output-file.patch ++++++ --- /work/SRC/openSUSE:Factory/rubygem-gem2rpm/0007-Preserve-the-license-header-found-in-the-output-file.patch 2014-10-20 07:26:54.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-gem2rpm.new/0006-Preserve-the-license-header-found-in-the-output-file.patch 2015-02-16 21:21:54.000000000 +0100 @@ -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?= <[email protected]> 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 +++++++++++-- ++++++ 0011-fixes-for-the-opensuse-template.patch -> 0007-fixes-for-the-opensuse-template.patch ++++++ --- /work/SRC/openSUSE:Factory/rubygem-gem2rpm/0011-fixes-for-the-opensuse-template.patch 2014-10-20 07:26:55.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-gem2rpm.new/0007-fixes-for-the-opensuse-template.patch 2015-02-16 21:21:54.000000000 +0100 @@ -1,13 +1,16 @@ -commit eed51b54253c303c593d9466ed8ed17523bda3d1 -Author: Stephan Kulow <[email protected]> -Date: Wed Oct 15 10:38:29 2014 +0200 +From eed51b54253c303c593d9466ed8ed17523bda3d1 Mon Sep 17 00:00:00 2001 +From: Stephan Kulow <[email protected]> +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 @@ <% end end -%> <% if config[:patches] -%> +-- +1.8.4.5 + ++++++ 0008-do-not-use-not-.-not-supported-on-1.8-e.g.patch ++++++ >From ba7932c7d7bc6a70a45ac6ebb841a9e1bf8bb86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <[email protected]> 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 ++++++ 0009-No-longer-require-the-ruby-version-inside-the-subpac.patch ++++++ >From 13b02a1596a744ed70687dae0ffb465e1979221e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <[email protected]> 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 ++++++ 0010-Try-to-load-rbconfigpackagingsupport-and-fail-gracef.patch ++++++ >From 953ff66677490c78ceff14afc0365f832079333a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <[email protected]> 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 ++++++ 0011-Add-support-for-scripts-pre-post-for-subpackages.patch ++++++ >From 0ee368bc6c4ea35d233dadbe1f2c7048a99d3dc4 Mon Sep 17 00:00:00 2001 From: Theo chatzimichos <[email protected]> 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 ++++++ 0012-typo-in-gem2rpm.yml.documentation-custom_pkgs-instea.patch ++++++ >From 092f7ca4ff1f954dd8982acf7199cd15636e87f3 Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos <[email protected]> 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 ++++++ 0013-Also-tag-LICENSE-MIT-as-docfile.patch ++++++ >From dad615aa35cbbe0d7351ea66af44a8548853a2da Mon Sep 17 00:00:00 2001 From: Dirk Mueller <[email protected]> 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 ++++++ 0014-Refactor-into-multiple-lines.patch ++++++ >From 5bb494a7d6911754e485f6b729861771181bf2a0 Mon Sep 17 00:00:00 2001 From: Dirk Mueller <[email protected]> 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 ++++++ 0015-Add-licence-to-the-list-of-license-files-as-well.patch ++++++ >From b10341f5c13d71271e195101e46213026f628048 Mon Sep 17 00:00:00 2001 From: Dirk Mueller <[email protected]> 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 ++++++ 0016-add-two-more-ways-to-express-changes.patch ++++++ >From 814a7133ce8ab7271cf0bf31ad6d4de94fec8863 Mon Sep 17 00:00:00 2001 From: Stephan Kulow <[email protected]> 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 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
