Hello community,

here is the log from the commit of package ruby for openSUSE:Factory checked in 
at 2014-02-12 19:35:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ruby (Old)
 and      /work/SRC/openSUSE:Factory/.ruby.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ruby"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ruby/ruby.changes        2013-08-30 
11:48:33.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ruby.new/ruby.changes   2014-02-12 
19:35:30.000000000 +0100
@@ -2 +2 @@
-Mon Aug 19 11:15:25 UTC 2013 - [email protected]
+Mon Feb 10 11:20:16 UTC 2014 - [email protected]
@@ -4,2 +4,3 @@
-- fix Bug 834785 - VUL-0: ruby*: default /etc/gemrc uses http source 
-  of gems instead of https 
+- Don't require rpm-with-ruby-provide-hook on SLE11.
+  It's not a runtime requirement but a build-time requirement for
+  rubygems in SLE11. Buildservice will take care of that.
@@ -8 +9 @@
-Sat Jun 29 12:38:12 UTC 2013 - [email protected]
+Fri Feb  7 12:05:32 UTC 2014 - [email protected]
@@ -10 +11,2 @@
-- change too strict ruby20 requires with _ge
+- reintroduce update-alternatives for rake, rdoc and ri as those
+  can come from more uptodate gems
@@ -13 +15 @@
-Wed Jun 26 15:01:32 UTC 2013 - [email protected]
+Sat Feb  1 11:51:30 UTC 2014 - [email protected]
@@ -15 +17 @@
-- use update-alternatives the right way - which is portable too
+- readd old macros - for now at least
@@ -18 +20 @@
-Tue Jun 25 09:02:48 UTC 2013 - [email protected]
+Fri Jan 31 10:22:24 UTC 2014 - [email protected]
@@ -20 +22 @@
-- remove --force usage in favor of portable rm (SLE11)
+- generate provides for embedded rubygems
@@ -23 +25 @@
-Tue Jun  4 17:04:50 UTC 2013 - [email protected]
+Thu Jan 30 14:29:36 UTC 2014 - [email protected]
@@ -25 +27 @@
-- use --force for update-alternatives
+- merged ruby-common
@@ -28 +30 @@
-Sat Apr 27 16:25:12 UTC 2013 - [email protected]
+Sun Jan 19 12:54:46 UTC 2014 - [email protected]
@@ -30 +32,6 @@
-- switch to ruby 2.0 default
+- new package split - only single Ruby version installable
+  ruby - binary
+  libruby2_1-2_0 - ruby runtime library
+  ruby-stdlib - ruby standard library
+  ruby-doc - ruby documentation
+  ruby-devel - ruby development
@@ -33 +40 @@
-Mon Jan 21 15:42:54 UTC 2013 - [email protected]
+Sun Jan 19 12:53:57 UTC 2014 - [email protected]
@@ -35 +42,2 @@
-- buildignore rubygems package to avoid bootstrap problem
+- revert the ruby split (ruby - ruby21)
+  rename ruby21 to ruby, integrate 'ruby' and 'ruby-common'
@@ -38 +46 @@
-Tue Nov 13 14:14:27 UTC 2012 - [email protected]
+Thu Jan  9 10:37:57 UTC 2014 - [email protected]
@@ -40,2 +48,2 @@
-- ruby-common no longer provides anything that ruby requires,
-  so remove it
+- remove part of rubygems1.5 patch that modify mkmf which is
+  already fixed upstream
@@ -44 +52 @@
-Sat Nov  3 15:31:49 UTC 2012 - [email protected]
+Wed Jan  8 20:03:32 UTC 2014 - [email protected]
@@ -46 +54,2 @@
-- buildignore own subpackages to avoid bootstrap problem
+- fix rb_arch in spec: append -gnu
+- fix native gem builds: create gem native extensions dir
@@ -49 +58 @@
-Mon Aug  6 10:30:08 UTC 2012 - [email protected]
+Mon Jan  6 08:31:16 UTC 2014 - [email protected]
@@ -51 +60,16 @@
-- reenable rdoc generation, no need to differ from upstream there
+- initial version for ruby 2.1.0 - changes to Ruby 2.0:
+  VM (method cache)
+  RGenGC (See ko1’s RubyKaigi presentation and RubyConf 2013 presentation)
+  refinements #8481 #8571
+  syntax changes
+  Rational/Complex Literal #8430
+  def’s return value #3753
+  Bignum
+  use GMP #8796
+  String#scrub #8414
+  Socket.getifaddrs #8368
+  RDoc 4.1.0 and RubyGems 2.2.0
+  “literal”.freeze is now optimized #9042
+  add Exception#cause #8257
+  update libraries like BigDecimal, JSON, NKF, Rake, RubyGems, and RDoc
+  remove curses #8584
@@ -53,875 +77,5 @@
--------------------------------------------------------------------
-Wed Aug  1 13:29:19 UTC 2012 - [email protected]
-
-- add update-alternatives for ruby provided binaries
-
--------------------------------------------------------------------
-Wed Aug  1 12:07:35 UTC 2012 - [email protected]
-
-- expand ruby19 gemspecs as provides automatically
-
--------------------------------------------------------------------
-Thu Jul 26 09:53:19 UTC 2012 - [email protected]
-
-- remove rubygem-requires - rpm does it correctly
-
--------------------------------------------------------------------
-Thu Jul 26 07:36:15 UTC 2012 - [email protected]
-
-- split out ruby-common into a package on its own
-
--------------------------------------------------------------------
-Wed Jul 25 14:52:49 UTC 2012 - [email protected]
-
-- map the != operator to > - which might be wrong in 50% of all cases
-
--------------------------------------------------------------------
-Wed Jul 25 14:39:43 UTC 2012 - [email protected]
-
-- require a patched rpm in case rpm does not have magic hooks
-
--------------------------------------------------------------------
-Wed Jul 25 12:17:02 UTC 2012 - [email protected]
-
-- move the option parsing to a shell script that is able to do it
-  rightly (rpm macros are just *BAD*)
-
--------------------------------------------------------------------
-Wed Jul 25 11:09:28 UTC 2012 - [email protected]
-
-- make the rubygemdeps a ruby script much more clever about gemspecs
-
--------------------------------------------------------------------
-Wed Jul 25 08:27:38 UTC 2012 - [email protected]
-
-- Another take on %gem_install, the version w/o passing parameters
-  seemed to be wrong
-
--------------------------------------------------------------------
-Wed Jul 25 05:54:25 UTC 2012 - [email protected]
-
-- avoid *.gemspec, we get problems if we there are two
-
--------------------------------------------------------------------
-Tue Jul 24 15:24:43 UTC 2012 - [email protected]
-
-- remove too relaxing permissions from unpacked archive
-
--------------------------------------------------------------------
-Tue Jul 24 14:55:31 UTC 2012 - [email protected]
-
-- add a provides for ruby-macros
-
--------------------------------------------------------------------
-Tue Jul 24 14:36:38 UTC 2012 - [email protected]
-
-- Fix %gem_unpack:
-  Fetch Gemspec from gem metadata for gems that don't package Gemspecs
-  but generate them programatically
-
--------------------------------------------------------------------
-Tue Jul 17 14:15:42 UTC 2012 - [email protected]
-
-- Fix ruby(abi) requires generation, the path glob was to broad
-
--------------------------------------------------------------------
-Mon Jul  9 05:17:40 UTC 2012 - [email protected]
-
-- rename $bin19 binaries to $bin
-
--------------------------------------------------------------------
-Wed Jul  4 08:59:02 UTC 2012 - [email protected]
-
-- Fix old-style %gem_install macro (missing parameter)
-
--------------------------------------------------------------------
-Tue Jul  3 08:02:01 UTC 2012 - [email protected]
-
-- Provide the following new RPM macros:
-  + %gem_unpack
-  + %gem_build
-  + %gem_install (retaining the old behavior)
-
--------------------------------------------------------------------
-Mon Jul  2 14:06:43 UTC 2012 - [email protected]
-
-- add automatic provides and requires for rubygems
-
--------------------------------------------------------------------
-Tue Jun 19 10:10:00 UTC 2012 - [email protected]
-
-- also add the old macro names as wrapper
-
--------------------------------------------------------------------
-Tue May  8 09:46:38 UTC 2012 - [email protected]
-
-- make this package a wrapper around the default ruby - ruby19 for now
-
--------------------------------------------------------------------
-Mon Feb 13 10:54:34 UTC 2012 - [email protected]
++++ 771 more lines (skipped)
++++ between /work/SRC/openSUSE:Factory/ruby/ruby.changes
++++ and /work/SRC/openSUSE:Factory/.ruby.new/ruby.changes

