From 9ab5cd394913bf6bb953ef21c9fb788bce01c7766e2e5762beba8e02a38a2108 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Wed, 1 Aug 2012 18:58:56 +0000 Subject: [PATCH] Accepting request 129585 from openSUSE:Tools:Unstable - add update-alternatives for ruby provided binaries - expand ruby19 gemspecs as provides automatically OBS-URL: https://build.opensuse.org/request/show/129585 OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=47 --- ruby.changes | 10 ++++++++++ ruby.spec | 31 ++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ruby.changes b/ruby.changes index 2c54260..c03d2cf 100644 --- a/ruby.changes +++ b/ruby.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Aug 1 13:29:19 UTC 2012 - coolo@suse.com + +- add update-alternatives for ruby provided binaries + +------------------------------------------------------------------- +Wed Aug 1 12:07:35 UTC 2012 - coolo@suse.com + +- expand ruby19 gemspecs as provides automatically + ------------------------------------------------------------------- Thu Jul 26 09:53:19 UTC 2012 - coolo@suse.com diff --git a/ruby.spec b/ruby.spec index 87372df..31bd7d3 100644 --- a/ruby.spec +++ b/ruby.spec @@ -27,10 +27,16 @@ Url: http://www.ruby-lang.org/ Summary: An Interpreted Object-Oriented Scripting Language License: MIT Group: Development/Languages/Ruby -Requires: ruby19 +BuildRequires: ruby-common +BuildRequires: ruby19-devel +BuildRequires: update-alternatives +%requires_eq ruby19 Provides: rubygems = 1.8.15 Obsoletes: rubygems < 1.8.15 Requires: ruby-common >= 1.0 +Requires: update-alternatives + +%{expand:%(rpm -ql ruby19 | fgrep .gemspec | /usr/bin/ruby1.9 /usr/lib/rpm/rubygemsdeps.rb --provides | sed -e 's,^,Provides:,')} %description Ruby is an interpreted scripting language for quick and easy @@ -84,13 +90,32 @@ mkdir -p $RPM_BUILD_ROOT%_libdir ln -s %_libdir/libruby1.9.so $RPM_BUILD_ROOT%_libdir/libruby.so install -D -m 0644 %{S:0} $RPM_BUILD_ROOT/etc/rpm/macros.ruby install -D -m 0644 %{S:2} $RPM_BUILD_ROOT/etc/gemrc -export NO_BRP_STALE_LINK_ERROR=yes + +%post +for bin in erb gem irb rake rdoc ri ruby testrb; do + /usr/sbin/update-alternatives --install \ + %{_bindir}/$bin $bin %{_bindir}/$bin"1.9" 19 +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"1.9" + done +fi %files %defattr(-,root,root) %config /etc/gemrc %config /etc/rpm/macros.ruby -%{_bindir}/* +%ghost %{_bindir}/erb +%ghost %{_bindir}/gem +%ghost %{_bindir}/irb +%ghost %{_bindir}/rake +%ghost %{_bindir}/rdoc +%ghost %{_bindir}/ri +%ghost %{_bindir}/ruby +%ghost %{_bindir}/testrb %files devel %defattr(-,root,root)