1
0

Accepting request 129323 from devel:languages:ruby:extensions

#hackweek8

OBS-URL: https://build.opensuse.org/request/show/129323
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rubygem-gem2rpm?expand=0&rev=1
This commit is contained in:
Stephan Kulow 2012-08-04 07:39:29 +00:00 committed by Git OBS Bridge
commit 0e2db665e5
8 changed files with 491 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
gem2rpm-0.8.1.gem Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae7b58931e7810c8a04fba98fa456cfaba52b6659f13dbfd74e89d763e7afe12
size 12288

View File

@ -0,0 +1,34 @@
Index: gem2rpm-0.8.1/bin/gem2rpm
===================================================================
--- gem2rpm-0.8.1.orig/bin/gem2rpm
+++ gem2rpm-0.8.1/bin/gem2rpm
@@ -69,6 +69,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
Index: gem2rpm-0.8.1/lib/gem2rpm/distro.rb
===================================================================
--- gem2rpm-0.8.1.orig/lib/gem2rpm/distro.rb
+++ gem2rpm-0.8.1/lib/gem2rpm/distro.rb
@@ -20,7 +20,7 @@ module Gem2Rpm
else # no version or more versions (=> don't know what to do)
FEDORA
end
- elsif !release_files.grep(/SuSe/).empty?
+ elsif !release_files.grep(/SuSE/).empty?
OPENSUSE
else
DEFAULT

View File

@ -0,0 +1,209 @@
Index: gem2rpm-0.8.1/templates/opensuse.spec.erb
===================================================================
--- gem2rpm-0.8.1.orig/templates/opensuse.spec.erb
+++ gem2rpm-0.8.1/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,103 @@
# 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}
+
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 >= 1
+<% for req in spec.required_ruby_version -%>
+<% unless req.empty? -%>
+Requires: ruby <%= req %>
+BuildRequires: ruby-devel <%= req %>
<% end -%>
-<% for d in spec.dependencies -%>
+<% end -%>
+<% if false -%>
+<% for d in spec.runtime_dependencies -%>
+# <%= 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.homepage.nil? || spec.homepage.empty? -%>
Url: <%= spec.homepage %>
-Source: %{mod_name}-%{version}.gem
-#
-Summary: <%= spec.summary.gsub(/\.$/, "") %>
+<% end -%>
+Source: %{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
+
%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 = %w(test spec).select { |framework| format.file_entries.any? { |entry, data| path = entry['path'] ; path.index(framework + "/") == 0 } } -%>
+<% 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 %>
-
-%clean
-%{__rm} -rf %{buildroot}
+<% end -%>
%files
%defattr(-,root,root,-)
-<% spec.executables.each do |executable| %>
+<% spec.executables.each do |executable| -%>
%{_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}/
+<% end -%>
+%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem
+%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/
+<% test_frameworks.each do |framework| -%>
+%exclude %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/<%= framework %>
+<% end -%>
+%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_full_name}.gemspec
+
+<% if spec.has_rdoc -%>
+%files doc
+%defattr(-,root,root,-)
+%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/
+<% end -%>
+<% unless test_frameworks.empty? -%>
+%files testsuite
+%defattr(-,root,root,-)
+<% test_frameworks.each do |framework| -%>
+%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/<%= framework %>
+<% end -%>
+
+<% end -%>
%changelog
Index: gem2rpm-0.8.1/lib/gem2rpm/specification.rb
===================================================================
--- gem2rpm-0.8.1.orig/lib/gem2rpm/specification.rb
+++ gem2rpm-0.8.1/lib/gem2rpm/specification.rb
@@ -6,7 +6,11 @@ module Gem2Rpm
class Specification < SimpleDelegator
# A long description of gem wrapped to 78 characters.
def description
- Helpers::word_wrap(super.to_s.chomp, 78) + "\n"
+ text=super
+ if text.nil? or text.empty?
+ text=self.summary
+ end
+ Helpers::word_wrap(text.to_s.chomp, 78) + "\n"
end
# A list of Gem::Dependency objects this gem depends on (includes every
Index: gem2rpm-0.8.1/lib/gem2rpm.rb
===================================================================
--- gem2rpm-0.8.1.orig/lib/gem2rpm.rb
+++ gem2rpm-0.8.1/lib/gem2rpm.rb
@@ -35,11 +35,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, oldlicense=nil)
format = Gem::Format.from_file_by_path(fname)
spec = Gem2Rpm::Specification.new(format.spec)
- spec.description ||= spec.summary
download_path = ""
+ if spec.licenses.empty? && oldlicense
+ spec.licenses = oldlicense.split(' and ')
+ end
unless local
begin
download_path = find_download_url(spec.name, spec.version)
Index: gem2rpm-0.8.1/bin/gem2rpm
===================================================================
--- gem2rpm-0.8.1.orig/bin/gem2rpm
+++ gem2rpm-0.8.1/bin/gem2rpm
@@ -132,9 +132,15 @@ end
if output_file.nil?
Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage) unless deps
else
+ oldfile=IO.readlines(output_file) if File.exists? output_file
+ oldlicense=nil
+ oldfile.each do |line|
+ m = line.match(%r{^License:\s*(\w.*)$})
+ oldlicense = m[1] if m
+ end if oldfile
begin
out = open(output_file, "w")
- Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage)
+ Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage, oldlicense)
ensure
out.close()
end

3
gem2rpm-opensuse Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "obsolete, gem2rpm knows it's running on opensuse" > &2
exec gem2rpm -t opensuse $1

143
rubygem-gem2rpm.changes Normal file
View File

@ -0,0 +1,143 @@
-------------------------------------------------------------------
Mon Jul 30 12:43:00 UTC 2012 - cfarrell@suse.com
- license update: GPL-2.0+
See data/LICENSE
-------------------------------------------------------------------
Fri Jul 27 10:00:27 UTC 2012 - coolo@suse.com
- do not use %gem_unpack by default
-------------------------------------------------------------------
Fri Jul 27 08:19:14 UTC 2012 - coolo@suse.com
- do not put out empty URLs
-------------------------------------------------------------------
Thu Jul 26 13:11:05 UTC 2012 - coolo@suse.com
- fix OS detection on SLE11
-------------------------------------------------------------------
Thu Jul 26 09:56:31 UTC 2012 - coolo@suse.com
- no longer provide stuff for older distributions, we rely on patched
rpms
-------------------------------------------------------------------
Wed Jul 25 13:43:53 UTC 2012 - coolo@suse.com
- do not add buildrequires, but install with -f
-------------------------------------------------------------------
Tue Jul 24 16:17:16 UTC 2012 - coolo@suse.com
- cleanup the opensuse template
-------------------------------------------------------------------
Tue Jul 24 15:37:15 UTC 2012 - coolo@suse.com
- update to 0.8.1, major cleanup and base on new macros
-------------------------------------------------------------------
Wed Apr 4 15:42:10 UTC 2012 - coolo@suse.com
- small cleanup
-------------------------------------------------------------------
Wed Dec 7 13:38:47 UTC 2011 - jreidinger@suse.com
- fix requirements, as package need to run json parser
-------------------------------------------------------------------
Wed Mar 23 11:33:09 UTC 2011 - mrueckert@suse.de
- dont check if spec.license responds_to each. strings have that
method too. check for join
- minor template cleanup
-------------------------------------------------------------------
Tue Mar 22 15:48:03 UTC 2011 - jreidinger@novell.com
- Don't have hardcoded license. Try to extract it from specfile or
if it fail force user to manually check license. It avoids
problems with wrong license for rubygems
-------------------------------------------------------------------
Fri Feb 18 12:43:38 UTC 2011 - mrueckert@suse.de
- remove license tag from doc/testsuite package
-------------------------------------------------------------------
Mon Jan 31 14:48:18 UTC 2011 - mrueckert@suse.de
- small template clean up
-------------------------------------------------------------------
Thu Jan 20 13:44:42 UTC 2011 - mrueckert@suse.de
- remove version from header comment
- calculate the year on run
-------------------------------------------------------------------
Mon Jan 17 13:40:33 UTC 2011 - mvidner@suse.cz
- Updated openSUSE template to produce *- doc and *-testsuite subpackages.
http://lists.opensuse.org/opensuse-ruby/2010-12/msg00001.html
-------------------------------------------------------------------
Thu Dec 9 15:33:55 UTC 2010 - chris@computersalat.de
- update template
o # Copyright (c) 2010
-------------------------------------------------------------------
Wed Jun 9 16:28:21 UTC 2010 - mrueckert@suse.de
- fix typo in template:
"requirements" is not "requirement".
-------------------------------------------------------------------
Wed Jun 9 09:49:19 UTC 2010 - mrueckert@suse.de
- fix deprecation warning in template with newer versions of rubygems:
version_requirements is now called requirements
-------------------------------------------------------------------
Tue May 25 16:06:25 UTC 2010 - mrueckert@suse.de
- use rubygems_requires macro instead of repeating the
#if-conditional in every package
-------------------------------------------------------------------
Tue May 25 11:22:11 UTC 2010 - mrueckert@suse.de
- use requires_eq/requires_ge instead of hardcoding the rubygems
version during spec generation
-------------------------------------------------------------------
Tue Mar 2 12:56:07 UTC 2010 - prusnak@suse.cz
- use default URL when none is specified in gem (default-url.patch)
-------------------------------------------------------------------
Fri Jan 22 17:32:57 CET 2010 - prusnak@suse.cz
- fix version transform (fix-spec-versions.patch)
-------------------------------------------------------------------
Sat Nov 14 02:08:21 UTC 2009 - mrueckert@suse.de
- ignore development type requires of gems
-------------------------------------------------------------------
Fri Mar 27 17:38:45 CET 2009 - mrueckert@suse.de
- fix opensuse template
-------------------------------------------------------------------
Fri Mar 27 16:06:28 CET 2009 - mrueckert@suse.de
- initial package

75
rubygem-gem2rpm.spec Normal file
View File

@ -0,0 +1,75 @@
#
# spec file for package rubygem-gem2rpm
#
# Copyright (c) 2012 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/
#
Name: rubygem-gem2rpm
Version: 0.8.1
Release: 0
%define mod_name gem2rpm
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: ruby-macros >= 1
%rubygems_requires
Url: https://github.com/lutter/gem2rpm/
Source: %{mod_full_name}.gem
Source2: gem2rpm-opensuse
Patch0: gem2rpm-fix-opensuse-template.diff
Patch1: gem2rpm-change-default-template.diff
Summary: Generate rpm specfiles from gems
License: GPL-2.0+
Group: Development/Languages/Ruby
%description
Generate source rpms and rpm spec files from a Ruby Gem.
The spec file tries to follow the gem as closely as possible
%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.
%prep
%gem_unpack
%patch0 -p1
%patch1 -p1
%build
%gem_build
%install
%gem_install
%{__install} -D -m 0755 %{S:2} %{buildroot}%{_bindir}/gem2rpm-opensuse
%files
%defattr(-,root,root,-)
%{_bindir}/gem2rpm
%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem
%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/
%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_full_name}.gemspec
%{_bindir}/gem2rpm-opensuse
%files doc
%defattr(-,root,root,-)
%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/
%changelog