Old:
----
  gemrc

New:
----
  drop_content_size_check_in_xmlrpc.patch
  gem_build_cleanup
  gem_install.sh
  generate_buildrequires.sh
  generate_rubygemprovides.awk
  ruby-1.9.2p290_tcl_no_stupid_rpaths.patch
  ruby-2.1.0.tar.bz2
  ruby-rpmlintrc
  ruby.rpm-macros
  ruby19-export_init_prelude.patch
  rubygems-1.5.0_buildroot.patch
  rubygems.attr
  rubygemsdeps.rb

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ruby.spec ++++++
--- /var/tmp/diff_new_pack.IbgLO0/_old  2014-02-12 19:35:31.000000000 +0100
+++ /var/tmp/diff_new_pack.IbgLO0/_new  2014-02-12 19:35:31.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ruby
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 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
@@ -17,27 +17,102 @@
 
 
 Name:           ruby
-Version:        2.0
+
+####
+#!!!
+#!!! when updating, check versions of embedded rubygems in package stdlib below
+#!!!
+####
+
+%define patch_level p0
+Version:        2.1.0
 Release:        0
+
+# ruby-macros and ruby-common version
+%define rpm_macros_version 3
+
+#
+%define pkg_version 2.1.0
+%define libname lib%{name}2_1
+# keep in sync with macro file!
+%define rb_ver  2.1.0
+%define rb_arch %(echo %{_target_cpu}-linux-gnu | sed -e "s/ppc/powerpc/")
+%define rb_libdir                         %{_libdir}/ruby/%{rb_ver}/
+%define rb_archdir                        %{_libdir}/ruby/%{rb_ver}/%{rb_arch}
+# keep in sync with macro file!
+#
+# from valgrind.spec
+%ifarch %ix86 x86_64 ppc ppc64
+%define use_valgrind 1
+%endif
+# see https://bugs.ruby-lang.org/issues/8000 - might come back
+%if %suse_version < 1230
+%define tk_version_supported 1
+%endif
+# the tests are unfortunately rather fishy
+%define run_tests 0
+
+#
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Source0:        ruby.macros
-Source2:        gemrc
-Provides:       /usr/bin/ruby
+BuildRequires:  awk
+BuildRequires:  gdbm-devel
+BuildRequires:  libffi-devel
+BuildRequires:  libyaml-devel
+BuildRequires:  ncurses-devel
+BuildRequires:  openssl-devel
+BuildRequires:  pkg-config
+BuildRequires:  readline-devel
+BuildRequires:  tk-devel
+BuildRequires:  zlib-devel
+# this requires is needed as distros older than 11.3 have a buildignore on 
freetype2, without this the detection of the tk extension fails
+BuildRequires:  freetype2-devel
+%if 0%{?suse_version} > 1010
+BuildRequires:  xorg-x11-libX11-devel
+%else
+BuildRequires:  xorg-x11-devel
+%endif
+%if 0%{?use_valgrind}
+%if 0%{?suse_version} > 1021
+BuildRequires:  valgrind-devel
+%else
+BuildRequires:  valgrind
+%endif
+%endif
+Provides:       rubygem-rake = 10.1.0
+Provides:       ruby(abi) = %{rb_ver}
+
+Provides:       ruby-common = %{rpm_macros_version}
+Obsoletes:      ruby-common < %{rpm_macros_version}
+Provides:       ruby21
+Conflicts:      ruby18
+Conflicts:      ruby19
+Conflicts:      ruby20
+Requires:       ruby-stdlib
+PreReq:         update-alternatives
+BuildRequires:  update-alternatives
+
+Provides:       ruby-macros = %{rpm_macros_version}
+
+#
 Url:            http://www.ruby-lang.org/
+Source:         
http://cache.ruby-lang.org/pub/ruby/2.1/ruby-%{pkg_version}.tar.bz2
+# sources from former ruby-common
+Source1:        gem_build_cleanup
+Source2:        ruby.macros
+Source3:        ruby.rpm-macros
+Source4:        rubygems.attr
+Source5:        rubygemsdeps.rb
+Source6:        gem_install.sh
+Source7:        generate_buildrequires.sh
+Source8:        generate_rubygemprovides.awk
+
+Patch0:         rubygems-1.5.0_buildroot.patch
+Patch1:         ruby-1.9.2p290_tcl_no_stupid_rpaths.patch
+Patch2:         drop_content_size_check_in_xmlrpc.patch
+#
 Summary:        An Interpreted Object-Oriented Scripting Language
-License:        MIT
+License:        BSD-2-Clause or Ruby
 Group:          Development/Languages/Ruby
-BuildRequires:  ruby-common
-BuildRequires:  ruby20-devel
-BuildRequires:  update-alternatives
-#!BuildIgnore:  ruby ruby-devel
-#!BuildIgnore:  rubygems
-%requires_ge ruby20
-Provides:       rubygems = 1.8.15
-Obsoletes:      rubygems < 1.8.15
-Requires:       update-alternatives
-
-%{expand:%(rpm -ql ruby20 | fgrep .gemspec | /usr/bin/ruby2.0 
/usr/lib/rpm/rubygemsdeps.rb --provides | sed -e 's,^,Provides:,')}
 
 %description
 Ruby is an interpreted scripting language for quick and easy
@@ -68,68 +143,321 @@
 - Highly Portable (works on many UNIX machines; DOS, Windows, Mac,
 BeOS, and more)
 
