Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
rubygem-gem2rpm
0004-openSUSE-template-fixes.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-openSUSE-template-fixes.patch of Package rubygem-gem2rpm
From fff45bc96294b974a25c99f626e2d5359c06d717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de> Date: Thu, 24 Jul 2014 17:01:17 +0200 Subject: [PATCH 4/8] 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 -- 2.1.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor