commit rubygem-gem2rpm for openSUSE:Factory
Hello community, here is the log from the commit of package rubygem-gem2rpm for openSUSE:Factory checked in at 2014-07-27 18:47:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-02-07 10:29:51.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-gem2rpm.new/rubygem-gem2rpm.changes 2014-07-27 18:47:50.000000000 +0200 @@ -1,0 +2,128 @@ +Thu Jul 24 15:30:14 UTC 2014 - mrueckert@suse.de + +- update to 0.10.1 + - Migrate test suite to Minitest 5.x. + - Move gem binary extension and gem.build_complete file. + - Merge pull request #31 from axilleas/add_check_macro + - Add %check macro, fix typos + - Remove Requires/Provides which are now autogenerated. + - Simplify binary extensions installation according to the new + guidelines. + - Clone new template for F21 and above. Rename the old one. + - "cp -a" implies -p. + - Better open mode handling. + - Test always against rawhide template. + - List development dependencies as BuildRequires. + - Cache rendered template in tests. + - Prevent dangling symlink in -debuginfo. + - Ignore release file encoding with older Ruby (fixes #23). + - Fix generating SRPM. + - Add description dot test case. + - Add description ending dot in #description method. + - Avoid 'method is redefined' warning. + - Test against current template. + - Merge pull request #25 from xsuchy/pull-req-dot + - description should end with dot + - Merge pull request #24 from strzibny/master + - Escape % in comment +- rebased gem2rpm-change-default-template.diff, new name: + 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch +- rebased gem2rpm-0.9.2_config_file_support.patch, new name + 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch +- rebased gem2rpm-0.9.2_sles12_template.patch, new name: + 0003-sle-12-templates.-they-require-the-config-file-suppo.patch +- rebased and splitted gem2rpm-fix-opensuse-template.diff, new + name: + 0004-openSUSE-template-fixes.patch + 0005-added-example-gem2rpm.yml.patch + 0006-properly-shorten-description-and-summary.patch + 0007-Preserve-the-license-header-found-in-the-output-file.patch + +------------------------------------------------------------------- +Wed Jul 23 09:06:02 UTC 2014 - mrueckert@suse.de + +- make sure the sle12 template is also installed + +------------------------------------------------------------------- +Mon Jul 21 11:32:38 UTC 2014 - mrueckert@suse.de + +- renamed gem2rpm.yml to gem2rpm.yml.documentation: + this is just documentation and not the gem2rpm.yml that gem2rpm + should pick up. + +------------------------------------------------------------------- +Mon Jul 21 09:23:55 UTC 2014 - mrueckert@suse.de + +- added gem2rpm-0.9.2_sles12_template.patch: + initial template for sle12 ruby packaging + +------------------------------------------------------------------- +Tue Jul 15 18:43:12 UTC 2014 - mrueckert@suse.de + +- added gem2rpm.yml and install it to the installed documentation + +------------------------------------------------------------------- +Tue Jul 15 18:38:35 UTC 2014 - mrueckert@suse.de + +- sles 12 template + - allow changing the master package name with config[:name] + This is mostly useful if you want the actual main package to + have real content after building. all the subpackages will + ignore config[:name] and still use the gem name. + +------------------------------------------------------------------- +Tue Jul 15 17:21:42 UTC 2014 - mrueckert@suse.de + +- sles 12 template + - add version suffix to the "spec file for ..." line + - move the preamble up so we can actually use + %define rb_build_versions ... + - config[:disable_automatic_rdoc_dep] to disable adding automatic + rdoc dependency. This is mostly needed for building rdoc itself + and avoiding a bootstrap cycle. + - actually print the patch name in the preamble + - the scripts entry in gem2rpm.yml can now be a hash or a string. + +------------------------------------------------------------------- +Tue Jul 15 14:27:57 UTC 2014 - mrueckert@suse.de + +- sles 12 template + - no longer print the gem2rpm.yml warning when the config is empty + - add back mod_version_suffix to the spec file + (needed for gem_install) +- converted buildrequires for ruby and ruby-devel to the macros so + we can easily pull multiple ruby versions and also easily limit + the ruby versions +- always buildrequire gem2rpm in generated spec files. It is the + only clean way to solve the "have choive for rubygem(gem2rpm)" + and still maintaining the multiversion ability +- handle config[:disable_docs] and pass --no-rdoc --no-ri to + gem_install in that case. (mostly a workaround for the rdoc bug + with the fastthread gem) +- added support to specify the content of the %check section. + +------------------------------------------------------------------- +Fri Jul 11 08:23:20 UTC 2014 - mrueckert@suse.de + +- if the config is nil, set it to an empty hash. this allows for + less noisy template files. +- more updates for the sle 12 template. + +------------------------------------------------------------------- +Thu Jul 10 16:27:03 UTC 2014 - mrueckert@suse.de + +- added new tag :sources in the yaml file to track additional + sources. this makde the next change much easier. +- make sure the config file that is passed to gem2rpm is also + appended to the sources list automatically. +- added template for sles12 (gem2rpm-0.9.2_sles12_template.patch) + +------------------------------------------------------------------- +Thu Jul 10 14:52:01 UTC 2014 - mrueckert@suse.de + +- added gem2rpm-0.9.2_config_file_support.patch: + added basic config file support to gem2rpm in yaml format. there + is no validation as it is basically a hash where certain keys + are picked up by our templates. + +------------------------------------------------------------------- Old: ---- gem2rpm-0.9.2.gem gem2rpm-change-default-template.diff gem2rpm-fix-opensuse-template.diff New: ---- 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch 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 gem2rpm-0.10.1.gem gem2rpm.yml.documentation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-gem2rpm.spec ++++++ --- /var/tmp/diff_new_pack.QXR3h8/_old 2014-07-27 18:47:51.000000000 +0200 +++ /var/tmp/diff_new_pack.QXR3h8/_new 2014-07-27 18:47:51.000000000 +0200 @@ -17,25 +17,32 @@ Name: rubygem-gem2rpm -Version: 0.9.2 +Version: 0.10.1 Release: 0 %define mod_name gem2rpm %define mod_full_name %{mod_name}-%{version} - +%define mod_branch -%{version} +%define mod_weight 1001 +# BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: ruby-macros >= 1 %rubygems_requires Url: https://github.com/lutter/gem2rpm/ Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source1: gem2rpm.yml.documentation Source2: gem2rpm-opensuse -Patch0: gem2rpm-fix-opensuse-template.diff -Patch1: gem2rpm-change-default-template.diff + +Patch0: 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch +Patch1: 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch +Patch2: 0003-sle-12-templates.-they-require-the-config-file-suppo.patch +Patch3: 0004-openSUSE-template-fixes.patch +Patch4: 0005-added-example-gem2rpm.yml.patch +Patch5: 0006-properly-shorten-description-and-summary.patch +Patch6: 0007-Preserve-the-license-header-found-in-the-output-file.patch Summary: Generate rpm specfiles from gems License: GPL-2.0+ Group: Development/Languages/Ruby -%define mod_branch -%{version} -%define mod_weight 9 PreReq: update-alternatives %description @@ -55,6 +62,11 @@ %gem_unpack %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build %gem_build @@ -64,6 +76,9 @@ %{__install} -D -m 0755 %{S:2} %{buildroot}%{_bindir}/gem2rpm-opensuse mv %{buildroot}%{_bindir}/gem2rpm{,%{mod_branch}} ln -s gem2rpm%{mod_branch} %{buildroot}%{_bindir}/gem2rpm +cp %{S:1} gem2rpm.yml +install -m 0644 %{mod_full_name}/templates/sles12*.spec.erb \ + %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/templates/ %post /usr/sbin/update-alternatives --install \ @@ -76,6 +91,7 @@ %files %defattr(-,root,root,-) +%doc gem2rpm.yml %{mod_full_name}/templates/sles12*.spec.erb %{_bindir}/gem2rpm%{mod_branch} %ghost %{_bindir}/gem2rpm %{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem ++++++ 0001-use-the-ID-from-os-release-to-use-the-proper-templat.patch ++++++
From 91bc63e3fbba24a5f90c4fce4f74b371c4694657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?=
Date: Thu, 24 Jul 2014 16:46:19 +0200 Subject: [PATCH 1/7] - use the ID from os-release to use the proper template
From 1742038eb7ec8fcb25009ce8b270b420183875bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?=
Date: Thu, 24 Jul 2014 16:54:45 +0200 Subject: [PATCH 2/7] added basic config file support to gem2rpm in yaml
--- bin/gem2rpm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/gem2rpm b/bin/gem2rpm index 736a645..fa7ce6b 100755 --- a/bin/gem2rpm +++ b/bin/gem2rpm @@ -68,6 +68,16 @@ rest = opts.permute(ARGV) template = nil if template_file.nil? + f = open("/etc/os-release", "r") if File.exists?("/etc/os-release") + if f + f.read.split('\n').each do |line| + line.match(%r{^ID=(.*)$}) { |m| template_file=m[1] } + end + f.close + f = nil + end +end +if template_file.nil? template = Gem2Rpm::TEMPLATE else begin -- 1.8.4.5 ++++++ 0002-added-basic-config-file-support-to-gem2rpm-in-yaml-f.patch ++++++ format. There is no validation as it is basically a hash where certain keys are picked up by our templates. --- bin/gem2rpm | 21 +++++++++++++++++++-- lib/gem2rpm.rb | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bin/gem2rpm b/bin/gem2rpm index fa7ce6b..7f28603 100755 --- a/bin/gem2rpm +++ b/bin/gem2rpm @@ -8,6 +8,7 @@ require 'optparse' require 'fileutils' require 'open-uri' require 'uri' +require 'yaml' opts = OptionParser.new("Usage: #{$0} [OPTIONS] GEM") opts.separator(" Convert ruby Gems to source RPMs and specfiles") @@ -23,6 +24,8 @@ deps = false nongem = false doc_subpackage = true fetch = false +config_file = nil +config = {} opts.separator("") opts.separator(" Options:") @@ -58,6 +61,9 @@ end opts.on("--fetch", "Fetch the gem from rubygems.org") do |val| fetch = true end +opts.on("--config FILE", "Path to gem2rpm.yaml") do |val| + config_file = val +end opts.separator("") opts.separator(" Arguments:") opts.separator(" GEM the path to locally stored gem package file or the name") @@ -127,13 +133,24 @@ if srpm end end +if config_file + begin + config = YAML.load_file(config_file) + config[:sources] ||= [] + config[:sources] << File.basename(config_file) + rescue Exception => ex + $stderr.puts "Failed to load config file '#{config_file}': #{ex}" + exit 1 + end +end + # Produce a specfile if output_file.nil? - Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage) unless deps + Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage, config) unless deps else begin out = open(output_file, "w") - Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage) + Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, config) ensure out.close() end diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb index 017ecd1..e5e2693 100644 --- a/lib/gem2rpm.rb +++ b/lib/gem2rpm.rb @@ -31,12 +31,13 @@ module Gem2Rpm end def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout, - nongem=true, local=false, doc_subpackage = true) + nongem=true, local=false, doc_subpackage = true, config={}) package = Gem2Rpm::Package.new(fname) # Deprecate, kept just for backward compatibility. format = Gem2Rpm::Format.new(package) spec = Gem2Rpm::Specification.new(package.spec) spec.description ||= spec.summary + config ||= {} download_path = "" unless local begin -- 1.8.4.5 ++++++ 0003-sle-12-templates.-they-require-the-config-file-suppo.patch ++++++
From 152e9ec100f30a3c46535a65fa411d014cb264e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?=
Date: Thu, 24 Jul 2014 16:55:57 +0200 Subject: [PATCH 3/7] sle 12 templates. they require the config file support.
--- templates/sles12.gem_packages.spec.erb | 233 +++++++++++++++++++++++++++++++++ templates/sles12.spec.erb | 215 ++++++++++++++++++++++++++++++ 2 files changed, 448 insertions(+) create mode 100644 templates/sles12.gem_packages.spec.erb create mode 100644 templates/sles12.spec.erb diff --git a/templates/sles12.gem_packages.spec.erb b/templates/sles12.gem_packages.spec.erb new file mode 100644 index 0000000..5b02f2c --- /dev/null +++ b/templates/sles12.gem_packages.spec.erb @@ -0,0 +1,233 @@ +<% + def self.patch_mod_full_name(path, mod_full_name) + path.gsub(/\/-/, "/#{mod_full_name}") + end + + def self.patch_libdir(path) + # path ? path.gsub(/\/usr\/lib(64)?/, '%{_libdir}') : path + path + end + + def self.get_extension_doc_dir(gem_spec) + if gem_spec.respond_to? :extensions_dir + rp = gem_spec.extensions_dir.rpartition(gem_spec.base_dir) + return File.join(rp[1], 'doc', rp[2]) + end + return nil + end + + def self.get_mod_weight(spec) + versions=spec.version.to_s.split('.') + begin v1=Integer(versions[0]) rescue v1=1 end + begin v2=Integer(versions[1]) rescue v2=0 end + begin v3=Integer(versions[2]) rescue v3=0 end + weight=v1*10000+v2*100+v3 + end + + def self.filecontent_or_value(path) + (path and File.exists?(path)) ? File.read(path) : path + end + + def self.parse_custom_pkgs(env_value) + custom_pkgs = {} + if env_value + list = env_value.split(/\s+/) + list.each do |element| + pkg_name,filelist_path, preamble, description = element.split(/\|/, 4) + filelist = filecontent_or_value(filelist_path) + preamble = filecontent_or_value(preamble) + description = filecontent_or_value(description) + custom_pkgs[pkg_name] = { + "filelist" => filelist, + "preamble" => preamble, + "description" => description, + } + end + end + custom_pkgs + end + + rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '') + rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '') + pkg_basename = rb_pkgname + '-rubygem-' + spec.name + + mod_full_name = "#{spec.name}-#{spec.version}" + mod_weight = get_mod_weight(spec) + + gem_platform = Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s + rb_bindir = RbConfig::CONFIG['bindir'] + rb_sysconfdir = RbConfig::CONFIG['sysconfdir'] + docdir = '/usr/share/doc/packages' + gem_spec = Gem::Specification.new + gem_base_dir = patch_libdir(gem_spec.base_dir) + gem_cache_dir = patch_libdir(gem_spec.cache_dir) + gem_gems_dir = patch_libdir(gem_spec.gems_dir) + gem_spec_dir = patch_libdir(gem_spec.spec_dir) + gem_bin_dir = patch_libdir(patch_mod_full_name(gem_spec.bin_dir , mod_full_name )) + gem_doc_dir = patch_libdir(patch_mod_full_name(gem_spec.doc_dir, mod_full_name )) + gem_gem_dir = patch_libdir(patch_mod_full_name(gem_spec.gem_dir, mod_full_name )) + gem_ri_dir = patch_libdir(patch_mod_full_name(gem_spec.ri_dir, mod_full_name )) + #ruby2.1 + gem_extensions_dir = gem_spec.respond_to?(:extensions_dir) ? patch_libdir(gem_spec.extensions_dir) : nil + gem_extension_dir = gem_spec.respond_to?(:extension_dir) ? patch_libdir(patch_mod_full_name(gem_spec.extension_dir, mod_full_name)) : nil + gem_extension_doc = patch_libdir(get_extension_doc_dir(gem_spec)) + #/ruby2.1 +%> +%package -n <%= pkg_basename %><%= config[:version_suffix] %> +<% for req in spec.required_ruby_version -%> +<% unless req.empty? -%> +Requires: <%= rb_pkgname %> <%= req %> +<% end -%> +<% end -%> +# MANUAL +<% if config[:main] && config[:main][:preamble] -%> +<%= config[:main][:preamble] %> +<% end -%> +# /MANUAL +Summary: <%= config[:summary] or spec.summary %> +Group: Development/Languages/Ruby +<% unless spec.executables.empty? -%> +PreReq: update-alternatives +<% end -%> + +%description -n <%= pkg_basename %><%= config[:version_suffix] %> +<%= config[:description] or spec.description -%> + +<% if spec.has_rdoc && not(config[:disable_docs]) -%> +%package -n <%= pkg_basename %>-doc<%= config[:version_suffix] %> +Summary: RDoc documentation for <%= spec.name %> +Group: Development/Languages/Ruby +Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %> + +%description -n <%= pkg_basename %>-doc<%= config[:version_suffix] %> +Documentation generated at gem installation time. +Usually in RDoc and RI formats. + +<% end -%> +<% test_frameworks = Hash.new + docdirfiles = [] + format.file_entries.each do |entry| + # new rubygems version has it different + if entry.kind_of?(Array) + path=entry[0]['path'] + else + path=entry + end + path.gsub!(%r{^\./}, '') + %w(test spec).each { |framework| + test_frameworks[framework] = 1 if path.index(framework + "/") == 0 + } + %w(changes copying history legal license mit-license changelog readme).each { |file| + bpath = path.downcase.gsub(%r{\.rdoc$}, '').gsub(%r{\.txt$}, '').gsub(%r{\.md$}, '') + #$stderr.puts "PATH #{path} #{bpath} #{file}" + docdirfiles << path if bpath == file + } + end + + test_frameworks = test_frameworks.keys.sort +-%> +<% unless test_frameworks.empty? -%> +%package -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %> +Summary: Test suite for <%= spec.name %> +Group: Development/Languages/Ruby +Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %> + +%description -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %> +Test::Unit or RSpec files, useful for developers. + +<% end -%> + +<% unless spec.executables.empty? -%> +%post -n <%= pkg_basename %><%= config[:version_suffix] %> +<% spec.executables.each do |executable| -%> +/usr/sbin/update-alternatives --install \ + <%= rb_bindir %>/<%= executable %> <%= executable %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %> +/usr/sbin/update-alternatives --install \ + <%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %> <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %> +/usr/sbin/update-alternatives --install \ + <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %> <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %> +<% end -%> + +%preun -n <%= pkg_basename %><%= config[:version_suffix] %> +if [ "$1" = 0 ] ; then +<% spec.executables.each do |executable| -%> + /usr/sbin/update-alternatives --remove <%= executable %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> + /usr/sbin/update-alternatives --remove <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> + /usr/sbin/update-alternatives --remove <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> +<% end -%> +fi +<% end -%> + +%files -n <%= pkg_basename %><%= config[:version_suffix] %> +%defattr(-,root,root,-) +# MANUAL +<% if config[:main] && config[:main][:filelist] -%> +<%= config[:main][:filelist] -%> +<% end -%> +# /MANUAL +<% unless docdirfiles.empty? -%> +<%= docdir %>/<%= pkg_basename %><%= config[:version_suffix] %> +<% end -%> +<% spec.executables.each do |executable| -%> +<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> +%ghost <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %> +%ghost <%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %> +%ghost <%= rb_bindir %>/<%= executable %> +%ghost <%= rb_sysconfdir %>/alternatives/<%= executable %> +%ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}#{rb_suffix}" %> +%ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}-#{spec.version}" %> +<% end -%> +# cache file +<%= gem_cache_dir %>/<%= mod_full_name %>.gem +<%= gem_gem_dir %> +<% unless spec.extensions.empty? or gem_extension_dir.nil? -%> +<%= gem_extension_dir %> +<% end -%> +<% test_frameworks.each do |framework| -%> +%exclude <%= File.join gem_gem_dir, framework %> +<% end -%> +<%= gem_spec_dir %>/<%= mod_full_name -%>.gemspec + +<% if spec.has_rdoc && not(config[:disable_docs]) -%> +%files -n <%= pkg_basename %>-doc<%= config[:version_suffix] %> +%defattr(-,root,root,-) +%doc <%= gem_doc_dir %> +<% unless spec.extensions.empty? or gem_extension_doc.nil? -%> +%doc <%= gem_extension_doc %> +<% end -%> +<% end -%> + +<% unless test_frameworks.empty? -%> +%files -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %> +%defattr(-,root,root,-) +<% test_frameworks.each do |framework| -%> +<%= File.join gem_gem_dir, framework %> +<% end -%> +<% end -%> +<% + if config[:custom_pkgs_ruby_versioned] + config[:custom_pkgs_ruby_versioned].each do |custom_pkg_name, data| +-%> +%package -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %> +<% if data[:preamble] and data[:preamble] != '' -%> +<%= data[:preamble] %> +<% else %> +Summary: <%= custom_pkg_name %> sub package for <%= spec.name %> +Group: Development/Languages/Ruby +<% end %> +Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %> +%description -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %> +<% if data[:description] and data[:description] != '' -%> +<%= data[:description] %> +<% else %> +<%= spec.description -%> + +This package holds the <%= custom_pkg_name %> sub package for <%= spec.name -%> +<% end %> +%files -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %> +%defattr(-,root,root,-) +<%= data['filelist'] -%> +<% + end + end +-%> diff --git a/templates/sles12.spec.erb b/templates/sles12.spec.erb new file mode 100644 index 0000000..25fdec3 --- /dev/null +++ b/templates/sles12.spec.erb @@ -0,0 +1,215 @@ +# +# spec file for package rubygem-<%= spec.name %><%= config[:version_suffix] %> +# +# Copyright (c) <%= Time.now.year %> SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# +<% if config && not(config.empty?) -%> +# +# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# All sections marked as MANUAL, license headers, summaries and descriptions +# can be maintained in that file. Please consult this file before editing any +# of those fields +# +<% end -%> + +Name: <%= config[:name] ? config[:name] : "rubygem-#{spec.name}#{config[:version_suffix]}" %> +Version: <%= spec.version %> +Release: 0 +%define mod_name <%= spec.name %> +%define mod_full_name %{mod_name}-%{version} +<% if config[:version_suffix] -%> +%define mod_version_suffix <%= config[:version_suffix] %> +<% end -%> +<% if config[:preamble] -%> +# MANUAL +<%= config[:preamble] %> +# /MANUAL +<% end -%> +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: ruby-macros >= 5 +<% for req in spec.required_ruby_version -%> +<% unless req.empty? -%> +<% if spec.extensions.empty? -%> +BuildRequires: %{ruby <%= req %>} +<% else -%> +BuildRequires: %{rubydevel <%= req %>} +<% end -%> +<% else -%> +<% if spec.extensions.empty? -%> +BuildRequires: %{ruby} +<% else -%> +BuildRequires: %{rubydevel} +<% end -%> +<% end -%> +<% end -%> +<% for d in spec.runtime_dependencies -%> +<% if ['rdoc'].include? d.name.to_s -%> +# <%= d.name %> <%= d.__getobj__().requirement %> +<% for req in d.requirement -%> +BuildRequires: %{rubygem <%= d.name %> <%= req %>} +<% end -%> +<% end -%> +<% end -%> +BuildRequires: %{rubygem gem2rpm} +<% unless spec.rdoc_options.empty? || config[:disable_automatic_rdoc_dep] -%> +BuildRequires: %{rubygem rdoc > 3.10} +<% end -%> +<% unless spec.executables.empty? -%> +BuildRequires: update-alternatives +<% end -%> +<% unless spec.homepage.nil? || spec.homepage.empty? -%> +Url: <%= spec.homepage %> +<% end -%> +Source: http://rubygems.org/gems/%{mod_full_name}.gem +<% if config[:sources] + config[:sources].each_with_index do |src, i| -%> +Source<%= i+1 %>: <%= src %> +<% end + end -%> +<% if config[:patches] -%> +# MANUAL +<% config[:patches].each_with_index do |patch,i| -%> +Patch<%= i %>: <%= patch[0] %> +<% end -%> +# /MANUAL +<% end -%> +Summary: <%= config[:summary] or spec.summary %> +License: <%= config[:license] or (spec.licenses and spec.licenses.join(" and ")) or 'CHECK(Ruby)' %> +Group: Development/Languages/Ruby +<% unless spec.executables.empty? -%> +PreReq: update-alternatives +<% end -%> + +%description +<%= config[:description] or spec.description -%> + +<% # TODO move into gem2rpm as gem_packages.sh also need this and we only leave it here for getting the docfiles list + test_frameworks = Hash.new + docdirfiles = [] + format.file_entries.each do |entry| + # new rubygems version has it different + if entry.kind_of?(Array) + path=entry[0]['path'] + else + path=entry + end + path.gsub!(%r{^\./}, '') + %w(test spec).each { |framework| + test_frameworks[framework] = 1 if path.index(framework + "/") == 0 + } + %w(changes copying history legal license mit-license changelog readme).each { |file| + bpath = path.downcase.gsub(%r{\.rdoc$}, '').gsub(%r{\.txt$}, '').gsub(%r{\.md$}, '') + #$stderr.puts "PATH #{path} #{bpath} #{file}" + docdirfiles << path if bpath == file + } + end + + test_frameworks = test_frameworks.keys.sort +-%> +%prep +<% unless config[:patches].nil? or config[:patches].empty? -%> +%gem_unpack +<% config[:patches].each_with_index do |patch, i| -%> +%patch<%= i %> <%= patch[1] if patch[1] %> +<% end -%> +%gem_build +<% end -%> + +%build + +%install +<% if config[:pre_install] -%> +# MANUAL +<%= config[:pre_install] %> +# /MANUAL +<% end -%> +%gem_install \ +<% if config[:gem_install_args] -%> +<%= config[:gem_install_args] %> \ +<% end -%> +<% if config[:disable_docs] -%> + --no-rdoc --no-ri \ +<% end -%> +<% unless spec.executables.empty? -%> + --symlink-binaries \ +<% end -%> +<% unless docdirfiles.empty? -%> + --doc-files="<%= docdirfiles.join(' ') %>" \ +<% end -%> + -f +<% unless spec.extensions.empty? -%> +%gem_cleanup +<% end -%> +<% if config[:post_install] -%> +# MANUAL +<%= config[:post_install] %> +# /MANUAL + +<% end -%> + +<% if config[:testsuite_command] -%> +# MANUAL +%check +<%= config[:testsuite_command] %> +#/ MANUAL + +<% end -%> +<% if config[:filelist] -%> +%files +%defattr(-,root,root,-) +<%= config[:filelist] %> + +<% end -%> +<% if config[:scripts] + if config[:scripts].is_a? Hash + config[:scripts].each do |section, content| -%> +%<%= section %> +<%= content %> + +<% end + else -%> +<%= config[:scripts] %> + +<% end + end +-%> +<% if config[:custom_pkgs] + config[:custom_pkgs].each do |custom_pkg_name, data| +-%> +%package <%= custom_pkg_name %><%= config[:version_suffix] %> +<% if data[:preamble] and data[:preamble] != '' -%> +<%= data[:preamble] %> +<% else %> +Summary: <%= custom_pkg_name %> sub package for <%= spec.name %> +Group: Development/Languages/Ruby +<% end %> +# Requires: rubygem-<%= spec.name %><%= config[:version_suffix] %> = <%= spec.version %> +%description <%= custom_pkg_name %><%= config[:version_suffix] %> +<% if data[:description] and data[:description] != '' -%> +<%= data[:description] %> +<% else %> +<%= spec.description -%> + +This package holds the <%= custom_pkg_name %> sub package for <%= spec.name -%> +<% end %> +%files <%= custom_pkg_name %><%= config[:version_suffix] %> +%defattr(-,root,root,-) +<%= data[:filelist] %> + +<% end + end +-%> +%gem_packages + +%changelog -- 1.8.4.5 ++++++ 0004-openSUSE-template-fixes.patch ++++++
From fff45bc96294b974a25c99f626e2d5359c06d717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?=
Date: Thu, 24 Jul 2014 17:01:17 +0200 Subject: [PATCH 4/7] openSUSE template fixes
--- 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 ++++++ 0005-added-example-gem2rpm.yml.patch ++++++
From 4eba3dc8c65e4298e650852eeb79461fb648b675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?=
Date: Thu, 24 Jul 2014 17:02:56 +0200 Subject: [PATCH 5/7] added example gem2rpm.yml
--- Rakefile | 2 +- gem2rpm.yml.documentation | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 gem2rpm.yml.documentation diff --git a/gem2rpm.yml.documentation b/gem2rpm.yml.documentation new file mode 100644 index 0000000..5e444eb --- /dev/null +++ b/gem2rpm.yml.documentation @@ -0,0 +1,70 @@ +# --- +# ## used by gem2rpm +# :summary: this is a custom summary +# ## used by gem2rpm +# :description: |- +# this is a custom description +# +# it can be multiline +# ## used by gem2rpm +# :license: MIT or Ruby +# ## used by gem2rpm and gem_packages +# :version_suffix: -x_y +# ## used by gem2rpm and gem_packages +# :disable_docs: true +# ## used by gem2rpm +# :disable_automatic_rdoc_dep: true +# ## used by gem2rpm +# :preamble: |- +# BuildRequires: foobar +# Requires: foobar +# ## used by gem2rpm +# :patches: +# foo.patch: -p1 +# bar.patch: +# ## used by gem2rpm +# :sources: +# - foo.desktop +# - bar.desktop +# :gem_install_args: '....' +# ## used by gem2rpm +# :pre_install: |- +# %if 0%{?use_system_libev} +# export USE_VENDORED_LIBEV="no" +# %endif +# ## used by gem2rpm +# :post_install: |- +# # delete custom files here or do other fancy stuff +# install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse +# ## used by gem2rpm +# :testsuite_command: |- +# (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test) +# ## used by gem2rpm +# :filelist: |- +# /usr/bin/gem2rpm-opensuse +# ## used by gem2rpm +# :scripts: +# :post: |- +# /bin/echo foo +# ## used by gem_packages +# :main: +# :preamble: |- +# Requires: util-linux +# Recommends: pwgen +# :filelist: |- +# /usr/bin/gem2rpm-opensuse +# ## used by gem_packages +# :custom: +# apache: +# :preamble: |- +# Requires: ..... +# :filelist: |- +# /etc/apache2/conf.d/passenger.conf +# :summary: Custom summary is optional +# :description: |- +# Custom description is optional +# +# bar +# :post: |- +# /bin/echo foo +# -- 1.8.4.5 ++++++ 0006-properly-shorten-description-and-summary.patch ++++++
From b6a01a354d9b7fb0f1c9cb68c3ea58ffc34240ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?=
Date: Thu, 24 Jul 2014 17:09:35 +0200 Subject: [PATCH 6/7] properly shorten description and summary
This also includes the description if we reuse the summary. --- lib/gem2rpm.rb | 1 - lib/gem2rpm/specification.rb | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb index e5e2693..5261ae1 100644 --- a/lib/gem2rpm.rb +++ b/lib/gem2rpm.rb @@ -36,7 +36,6 @@ module Gem2Rpm # Deprecate, kept just for backward compatibility. format = Gem2Rpm::Format.new(package) spec = Gem2Rpm::Specification.new(package.spec) - spec.description ||= spec.summary config ||= {} download_path = "" unless local diff --git a/lib/gem2rpm/specification.rb b/lib/gem2rpm/specification.rb index 9a8d5a1..2e4f7b2 100644 --- a/lib/gem2rpm/specification.rb +++ b/lib/gem2rpm/specification.rb @@ -7,6 +7,9 @@ module Gem2Rpm # A long description of gem wrapped to 78 characters. def description d = super.to_s.chomp + if d.nil? or d.empty? + d=self.__getobj__().summary + end d.gsub!(/([^.])\Z/, "\\1.") Helpers::word_wrap(d, 78) + "\n" end @@ -17,6 +20,17 @@ module Gem2Rpm super.map {|d| Gem2Rpm::Dependency.new d} end + # a short summary trimmed to 70 characters + def summary + text = super + if text.length >= 70 + text = text[0,70].split(/\s/) + text = text[0, text.length-1].join(" ") + end + text = text[0, text.length-1] if text[-1] == '.' + text + end + # List of dependencies that are used for development. def development_dependencies super.map {|d| Gem2Rpm::Dependency.new d} -- 1.8.4.5 ++++++ 0007-Preserve-the-license-header-found-in-the-output-file.patch ++++++
From 3f955d9ed723ecf5a72bc73f3252b0d247329648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?=
Date: Thu, 24 Jul 2014 17:17:33 +0200 Subject: [PATCH 7/7] Preserve the license header found in the output file
--- bin/gem2rpm | 13 +++++++++++-- lib/gem2rpm.rb | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bin/gem2rpm b/bin/gem2rpm index 7f28603..8a6db05 100755 --- a/bin/gem2rpm +++ b/bin/gem2rpm @@ -145,12 +145,21 @@ if config_file end # Produce a specfile +oldlicense = nil if output_file.nil? - Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage, config) unless deps + Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage, oldlicense, config) unless deps else begin + if File.exists?(output_file) + File.open(output_file, 'r') do |oldfile| + oldfile.each_line do |line| + m = line.match(%r{^License:\s*(\w.*)$}) + oldlicense = m[1] if m + end + end + end out = open(output_file, "w") - Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, config) + Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, oldlicense, config) ensure out.close() end diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb index 5261ae1..d30e0f6 100644 --- a/lib/gem2rpm.rb +++ b/lib/gem2rpm.rb @@ -31,11 +31,14 @@ module Gem2Rpm end def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout, - nongem=true, local=false, doc_subpackage = true, config={}) + nongem=true, local=false, doc_subpackage = true, oldlicense=nil, config={}) package = Gem2Rpm::Package.new(fname) # Deprecate, kept just for backward compatibility. format = Gem2Rpm::Format.new(package) spec = Gem2Rpm::Specification.new(package.spec) + if spec.licenses.empty? && oldlicense + spec.licenses = oldlicense.split(' and ') + end config ||= {} download_path = "" unless local -- 1.8.4.5 ++++++ gem2rpm-0.9.2.gem -> gem2rpm-0.10.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bin/gem2rpm new/bin/gem2rpm --- old/bin/gem2rpm 1970-01-01 01:00:00.000000000 +0100 +++ new/bin/gem2rpm 2014-05-05 13:05:15.000000000 +0200 @@ -109,7 +109,7 @@ srpmdir = nil specfile = nil if srpm - gemname = Gem::Format.from_file_by_path(gemfile).spec.name + gemname = Gem2Rpm::Package.new(gemfile).spec.name srpmdir = `/bin/mktemp -t -d gem2rpm-#{gemname}.XXXXXX`.chomp specfile = File::join(srpmdir, "rubygem-#{gemname}.spec") if output_file.nil? Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/gem2rpm/distro.rb new/lib/gem2rpm/distro.rb --- old/lib/gem2rpm/distro.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/gem2rpm/distro.rb 2014-05-05 13:05:15.000000000 +0200 @@ -4,12 +4,19 @@ OPENSUSE = :opensuse DEFAULT = :default + OPEN_MODE = # :nodoc: + if Object.const_defined? :Encoding + 'r:UTF-8' + else + 'r' + end + def self.nature if !release_files.grep(/fedora/).empty? versions = [] release_files.each do |file| - /\d+/ =~ File.open(file, "r:UTF-8").readline + /\d+/ =~ File.open(file, OPEN_MODE).readline versions << Regexp.last_match.to_s if Regexp.last_match end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/gem2rpm/specification.rb new/lib/gem2rpm/specification.rb --- old/lib/gem2rpm/specification.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/gem2rpm/specification.rb 2014-05-05 13:05:15.000000000 +0200 @@ -6,7 +6,9 @@ class Specification < SimpleDelegator # A long description of gem wrapped to 78 characters. def description - Helpers::word_wrap(super.to_s.chomp, 78) + "\n" + d = super.to_s.chomp + d.gsub!(/([^.])\Z/, "\\1.") + Helpers::word_wrap(d, 78) + "\n" end # A list of Gem::Dependency objects this gem depends on (includes every diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/gem2rpm.rb new/lib/gem2rpm.rb --- old/lib/gem2rpm.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/gem2rpm.rb 2014-05-05 13:05:15.000000000 +0200 @@ -7,7 +7,7 @@ require 'gem2rpm/specification' module Gem2Rpm - Gem2Rpm::VERSION = "0.9.2" + Gem2Rpm::VERSION = "0.10.1" class Exception < RuntimeError; end class DownloadUrlError < Exception; end @@ -33,6 +33,7 @@ def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout, nongem=true, local=false, doc_subpackage = true) package = Gem2Rpm::Package.new(fname) + # Deprecate, kept just for backward compatibility. format = Gem2Rpm::Format.new(package) spec = Gem2Rpm::Specification.new(package.spec) spec.description ||= spec.summary diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 1970-01-01 01:00:00.000000000 +0100 +++ new/metadata 2014-05-05 13:05:15.000000000 +0200 @@ -1,8 +1,7 @@ --- !ruby/object:Gem::Specification name: gem2rpm version: !ruby/object:Gem::Version - version: 0.9.2 - prerelease: + version: 0.10.1 platform: ruby authors: - David Lutterkort @@ -10,10 +9,10 @@ autorequire: bindir: bin cert_chain: [] -date: 2013-04-23 00:00:00.000000000 Z +date: 2014-05-05 00:00:00.000000000 Z dependencies: [] -description: ! " Generate source rpms and rpm spec files from a Ruby Gem. \n The - spec file tries to follow the gem as closely as possible\n" +description: " Generate source rpms and rpm spec files from a Ruby Gem. \n The spec + file tries to follow the gem as closely as possible\n" email: gem2rpm-devel@rubyforge.org executables: - gem2rpm @@ -34,7 +33,8 @@ - lib/gem2rpm/specification.rb - templates/default.spec.erb - templates/fedora-17-18.spec.erb -- templates/fedora-19-rawhide.spec.erb +- templates/fedora-19-21.spec.erb +- templates/fedora-21-rawhide.spec.erb - templates/fedora.spec.erb - templates/opensuse.spec.erb - LICENSE @@ -42,26 +42,25 @@ - AUTHORS homepage: https://github.com/lutter/gem2rpm/ licenses: [] +metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: -rubygems_version: 1.8.25 +rubygems_version: 2.1.11 signing_key: -specification_version: 3 +specification_version: 4 summary: Generate rpm specfiles from gems test_files: [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/templates/fedora-19-21.spec.erb new/templates/fedora-19-21.spec.erb --- old/templates/fedora-19-21.spec.erb 1970-01-01 01:00:00.000000000 +0100 +++ new/templates/fedora-19-21.spec.erb 2014-05-05 13:05:15.000000000 +0200 @@ -0,0 +1,134 @@ +# Generated from <%= package.spec.file_name %> by gem2rpm -*- rpm-spec -*- +%global gem_name <%= spec.name %> + +Name: rubygem-%{gem_name} +Version: <%= spec.version %> +Release: 1%{?dist} +Summary: <%= spec.summary.gsub(/\.$/, "") %> +Group: Development/Languages +License: <%= spec.licenses.join(" and ") %> +<% if spec.homepage -%> +URL: <%= spec.homepage %> +<% end -%> +Source0: <%= download_path %>%{gem_name}-%{version}.gem +Requires: ruby(release) +<% for req in spec.required_rubygems_version -%> +Requires: ruby(rubygems) <%= req %> +<% end -%> +<% for d in spec.runtime_dependencies -%> +<% for req in d.requirement -%> +Requires: rubygem(<%= d.name %>) <%= req %> +<% end -%> +<% end -%> +BuildRequires: ruby(release) +<% for req in spec.required_rubygems_version -%> +BuildRequires: rubygems-devel <%= req %> +<% end -%> +<% for req in spec.required_ruby_version -%> +BuildRequires: ruby<%= "-devel" unless spec.extensions.empty? %> <%= req %> +<% end -%> +<% for d in spec.development_dependencies -%> +<% unless ["rdoc", "rake", "bundler"].include? d.name -%> +<% for req in d.requirement -%> +# BuildRequires: rubygem(<%= d.name %>) <%= req %> +<% end -%> +<% end -%> +<% end -%> +<% if spec.extensions.empty? -%> +BuildArch: noarch +<% end -%> +Provides: rubygem(%{gem_name}) = %{version} + +%description +<%= spec.description %> + +<% if doc_subpackage -%> +%package doc +Summary: Documentation for %{name} +Group: Documentation +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name}. +<% end # if doc_subpackage -%> + +%prep +gem unpack %{SOURCE0} + +%setup -q -D -T -n %{gem_name}-%{version} + +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec + +%build +# Create the gem as gem install only works on a gem file +gem build %{gem_name}.gemspec + +# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir +# by default, so that we can move it into the buildroot in %%install +%gem_install + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +<% unless spec.extensions.empty? -%> +mkdir -p %{buildroot}%{gem_extdir_mri}/<%= spec.require_paths.first %> +# TODO: move the extensions +mv %{buildroot}%{gem_instdir}/<%= spec.require_paths.first %>/shared_object.so %{buildroot}%{gem_extdir_mri}/<%= spec.require_paths.first %>/ + +<% for ext in spec.extensions -%> +# Prevent dangling symlink in -debuginfo (rhbz#878863). +rm -rf %{buildroot}%{gem_instdir}/<%= ext.split(File::SEPARATOR).first %>/ +<% end -%> +<% end -%> + +<% unless spec.executables.nil? or spec.executables.empty? -%> +mkdir -p %{buildroot}%{_bindir} +cp -a .%{_bindir}/* \ + %{buildroot}%{_bindir}/ +<% end -%> + +<% unless spec.executables.empty? -%> +find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x +<% end -%> + +# Run the test suite +%check +pushd .%{gem_instdir} + +popd + +%files +%dir %{gem_instdir} +<% unless spec.executables.nil? or spec.executables.empty? -%> +<% for f in spec.executables -%> +%{_bindir}/<%= f %> +<% end -%> +%{gem_instdir}/bin +<% end -%> +%{gem_libdir} +<% unless spec.extensions.empty? -%> +%{gem_extdir_mri} +<% end -%> +<% unless doc_subpackage -%> +%doc %{gem_docdir} +<% for f in spec.extra_rdoc_files -%> +%doc %{gem_instdir}/<%= f %> +<% end -%> +<% end -%> +%exclude %{gem_cache} +%{gem_spec} + +<% if doc_subpackage -%> +%files doc +%doc %{gem_docdir} +<% for f in spec.extra_rdoc_files -%> +%doc %{gem_instdir}/<%= f %> +<% end -%> +<% end # if doc_subpackage -%> + +%changelog +* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1 +- Initial package diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/templates/fedora-19-rawhide.spec.erb new/templates/fedora-19-rawhide.spec.erb --- old/templates/fedora-19-rawhide.spec.erb 1970-01-01 01:00:00.000000000 +0100 +++ new/templates/fedora-19-rawhide.spec.erb 1970-01-01 01:00:00.000000000 +0100 @@ -1,117 +0,0 @@ -# Generated from <%= package.spec.file_name %> by gem2rpm -*- rpm-spec -*- -%global gem_name <%= spec.name %> - -Name: rubygem-%{gem_name} -Version: <%= spec.version %> -Release: 1%{?dist} -Summary: <%= spec.summary.gsub(/\.$/, "") %> -Group: Development/Languages -License: <%= spec.licenses.join(" and ") %> -<% if spec.homepage -%> -URL: <%= spec.homepage %> -<% end -%> -Source0: <%= download_path %>%{gem_name}-%{version}.gem -Requires: ruby(release) -<% for req in spec.required_rubygems_version -%> -Requires: ruby(rubygems) <%= req %> -<% end -%> -<% for d in spec.runtime_dependencies -%> -<% for req in d.requirement -%> -Requires: rubygem(<%= d.name %>) <%= req %> -<% end -%> -<% end -%> -BuildRequires: ruby(release) -<% for req in spec.required_rubygems_version -%> -BuildRequires: rubygems-devel <%= req %> -<% end -%> -<% for req in spec.required_ruby_version -%> -BuildRequires: ruby<%= "-devel" unless spec.extensions.empty? %> <%= req %> -<% end -%> -<% if spec.extensions.empty? -%> -BuildArch: noarch -<% end -%> -Provides: rubygem(%{gem_name}) = %{version} - -%description -<%= spec.description %> - -<% if doc_subpackage -%> -%package doc -Summary: Documentation for %{name} -Group: Documentation -Requires: %{name} = %{version}-%{release} -BuildArch: noarch - -%description doc -Documentation for %{name} -<% end # if doc_subpackage -%> - -%prep -gem unpack %{SOURCE0} - -%setup -q -D -T -n %{gem_name}-%{version} - -gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec - -%build -# Create the gem as gem install only works on a gem file -gem build %{gem_name}.gemspec - -# %%gem_install compiles any C extensions and installs the gem into ./%gem_dir -# by default, so that we can move it into the buildroot in %%install -%gem_install - -%install -mkdir -p %{buildroot}%{gem_dir} -cp -pa .%{gem_dir}/* \ - %{buildroot}%{gem_dir}/ - -<% unless spec.extensions.empty? -%> -mkdir -p %{buildroot}%{gem_extdir_mri}/<%= spec.require_paths.first %> -# TODO: move the extensions -mv %{buildroot}%{gem_instdir}/<%= spec.require_paths.first %>/shared_object.so %{buildroot}%{gem_extdir_mri}/<%= spec.require_paths.first %>/ -<% end -%> - -<% unless spec.executables.nil? or spec.executables.empty? -%> -mkdir -p %{buildroot}%{_bindir} -cp -pa .%{_bindir}/* \ - %{buildroot}%{_bindir}/ -<% end -%> - -<% unless spec.executables.empty? -%> -find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x -<% end -%> - -%files -%dir %{gem_instdir} -<% unless spec.executables.nil? or spec.executables.empty? -%> -<% for f in spec.executables -%> -%{_bindir}/<%= f %> -<% end -%> -%{gem_instdir}/bin -<% end -%> -%{gem_libdir} -<% unless spec.extensions.empty? -%> -%exclude %{gem_instdir}/ext -%{gem_extdir_mri} -<% end -%> -<% unless doc_subpackage -%> -%doc %{gem_docdir} -<% for f in spec.extra_rdoc_files -%> -%doc %{gem_instdir}/<%= f %> -<% end -%> -<% end -%> -%exclude %{gem_cache} -%{gem_spec} - -<% if doc_subpackage -%> -%files doc -%doc %{gem_docdir} -<% for f in spec.extra_rdoc_files -%> -%doc %{gem_instdir}/<%= f %> -<% end -%> -<% end # if doc_subpackage -%> - -%changelog -* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1 -- Initial package diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/templates/fedora-21-rawhide.spec.erb new/templates/fedora-21-rawhide.spec.erb --- old/templates/fedora-21-rawhide.spec.erb 1970-01-01 01:00:00.000000000 +0100 +++ new/templates/fedora-21-rawhide.spec.erb 2014-05-05 13:05:15.000000000 +0200 @@ -0,0 +1,123 @@ +# Generated from <%= package.spec.file_name %> by gem2rpm -*- rpm-spec -*- +%global gem_name <%= spec.name %> + +Name: rubygem-%{gem_name} +Version: <%= spec.version %> +Release: 1%{?dist} +Summary: <%= spec.summary.gsub(/\.$/, "") %> +Group: Development/Languages +License: <%= spec.licenses.join(" and ") %> +<% if spec.homepage -%> +URL: <%= spec.homepage %> +<% end -%> +Source0: <%= download_path %>%{gem_name}-%{version}.gem +BuildRequires: ruby(release) +<% for req in spec.required_rubygems_version -%> +BuildRequires: rubygems-devel <%= req %> +<% end -%> +<% for req in spec.required_ruby_version -%> +BuildRequires: ruby<%= "-devel" unless spec.extensions.empty? %> <%= req %> +<% end -%> +<% for d in spec.development_dependencies -%> +<% unless ["rdoc", "rake", "bundler"].include? d.name -%> +<% for req in d.requirement -%> +# BuildRequires: rubygem(<%= d.name %>) <%= req %> +<% end -%> +<% end -%> +<% end -%> +<% if spec.extensions.empty? -%> +BuildArch: noarch +<% end -%> + +%description +<%= spec.description %> + +<% if doc_subpackage -%> +%package doc +Summary: Documentation for %{name} +Group: Documentation +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name}. +<% end # if doc_subpackage -%> + +%prep +gem unpack %{SOURCE0} + +%setup -q -D -T -n %{gem_name}-%{version} + +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec + +%build +# Create the gem as gem install only works on a gem file +gem build %{gem_name}.gemspec + +# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir +# by default, so that we can move it into the buildroot in %%install +%gem_install + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +<% unless spec.extensions.empty? -%> +mkdir -p %{buildroot}%{gem_extdir_mri} +cp -a .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/ + +<% for ext in spec.extensions -%> +# Prevent dangling symlink in -debuginfo (rhbz#878863). +rm -rf %{buildroot}%{gem_instdir}/<%= ext.split(File::SEPARATOR).first %>/ +<% end -%> +<% end -%> + +<% unless spec.executables.nil? or spec.executables.empty? -%> +mkdir -p %{buildroot}%{_bindir} +cp -pa .%{_bindir}/* \ + %{buildroot}%{_bindir}/ +<% end -%> + +<% unless spec.executables.empty? -%> +find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x +<% end -%> + +# Run the test suite +%check +pushd .%{gem_instdir} + +popd + +%files +%dir %{gem_instdir} +<% unless spec.executables.nil? or spec.executables.empty? -%> +<% for f in spec.executables -%> +%{_bindir}/<%= f %> +<% end -%> +%{gem_instdir}/bin +<% end -%> +%{gem_libdir} +<% unless spec.extensions.empty? -%> +%{gem_extdir_mri} +<% end -%> +<% unless doc_subpackage -%> +%doc %{gem_docdir} +<% for f in spec.extra_rdoc_files -%> +%doc %{gem_instdir}/<%= f %> +<% end -%> +<% end -%> +%exclude %{gem_cache} +%{gem_spec} + +<% if doc_subpackage -%> +%files doc +%doc %{gem_docdir} +<% for f in spec.extra_rdoc_files -%> +%doc %{gem_instdir}/<%= f %> +<% end -%> +<% end # if doc_subpackage -%> + +%changelog +* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1 +- Initial package ++++++ gem2rpm.yml.documentation ++++++ # --- # ## used by gem2rpm # :summary: this is a custom summary # ## used by gem2rpm # :description: |- # this is a custom description # # it can be multiline # ## used by gem2rpm # :license: MIT or Ruby # ## used by gem2rpm and gem_packages # :version_suffix: -x_y # ## used by gem2rpm and gem_packages # :disable_docs: true # ## used by gem2rpm # :disable_automatic_rdoc_dep: true # ## used by gem2rpm # :preamble: |- # BuildRequires: foobar # Requires: foobar # ## used by gem2rpm # :patches: # foo.patch: -p1 # bar.patch: # ## used by gem2rpm # :sources: # - foo.desktop # - bar.desktop # :gem_install_args: '....' # ## used by gem2rpm # :pre_install: |- # %if 0%{?use_system_libev} # export USE_VENDORED_LIBEV="no" # %endif # ## used by gem2rpm # :post_install: |- # # delete custom files here or do other fancy stuff # install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse # ## used by gem2rpm # :testsuite_command: |- # (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test) # ## used by gem2rpm # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem2rpm # :scripts: # :post: |- # /bin/echo foo # ## used by gem_packages # :main: # :preamble: |- # Requires: util-linux # Recommends: pwgen # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem_packages # :custom: # apache: # :preamble: |- # Requires: ..... # :filelist: |- # /etc/apache2/conf.d/passenger.conf # :summary: Custom summary is optional # :description: |- # Custom description is optional # # bar # :post: |- # /bin/echo foo # -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de