+%package -n %{libname}
+Summary:        Dynamic runtime library for Ruby
+Group:          System/Libraries
+
+%description -n %{libname}
+Dynamic runtime library libruby2.1.so.2.0.0 for Ruby
+
+%package doc
+Summary:        Documentation and samples for Ruby
+Group:          Development/Languages/Ruby
+
+%description doc
+Documentation and samples for Ruby
+
+%package stdlib
+Summary:        The Ruby standard library
+Group:          Development/Languages/Ruby
+
+################################
+# generate provides for embedded rubygems
+# must be 'manually' generated since
+# - the final .gemspec files are created during %build and %install
+# - the usual means to generate provides for rubygems is using ruby
+#   and ruby is not available while building ruby :-/
+
+%define gen_embedded_provides4() %(awk -f %{S:8} -- %version %arch %1 %2 %3 %4)
+%define gen_embedded_provides5() %(awk -f %{S:8} -- %version %arch %1 %2 %3 %4 
%5)
+%gen_embedded_provides4 io-console 0 4 2
+%gen_embedded_provides4 json 1 8 1
+%gen_embedded_provides4 minitest 4 7 5
+%gen_embedded_provides4 psych 2 0 2
+%gen_embedded_provides4 rake 10 1 0
+%gen_embedded_provides4 rdoc 4 1 0
+%gen_embedded_provides5 test-unit 2 1 0 0
+
+################################
+
+%description stdlib
+The Ruby standard library
+
 %package devel
 Summary:        Development files to link against Ruby
 Group:          Development/Languages/Ruby
-Requires:       %{name}
-Requires:       ruby20-devel
+Requires:       %{name} = %{version}
+Provides:       rubygems = 1.3.7
 Provides:       rubygems_with_buildroot_patch
+Requires:       ruby-common
 
 %description devel
 Development files to link against Ruby.
 
+%package devel-extra
+Summary:        Special development files of ruby, normally not installed
+Group:          Development/Languages/Ruby
+Requires:       %{name}-devel = %{version}
+
+%description devel-extra
+Development files to link against Ruby.
+
+%if 0%{?tk_version_supported} > 0
+%package tk
+Summary:        TCL/TK bindings for Ruby
+Group:          Development/Languages/Ruby
+Requires:       %{name} = %{version}
+
+%description tk
+TCL/TK bindings for Ruby
+%endif
+
+%package doc-ri
+Summary:        Ruby Interactive Documentation
+Group:          Development/Languages/Ruby
+Requires:       %{name} = %{version}
+%if 0%{?suse_version} >= 1121
+BuildArch:      noarch
+%endif
+
+%description doc-ri
+This package contains the RI docs for ruby
+
+%package doc-html
+Summary:        This package contains the HTML docs for ruby
+Group:          Development/Languages/Ruby
+Requires:       %{name} = %{version}
+%if 0%{?suse_version} >= 1121
+BuildArch:      noarch
+%endif
+
+%description doc-html
+This package contains the HTML docs for ruby
+
+%package examples
+Summary:        Example scripts for ruby
+Group:          Development/Languages/Ruby
+Requires:       %{name} = %{version}
+%if 0%{?suse_version} >= 1121
+BuildArch:      noarch
+%endif
+
+%description examples
+Example scripts for ruby
+
+%package test-suite
+Requires:       %{name} = %{version}
+Summary:        An Interpreted Object-Oriented Scripting Language
+Group:          Development/Languages/Ruby
+%if 0%{?suse_version} >= 1121
+BuildArch:      noarch
+%endif
+
+%description test-suite
+Ruby is an interpreted scripting language for quick and easy
+object-oriented programming.  It has many features for processing text
+files and performing system management tasks (as in Perl).  It is
+simple, straight-forward, and extensible.
+
+* Ruby features:
+
+- Simple Syntax
+
+- *Normal* Object-Oriented features (class, method calls, for
+   example)
+
+- *Advanced* Object-Oriented features(Mix-in, Singleton-method, for
+   example)
+
+- Operator Overloading
+
+- Exception Handling
+
+- Iterators and Closures
+
+- Garbage Collection
+
+- Dynamic Loading of Object Files (on some architectures)
+
+- Highly Portable (works on many UNIX machines; DOS, Windows, Mac,
+BeOS, and more)
+
 %prep
+%setup -q -n ruby-%{pkg_version}
+%patch0
+%patch1
+%patch2
+find sample -type f -print0 | xargs -r0 chmod a-x
+grep -Erl '^#! */' benchmark bootstraptest ext lib sample test \
+  | xargs -r perl -p -i -e 's|^#!\s*\S+(\s+.*)?$|#!/usr/bin/ruby2.1$1|'
 
 %build
+%configure \
+  --with-soname=ruby \
+  --target=%{_target_platform} \
+  %if 0%{?use_valgrind}
+  --with-valgrind \
+  %endif
+  --with-mantype=man \
+  --enable-shared \
+  --disable-static \
+  --disable-rpath
+%{__make} all V=1
 
 %install
-mkdir -p %{buildroot}%_bindir %{buildroot}%{_sysconfdir}/alternatives
-for bin in erb gem irb rake rdoc ri ruby testrb; do
+%makeinstall V=1
+%{__install} -D -m 0644 %{S:2} %{buildroot}/etc/rpm/macros.ruby
+echo "%defattr(-,root,root,-)" > devel-extra-excludes
+echo "%defattr(-,root,root,-)" > devel-extra-list
+for i in iseq.h insns.inc insns_info.inc revision.h version.h  
thread_pthread.h \
+  ruby_atomic.h method.h id.h vm_core.h vm_opts.h node.h eval_intern.h 
vm_debug.h; do
+  install -m 644 $i %{buildroot}%{_includedir}/ruby-%{rb_ver}/
+  echo "%exclude %{_includedir}/ruby-%{rb_ver}/$i" >> devel-extra-excludes  
+  echo "%{_includedir}/ruby-%{rb_ver}/$i" >> devel-extra-list
+done
+
+# Create gem native extensions dir
+# use shell scripting here as we're executing the just installed binary
+%define rb_binary %{buildroot}/usr/bin/ruby -I %{buildroot}%{rb_libdir} -I 
%{buildroot}%{rb_archdir}
+export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
+export GEM_EXTENSIONS=`%{rb_binary} -rrubygems -e 'print 
Gem::BasicSpecification.new.extensions_dir'`
+export GEM_PLATFORM=`%{rb_binary} -r rubygems -r rbconfig -e 'print 
Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s'`
+# mkdir -p %{buildroot}$GEM_EXTENSIONS/$GEM_PLATFORM/%{rb_ver}
+mkdir -p %{buildroot}$GEM_EXTENSIONS
+
+# formerly ruby-common
+# we need to make sure it overwrites older macro versions and rpm sorts 
alphabetically
+install -D -m 0644 %{S:3} $RPM_BUILD_ROOT/etc/rpm/macros.suse-ruby
+install -D -m 0644 %{S:4} $RPM_BUILD_ROOT/usr/lib/rpm/fileattrs/rubygems.attr
+install -D -m 0755 %{S:5} $RPM_BUILD_ROOT/usr/lib/rpm/rubygemsdeps.rb
+install -D -m 0755 %{S:6} $RPM_BUILD_ROOT/usr/lib/rpm/gem_install.sh
+install -D -m 0755 %{S:1} $RPM_BUILD_ROOT/usr/lib/rpm/gem_build_cleanup.sh
+install -D -m 0755 %{S:7} $RPM_BUILD_ROOT/usr/lib/rpm/generate_buildrequires.sh
+
+mkdir -p %{buildroot}%{_sysconfdir}/alternatives
+for bin in rake rdoc ri; do
   # dummy
   touch %{buildroot}%{_sysconfdir}/alternatives/$bin
+  mv %{buildroot}%_bindir/$bin %{buildroot}%_bindir/$bin.ruby
   ln -s %{_sysconfdir}/alternatives/$bin %{buildroot}%_bindir/$bin
 done
-mkdir -p %{buildroot}%_libdir
-ln -s %_libdir/libruby2.0.so %{buildroot}%_libdir/libruby.so
-install -D -m 0644 %{S:0} %{buildroot}/etc/rpm/macros.ruby
-install -D -m 0644 %{S:2} %{buildroot}/etc/gemrc
 
 %post
-for bin in erb gem irb rake rdoc ri ruby testrb; do
+for bin in rake rdoc ri; do
   /usr/sbin/update-alternatives --install \
-    %{_bindir}/$bin $bin %{_bindir}/$bin"2.0" 20
+    %{_bindir}/$bin $bin %{_bindir}/$bin.ruby 2
 done
 
 %preun
 if [ "$1" = 0 ] ; then
-  for bin in erb gem irb rake rdoc ri ruby testrb; do
-    /usr/sbin/update-alternatives --remove $bin %{_bindir}/$bin"2.0"
+  for bin in rake rdoc ri; do
+    /usr/sbin/update-alternatives --remove $bin %{_bindir}/$bin.ruby
   done
 fi
 
+%if 0%{?run_tests}
+
+%check
+export LD_LIBRARY_PATH="$PWD"
+# we know some tests will fail when they do not find a /usr/bin/ruby
+make check V=1 ||:
+%endif
+
+%post -n %{libname}
+/sbin/ldconfig
+
+%postun -n %{libname}
+/sbin/ldconfig
+
 %files
-%defattr(-,root,root)
-%config /etc/gemrc
-%config /etc/rpm/macros.ruby
-%ghost %_sysconfdir/alternatives/erb
+%defattr(-,root,root,-)
+%config(noreplace) /etc/rpm/macros.ruby
+%ghost %{_sysconfdir}/alternatives/rake
+%ghost %{_sysconfdir}/alternatives/rdoc
+%ghost %{_sysconfdir}/alternatives/ri
 %{_bindir}/erb
-%ghost %_sysconfdir/alternatives/gem
 %{_bindir}/gem
-%ghost %_sysconfdir/alternatives/irb
 %{_bindir}/irb
-%ghost %_sysconfdir/alternatives/rake
 %{_bindir}/rake
-%ghost %_sysconfdir/alternatives/rdoc
 %{_bindir}/rdoc
-%ghost %_sysconfdir/alternatives/ri
 %{_bindir}/ri
-%ghost %_sysconfdir/alternatives/ruby
 %{_bindir}/ruby
-%ghost %_sysconfdir/alternatives/testrb
 %{_bindir}/testrb
-
-%files devel
-%defattr(-,root,root)
-%_libdir/libruby.so
+%{_bindir}/rake.ruby
+%{_bindir}/rdoc.ruby
+%{_bindir}/ri.ruby
+%if 0%{?tk_version_supported} > 0
+%exclude %{rb_libdir}/multi-tk.rb
+%exclude %{rb_libdir}/remote-tk.rb
+%exclude %{rb_libdir}/tcltk.rb
+%exclude %{rb_libdir}/tk*.rb
+%exclude %{rb_libdir}/tk/
+%exclude %{rb_libdir}/tkextlib/
+%exclude %{rb_archdir}/tcltklib.so
+%exclude %{rb_archdir}/tkutil.so
+%endif
+%{_mandir}/man1/ri.1*
+%{_mandir}/man1/irb.1*
+%{_mandir}/man1/erb.1*
+%{_mandir}/man1/rake.1*
+%{_mandir}/man1/ruby.1*
+%doc ChangeLog  COPYING  COPYING.ja  GPL  KNOWNBUGS.rb  LEGAL  NEWS  README  
README.EXT  README.EXT.ja  README.ja
+# former ruby-common files
+/etc/rpm/macros.suse-ruby
+%dir /usr/lib/rpm/fileattrs
+/usr/lib/rpm/fileattrs/rubygems.attr
+/usr/lib/rpm/rubygemsdeps.rb
+/usr/lib/rpm/gem_install.sh
+/usr/lib/rpm/gem_build_cleanup.sh
+/usr/lib/rpm/generate_buildrequires.sh
+
+%files -n %{libname}
+%defattr(-,root,root,-)
+%{_libdir}/libruby.so.2.1*
+
+%files doc
+%defattr(-,root,root,-)
+%doc doc/* sample/
+
+%files stdlib
+%defattr(-,root,root,-)
+%{_libdir}/ruby/
+%if 0%{?tk_version_supported} > 0
+%exclude %{rb_libdir}/multi-tk.rb
+%exclude %{rb_libdir}/remote-tk.rb
+%exclude %{rb_libdir}/tcltk.rb
+%exclude %{rb_libdir}/tk*.rb
+%exclude %{rb_libdir}/tk/
+%exclude %{rb_libdir}/tkextlib/
+%exclude %{rb_archdir}/tcltklib.so
+%exclude %{rb_archdir}/tkutil.so
+%endif
+
+%files devel -f devel-extra-excludes
+%defattr(-,root,root,-)
+%{_includedir}/ruby-%{rb_ver}
+%{_libdir}/libruby.so
+%{_libdir}/libruby-static.a
+%{_libdir}/pkgconfig/ruby-2.1.pc
+
+%files devel-extra -f devel-extra-list
+
+%if 0%{?tk_version_supported} > 0
+%files tk
+%defattr(-,root,root,-)
+%{rb_libdir}/multi-tk.rb
+%{rb_libdir}/remote-tk.rb
+%{rb_libdir}/tcltk.rb
+%{rb_libdir}/tk*.rb
+%{rb_libdir}/tk/
+%{rb_libdir}/tkextlib/
+%{rb_archdir}/tcltklib.so
+%{rb_archdir}/tkutil.so
+%endif
+
+%files doc-ri
+%defattr(-,root,root,-)
+%dir %{_datadir}/ri/
+%{_datadir}/ri/%{rb_ver}/
 
 %changelog

++++++ drop_content_size_check_in_xmlrpc.patch ++++++
xmlrpc is doing a wrong content size check in case the server is compressing 
the answer. drop the check for now.
http://bugs.ruby-lang.org/issues/8182

Index: lib/xmlrpc/client.rb
===================================================================
--- lib/xmlrpc/client.rb.orig
+++ lib/xmlrpc/client.rb
@@ -509,8 +509,6 @@ module XMLRPC # :nodoc:
       expected = resp["Content-Length"] || "<unknown>"
       if data.nil? or data.bytesize == 0
         raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
-      elsif expected != "<unknown>" and expected.to_i != data.bytesize and 
resp["Transfer-Encoding"].nil?
-        raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
       end
 
       parse_set_cookies(resp.get_fields("Set-Cookie"))
++++++ gem_build_cleanup ++++++
#!/bin/sh
if [ ${#*} = 1 ] ; then
    if [ -d "$1" ] ; then
        find $1 \
        \( -name \*.o -o -name Makefile -o -name config.log -o -name 
config.status -o -name Makefile.html -o -name gem_make.out -o -name mkmf.log -o 
-name \*.bak -o -name .deps -o -name .libs -o -name CVS \) \
            -print0 | xargs -r0 rm -rv || :
        # remove more strict in the docu
        find $1/doc \( -name Makefile.ri -o -name ext \) -print0 | xargs -r0 rm 
-rv || :
    else
        echo "'$1' does not exists or is not a directory! Exiting." >&2
        exit 1
    fi
else
    echo "Please pass exact one argument to this script! Exiting." >&2
    exit 1
fi
++++++ gem_install.sh ++++++
#! /bin/bash

set -e

# options may be followed by one colon to indicate they have a required argument
if ! options=$(getopt -o dEf -l 
ignore-dependencies,force,no-rdoc,rdoc,no-ri,ri,env-shebang,no-env-shebang,default-gem:,build-root:,gem-binary:
 -- "$@")
then
    # something went wrong, getopt will put out an error message for us
    exit 1
fi

eval set -- "$options"

gem_binary=gem
defaultgem=
gemfile=
otheropts=
buildroot=

while [ $# -gt 0 ]
do
    case $1 in
    --default-gem) defaultgem=$2 ; shift;;
    --gem-binary) gem_binary="$2" ; shift;;
    --build-root) otheropts="$otheropts $1=$2"; buildroot=$2; shift;;
    (--) ;;
    (-*) otheropts="$otheropts $1";;
    (*) gemfile=$1; otheropts="$otheropts $1"; break;;
    esac
    shift
done

if [ "x$gemfile" = "x" ] ; then 
  gemfile=$(find . -maxdepth 2 -type f -name "$defaultgem")
  # if still empty, we pick the sources
  if [ "x$gemfile" = "x" ] ; then
    gemfile=$(find $RPM_SOURCE_DIR -name "$defaultgem")
  fi
  otheropts="$otheropts $gemfile"
fi
set -x
$gem_binary install --verbose --local $otheropts
if test -d $RPM_BUILD_ROOT/usr/bin; then
  cd $RPM_BUILD_ROOT/usr/bin
  # backward compat
  bins=`ls -1 *1.9 *2.0 2> /dev/null` || true
  if test -n "$bins"; then 
    for bin in $bins; do 
      mv -v $bin $(echo "$bin" | sed -e 's,2.0$,,; s,1.9$,,')
    done
  fi
fi

if [ -d "$buildroot" ]; then
  find $buildroot -type f -perm /u+x | while read file; do
    # TODO: scripts in ruby/1.9.1 should call ruby1.9 for consistency
    sed -i -e 's,^#!/usr/bin/env ruby,#!/usr/bin/ruby,; s,^#! *[^ 
]*/ruby,#!/usr/bin/ruby,' "$file"
  done
  # some windows made gems are broken
  find $buildroot -type d | xargs ls -ld || :
  find $buildroot -type f | xargs ls -l || :
  chmod -R u+w $buildroot
  chmod -R o-w $buildroot
fi

++++++ generate_buildrequires.sh ++++++
#!/bin/sh
#
# In the current package's specfile, updates a block delimited
# by "# BEGIN" / "# END" lines to contain BuildRequires: lines
# for each rubygem rpm (or rpm matching a given pattern) which
# has been built by the project.
#
# This gives us project-build-time dependency checking without the
# performance impact that specifying BuildRequires lines within
# each gem would cause.  For more information, see:
#
#   
http://en.opensuse.org/openSUSE:Packaging_Ruby#Compensating_for_lack_of_BuildRequires
#
# Usage:
# ------
#
# 1. Ensure you have an "all-rubygems-good" package or similar
#    in your project.  If in doubt, copy the one from
#    devel:languages:ruby:extensions.
#
# 2. cd to a working copy
#
# If you're feeling lazy, you are probably fine skipping the next two
# steps.
#
# 3. Run this script with the -l option and make sure you understand
#    any differences between each repository/arch combination in the
#    numbers of matching gems found.
#
# 4. If you don't, run with -l REPO ARCH to compare individual lists
#    of matching gems.
#
# 5. If you want a BuildRequires: list of matching gems from *all*
#    repo/arch combinations, run again with no arguments.
#
#      OR
#
#    If you want a BuildRequires: list of matching gems from a specific
#    repo/arch combinations, run again with REPO ARCH as arguments.
#
# 6. osc diff to review the changes to the spec file, then osc commit.

me=`basename $0`

DEFAULT_PATTERN="rubygem-"

main () {
    parse_opts "$@"

    if [ -z "$project" ]; then
        project=$( osc info | sed -ne '/^Project name: / { s///; p }' )
        if [ -z "$project" ]; then
            echo "Couldn't establish build service project name." >&2
            echo "Are you inside a package working directory?" >&2
            exit 1
        fi
    fi
    echo "Project: $project"

    case "$project" in
        home:*:branches:*)
            cat <<EOF >&2

WARNING: you are running this in a branch.

You probably need to specify the parent project via -P,
otherwise you may not get the dependencies you want.

EOF
            ;;
    esac            

    specfile=$( ls -1 *.spec )
    if ! [ -f "$specfile" ]; then
        echo "Couldn't find spec file." >&2
        echo "Are you inside a package working directory?" >&2
        exit 1
    fi

    if [ -n "$list" ]; then
        if [ -n "$repo" ]; then
            get_buildrequires_lines "$repo" "$arch"
        else
            list_matches
        fi
    else
        if [ -n "$repo" ]; then
            get_buildrequires_lines "$repo" "$arch" | update_spec
        else
            find_all_matches | update_spec
        fi
    fi
}

usage () {
    # Call as: usage [EXITCODE] [USAGE MESSAGE]
    exit_code=1
    if [[ "$1" == [0-9] ]]; then
        exit_code="$1"
        shift
    fi
    if [ -n "$1" ]; then
        echo "$*" >&2
        echo
    fi

    cat <<EOF >&2
Usage: $me [options] [REPOSITORY ARCH]
Options:
  -h, --help         Show this help and exit
  -l, --list         List matching rpms for the given repository / arch.
                     If no repository specified, show counts of matching
                     rpms per repository / arch.
  -P, --project=PROJ Retrieve rpm lists from PROJ, not the current project.
  -p, --pattern=PAT  Set the pattern to match rpms by [$DEFAULT_PATTERN]
EOF
    exit "$exit_code"
}

parse_opts () {
    list=
    project=
    pattern="$DEFAULT_PATTERN"

    while [ $# != 0 ]; do
        case "$1" in
            -h|--help)
                usage 0
                ;;
            -l|--list)
                list=y
                shift
                ;;
            -p|--pattern)
                pattern="$2"
                shift 2
                ;;
            -P|--project)
                project="$2"
                shift 2
                ;;
            -*)
                usage "Unrecognised option: $1"
                ;;
            *)
                break
                ;;
        esac
    done

    if [ $# = 1 ]; then
        usage "Insufficient arguments."
    fi

    if [ $# -gt 2 ]; then
        usage "Too many arguments."
    fi

    repo="$1"
    arch="$2"
}

get_buildrequires_lines () {
    repo="$1" arch="$2"
    osc api "/build/$project/$repo/$arch/_repository" | \
        grep "binary .*filename=\"$pattern" | \
        sed -e 's,.*  <binary filename=",,; s,\.rpm".*,,; s,^,BuildRequires: ,' 
| \
        grep -v debuginfo
}

list_matches () {
    echo
    echo "Matching rpms per repository/arch:"
    echo
    osc repos | while read repo arch; do
        count=$( get_buildrequires_lines "$repo" "$arch" | wc -l )
        printf "%-17s %-8s %d\n" "$repo" "$arch" "$count"
    done
    echo
}

find_all_matches () {
    osc repos "$project" | while read repo arch; do
        echo "Obtaining BuildRequires from $repo $arch ..." >&2
        get_buildrequires_lines "$repo" "$arch"
    done | sort -u
}

edit_spec () {
    sed -n -e '1,/BEGIN/p' $specfile
    echo "# Automatically generated by $0"
    echo "# on `date`"
    echo "# See 
http://en.opensuse.org/openSUSE:Packaging_Ruby#Compensating_for_lack_of_BuildRequires";
    cat
    sed -n -e '/END/,$p' $specfile
}

update_spec () {
    if edit_spec > $specfile.new; then
        mv $specfile.new $specfile
        echo "Updated spec: $specfile"
    else
        echo "Failed to generate new spec file contents; aborting." >&2
        exit 1
    fi
}

main "$@"
++++++ generate_rubygemprovides.awk ++++++
#!/usr/bin/awk -f
#
# Generate 'Provides' for embedded rubygems
#
# Call-seq:
#   generate_rubygemprovides.awk <ruby-version> <arch> <gemname> <gemmajor> 
<gemminor> <gemmicro> [ <gemtiny> ]
#
#   Provides: rubygem(<rubyversion>:<gemname>) = <gemversion>
#   Provides: rubygem(<rubyversion>:<gemname>:<gemmajorversion>) = <gemversion>
#   Provides: 
rubygem(<rubyversion>:<gemname>:<gemmajorversion>.<gemminorversion>) = 
<gemversion>
#   Provides: 
rubygem(<rubyversion>:<gemname>:<gemmajorversion>.<gemminorversion>.<gemtinyversion)
 = <gemversion>
#   Provides: rubygem(<rubyversion>:<gemname>:<gemversion>) = <gemversion>
#   Provides: rubygem(<gemname>) = <gemversion>
#   Provides: rubygem-<gemname> = <gemversion>
#   Provides: rubygem-<gemname> = <gemversion>-<rubyrelease>
#   Provides: rubygem-<gemname>(<arch>) = <gemversion>-<rubyrelease>
#   Provides: rubygem-<gemname>-<gemmajorversion> = <gemversion>
#   Provides: rubygem-<gemname>-<gemmajorversion>_<gemminorversion> = 
<gemversion>
#   Provides: 
rubygem-<gemname>-<gemmajorversion>_<gemminorversion>_<gemmicroversion> = 
<gemversion>
#   Provides: 
rubygem-<gemname>-<gemmajorversion>_<gemminorversion>_<gemmicroversion>_<gemtinyversion>
 = <gemversion>

BEGIN {
  rbver = ARGV[1]
  arch = ARGV[2]
  name = ARGV[3]
  major = ARGV[4]
  minor = ARGV[5]
  micro = ARGV[6]
  tiny = ARGV[7]

  if (tiny != "") {
    version = major "." minor "." micro "." tiny
  }
  else {
    version = major "." minor "." micro
  }
  print "Provides: rubygem(" rbver ":" name ") = " version
  print "Provides: rubygem(" rbver ":" name ":" major ") = " version
  print "Provides: rubygem(" rbver ":" name ":" major "." minor ") = " version
  print "Provides: rubygem(" rbver ":" name ":" major "." minor "." micro ") = 
" version
  if (tiny != "") {
    print "Provides: rubygem(" rbver ":" name ":" major "." minor "." micro "." 
tiny ") = " version
  }
  print "Provides: rubygem(" rbver ":" name ":" version ") = " version
  print "Provides: rubygem(" name ") = " version
  print "Provides: rubygem-" name " = " version
# not needed currently
#  if ( arch == "x86_64") {
#    print "Provides: rubygem-" name "(" arch ") = " version
#  }
  print "Provides: rubygem-" name "-" major " = " version
  print "Provides: rubygem-" name "-" major "_" minor " = " version
  print "Provides: rubygem-" name "-" major "_" minor "_" micro " = " version
  if (tiny != "") {
    print "Provides: rubygem-" name "-" major "_" minor "_" micro "_" tiny " = 
" version
  }
}

++++++ ruby-1.9.2p290_tcl_no_stupid_rpaths.patch ++++++
Index: ext/tk/extconf.rb
===================================================================
--- ext/tk/extconf.rb.orig
+++ ext/tk/extconf.rb
@@ -224,9 +224,7 @@ def get_shlib_path_head
 
   else
     [
-      '/opt', '/pkg', '/share',
-      '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local',
-      '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr'
+      '/usr'
     ].each{|dir|
       next unless File.directory?(dir)
 
++++++ ruby-rpmlintrc ++++++
addFilter("files-duplicate /usr/share/ri/.*")
addFilter("unexpanded-macro /usr/share/ri/.*")
++++++ ruby.macros ++++++
--- /var/tmp/diff_new_pack.IbgLO0/_old  2014-02-12 19:35:31.000000000 +0100
+++ /var/tmp/diff_new_pack.IbgLO0/_new  2014-02-12 19:35:31.000000000 +0100
@@ -1,48 +1,43 @@
-#
-# Copyright (c) 2012 SUSE Linux
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-%rb_binary                         %{rb20_binary}
-%gem_binary                        /usr/bin/gem2.0
-%rb_arch %{rb20_arch}
-%rb_ver %{rb20_ver}
-
-%rb_dir %{rb20_dir}
-%rb_libdir %{rb20_libdir}
-%rb_archdir %{rb20_archdir}
-
-%rb_sitedir %rb20_sitedir
-%rb_sitelibdir %rb20_sitelibdir
-%rb_sitearchdir %rb20_sitearchdir
-
-%rb_vendordir %rb20_vendordir  
-%rb_vendorlibdir %rb20_vendorlibdir
-%rb_vendorarchdir %rb20_vendorarchdir 
-
-
-# old names
-%rb_sitelib                        %rb20_sitelibdir
-%rb_sitearch                       %rb20_sitearchdir
-#
-%rb_vendorlib                      %rb20_vendorlibdir
-%rb_vendorarch                     %rb20_vendorarchdir
+%rb_binary                         /usr/bin/ruby
+%rb_arch                           %(%{rb_binary} -e 'print RUBY_PLATFORM')
+%rb_ver                            %(%{rb_binary} -r rbconfig -e 'print 
RbConfig::CONFIG["ruby_version"]')
+#
+
+## Base
+# "rubylibprefix"=>"/usr/lib64/ruby",
+%rb_dir           %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["rubylibprefix"]' )
+# "rubylibdir"    =>"/usr/lib64/ruby/2.1.0",
+%rb_libdir        %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["rubylibdir"]' )
+# "archdir"       =>"/usr/lib64/ruby/2.1.0/x86_64-linux",
+%rb_archdir       %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["archdir"]' )
+
+## Site
+# "sitedir"       =>"/usr/lib64/ruby/site_ruby",
+%rb_sitedir       %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["sitedir"]' )
+# "sitelibdir"    =>"/usr/lib64/ruby/site_ruby/2.1.0",
+%rb_sitelibdir    %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["sitelibdir"]' )
+# "sitearchdir"   =>"/usr/lib64/ruby/site_ruby/2.1.0/x86_64-linux",
+%rb_sitearchdir   %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["sitearchdir"]' )
+
+## Vendor
+# "vendordir"     =>"/usr/lib64/ruby/vendor_ruby",
+%rb_vendordir     %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["vendordir"]' )
+# "vendorlibdir"  =>"/usr/lib64/ruby/vendor_ruby/2.1.0",
+%rb_vendorlibdir  %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["vendorlibdir"]' )
+# "vendorarchdir" =>"/usr/lib64/ruby/vendor_ruby/2.1.0/x86_64-linux",
+%rb_vendorarchdir %(%{rb_binary} -rrbconfig -e 'puts 
RbConfig::CONFIG["vendorarchdir"]' )
+
+# backward compat
+%rb_sitearch      %{rb_sitearchdir}
+%rb_sitelib       %{rb_sitelibdir}
+%rb_vendorlib     %{rb_vendorlibdir}
+%rb_vendorarch    %{rb_vendorarchdir}
+
+%gem_install                       /usr/lib/rpm/gem_install_wrapper.sh 
+%gem_cleanup                       /usr/bin/gem_build_cleanup 
%{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/
+
+%gem_base %(%{rb_binary} -rrubygems -e 'print 
Gem::BasicSpecification.new.base_dir' )
+%gem_extensions %(%{rb_binary} -rrubygems -e 'print 
Gem::BasicSpecification.new.extensions_dir' )
+%gem_doc_ext %(%{rb_binary} -rrubygems -e 'bs = Gem::BasicSpecification.new; 
rp = bs.extensions_dir.rpartition(bs.base_dir); print rp[1]+"/doc"+rp[2]' )
+%gem_platform %(%{rb_binary} -rrubygems -r rbconfig -e 'print 
Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s' )
 

++++++ ruby.rpm-macros ++++++
# %%gem_unpack macro unpacks a gem file into %%{_builddir}
#
# example:
#   %prep
#   %gem_unpack %{SOURCE0}
#   %patch1 -p1
#
%gem_unpack(s:) \
  source=%{-s:%{-s*}}%{!-s:%{SOURCE0}} \
  %{?gem_binary}%{!?gem_binary:/usr/bin/gem} unpack --verbose $source \
  cd %{mod_name}-%{version} \
  chmod og-w -R . \
  %{?gem_binary}%{!?gem_binary:/usr/bin/gem} specification --ruby $source > 
%{mod_name}-%{version}.gemspec \
%{nil}

# %%gem_build macro ...
#
%gem_build() \
GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name 
%{mod_name}-%{version}.gemspec | xargs dirname` \
cd $GEMSPEC_SOURCE_DIR && %{?gem_binary}%{!?gem_binary:/usr/bin/gem} build 
--verbose %{mod_name}-%{version}.gemspec \
%{nil}

# %%gem_install macro ...
#
# When invoked with a single parameter, the macro retains the old macro 
behavior, i.e.
# building the upstream gem directly in $RPM_BUILD_ROOT without unpacking to 
%{_builddir} first.
#
%gem_install /usr/lib/rpm/gem_install.sh --default-gem 
%{mod_name}-%{version}.gem --build-root %{buildroot} %{?gem_binary:--gem-binary 
%{gem_binary}}

# we need to copy parts of the %fdupes macro as rpm can't expand parameters in 
macro "calls" ;(
%gem_cleanup() \
/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \
fdupes -q -p -n -r %{buildroot}%{gem_base} | \
  while read _file; do \
    if test -z "$_target" ; then \
      _target="$_file"; \
    else \
      if test -z "$_file" ; then \
        _target=""; \
        continue ; \
      fi ; \
      ln -sf "${_target#%{buildroot}}" "$_file"; \
    fi ; \
 done \
%{nil}

# this is used in older gems - but it's pointless with newer ruby/rpm versions
%rubygems_requires %{nil}

%gem_base %(%{rb_binary} -rrubygems -e 'print Gem::Specification.new.base_dir' )
%gem_extensions %(%{rb_binary} -rrubygems -e 'print 
Gem::Specification.new.extensions_dir' || echo 
%{_libdir}/ruby/gems/%{rb_ver}/gems )
%gem_doc_ext %(%{rb_binary} -r rubygems -e 'bs = Gem::Specification.new; rp = 
bs.extensions_dir.rpartition(bs.base_dir); print rp[1]+"/doc"+rp[2]' )
%gem_platform %(%{rb_binary} -r rubygems -r rbconfig -e 'print 
Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s' )

++++++ ruby19-export_init_prelude.patch ++++++
Index: ruby-1.9.3-p194/include/ruby/ruby.h
===================================================================
--- ruby-1.9.3-p194.orig/include/ruby/ruby.h
+++ ruby-1.9.3-p194/include/ruby/ruby.h
@@ -1225,6 +1225,7 @@ void ruby_init_stack(volatile VALUE*);
     VALUE variable_in_this_stack_frame; \
     ruby_init_stack(&variable_in_this_stack_frame);
 void ruby_init(void);
+void ruby_init_prelude(void);
 void *ruby_options(int, char**);
 int ruby_run_node(void *);
 int ruby_exec_node(void *);
Index: ruby-1.9.3-p194/ruby.c
===================================================================
--- ruby-1.9.3-p194.orig/ruby.c
+++ ruby-1.9.3-p194/ruby.c
@@ -1091,7 +1091,7 @@ proc_options(long argc, char **argv, str
     return argc0 - argc;
 }
 
-static void
+void
 ruby_init_prelude(void)
 {
     Init_prelude();
++++++ rubygems-1.5.0_buildroot.patch ++++++
Index: lib/rubygems/dependency_installer.rb
===================================================================
--- lib/rubygems/dependency_installer.rb.orig
+++ lib/rubygems/dependency_installer.rb
@@ -72,6 +72,7 @@ class Gem::DependencyInstaller
   def initialize options = {}
     @only_install_dir = !!options[:install_dir]
     @install_dir = options[:install_dir] || Gem.dir
+    @build_root = options[:build_root]
 
     options = DEFAULT_OPTIONS.merge options
 
@@ -382,6 +383,7 @@ class Gem::DependencyInstaller
       :security_policy     => @security_policy,
       :user_install        => @user_install,
       :wrappers            => @wrappers,
+      :build_root          => @build_root,
       :install_as_default  => @install_as_default
     }
     options[:install_dir] = @install_dir if @only_install_dir
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb.orig
+++ lib/rubygems/installer.rb
@@ -590,8 +590,17 @@ class Gem::Installer
     # (or use) a new bin dir under the gem_home.
     @bin_dir             = options[:bin_dir] || Gem.bindir(gem_home)
     @development         = options[:development]
+    @build_root          = options[:build_root]
 
     @build_args          = options[:build_args] || Gem::Command.build_args
+
+    unless @build_root.nil?
+      require 'pathname'
+      @build_root = Pathname.new(@build_root).expand_path
+      @bin_dir = File.join(@build_root, options[:bin_dir] || 
Gem.bindir(@gem_home))
+      @gem_home = File.join(@build_root,@gem_home)
+      alert_warning "You build with buildroot.\n  Build root: #{@build_root}\n 
 Bin dir: #{@bin_dir}\n  Gem home: #{@gem_home}"
+    end
   end
 
   # DOC: Missing docs or :nodoc:.
Index: lib/rubygems/install_update_options.rb
===================================================================
--- lib/rubygems/install_update_options.rb.orig
+++ lib/rubygems/install_update_options.rb
@@ -59,6 +59,12 @@ module Gem::InstallUpdateOptions
                            end
     end
 
+    add_option(:"Install/Update", '--build-root DIR',
+               'Temporary installation root. Useful for building',
+               'packages. Do not use this when installing remote gems.') do 
|value, options|
+        options[:build_root] = File.expand_path(value)
+    end
+
     add_option(:"Install/Update", '-N', '--no-document',
                'Disable documentation generation') do |value, options|
       options[:document] = []
++++++ rubygems.attr ++++++
%__rubygems_requires    %{_rpmconfigdir}/rubygemsdeps.rb --requires
%__rubygems_provides    %{_rpmconfigdir}/rubygemsdeps.rb --provides
%__rubygems_path        ^%{_libdir}/ruby/gems/[^/]*/specifications

++++++ rubygemsdeps.rb ++++++
#!/usr/bin/ruby

# Copyright (c) 2012 Stephan Kulow
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

require 'optparse'
require 'rubygems'
#require 'rubygems/format'
require 'rubygems/specification'

opts = OptionParser.new("Usage: #{$0}")

provides=false
opts.on("-P", "--provides", "Output the provides of the package") do |val|
  provides=true
end
requires=false
opts.on("-R", "--requires", "Output the requires of the package") do |val|
  requires=true
end
file_match=".*/gems/[^/]*/specifications/.*\.gemspec$"
opts.on("-m", "--file-match REGEX", String,
        "Override the regex against which the input file names",
        "matched with the supplied regex") do |val|
  file_match=val
end
in_file=nil
opts.on("-g", "--gemspec FILE", String,
        "Take gemspec from FILE, not filename in STDIN",
        "Can be a .gem file or a .gemspec file") do |file|
  in_file=file
end
rest = opts.permute(ARGV)

unless provides || requires
  exit(0)
end

def fatal(msg)
  $stderr.puts msg
  exit 1
end

def register_gemspec_from_file(gemspecs, rubyabi, file)
  fatal "Couldn't read '#{file}'" unless File.readable? file

  case file
  when /\.gem$/
    gem = Gem::Format.from_file_by_path(file)
    fatal "Failed to load gem from '#{file}'" unless gem
    spec = gem.spec
  when /\.gemspec$/
    spec = Gem::Specification.load(file)
    fatal "Failed to load gem spec from '#{file}'" unless spec
  else
    fatal "'#{file}' must be a .gem or .gemspec file"
  end

  gemspecs << [ rubyabi, spec ]
end  

def rubyabi_from_path(path)
  m = path.match(%r{.*/gems/([^/]*)/.*})
  return m ? m[1] : RbConfig::CONFIG["ruby_version"]
end

gemspecs = Array.new

if in_file
  # This mode will not be used during actual rpm builds, but only by
  # gem packagers for debugging / diagnostics, so that they can
  # predict in advance what the dependencies will look like.
  rubyabi = rubyabi_from_path(in_file) || '$RUBYABI'
  register_gemspec_from_file(gemspecs, rubyabi, in_file)
else
  $stdin.each_line do |line|
    line.chomp!
    m = line.match(%r{#{file_match}$})
    if m
      register_gemspec_from_file(gemspecs, rubyabi_from_path(line), line)
    end
  end
end

gemspecs.each do |rubyabi, spec|
  if provides
    # old forms
    puts "rubygem-#{spec.name} = #{spec.version}"
    versions = spec.version.to_s.split('.')
    puts "rubygem-#{spec.name}-#{versions[0]} = #{spec.version}" if 
versions.length > 0
    puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]} = #{spec.version}" 
if versions.length > 1
    puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]}_#{versions[2]} = 
#{spec.version}" if versions.length > 2

    # version without ruby version - asking for trouble
    puts "rubygem(#{spec.name}) = #{spec.version}"
    if rubyabi
      puts "rubygem(#{rubyabi}:#{spec.name}) = #{spec.version}"
      puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}) = #{spec.version}" 
if versions.length > 0
      puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}) = 
#{spec.version}" if versions.length > 1
      puts 
"rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}.#{versions[2]}) 
= #{spec.version}" if versions.length > 2
    end
  end

  if requires
    puts "ruby(abi) = #{rubyabi}" if rubyabi
    puts "rubygems" if rubyabi.to_f < 1.9
    spec.runtime_dependencies.each do |dep|
      dep.requirement.requirements.each do |r|
        if r.first == '~>'
          minversion = r.last.to_s.split('.')
          versions = minversion[0,minversion.length-1]
          # ~> 2 is pretty nonsense, so avoid being tricked
          if versions.length > 0
            if minversion[minversion.length-1] == '0'
              # ~> 1.2.0 is the same as >= 1.2 for rpm and it avoids problems 
when 1.2 is followed by 1.2.1
              minversion = versions
            end
            puts "rubygem(#{rubyabi}:#{dep.name}:#{versions.join('.')}) >= 
#{minversion.join('.')}"
          else
            puts "rubygem(#{rubyabi}:#{dep.name}) >= #{minversion.join('.')}"
          end
        elsif r.first == '!='
          # this is purely guessing, but we can't generate conflicts here ;(
          puts "rubygem(#{rubyabi}:#{dep.name}) > #{r.last}"
          #puts "rubygem(#{rubyabi}:#{dep.name}) < #{r.last}"
        else
          puts "rubygem(#{rubyabi}:#{dep.name}) #{r.first} #{r.last}"
        end
      end
    end
  end
end
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to