Accepting request 181067 from OBS:Server:Unstable

- use update-alternatives the right way - which is portable too

OBS-URL: https://build.opensuse.org/request/show/181067
OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=62
This commit is contained in:
Stephan Kulow 2013-06-26 16:57:11 +00:00 committed by Git OBS Bridge
parent c8edd27a07
commit 9cb1d18f90
2 changed files with 29 additions and 16 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jun 26 15:01:32 UTC 2013 - coolo@suse.com
- use update-alternatives the right way - which is portable too
-------------------------------------------------------------------
Tue Jun 25 09:02:48 UTC 2013 - coolo@suse.com

View File

@ -83,19 +83,19 @@ Development files to link against Ruby.
%build
%install
mkdir -p $RPM_BUILD_ROOT%_bindir
mkdir -p %{buildroot}%_bindir %{buildroot}%{_sysconfdir}/alternatives
for bin in erb gem irb rake rdoc ri ruby testrb; do
ln -s %_bindir/"$bin"2.0 $RPM_BUILD_ROOT%_bindir/$bin
# dummy
touch %{buildroot}%{_sysconfdir}/alternatives/$bin
ln -s %{_sysconfdir}/alternatives/$bin %{buildroot}%_bindir/$bin
done
mkdir -p $RPM_BUILD_ROOT%_libdir
ln -s %_libdir/libruby2.0.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
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
# remove non-links or old binaries will stay around forever
test -L %{_bindir}/$bin || rm -v %{_bindir}/$bin
/usr/sbin/update-alternatives --install \
%{_bindir}/$bin $bin %{_bindir}/$bin"2.0" 20
done
@ -111,14 +111,22 @@ fi
%defattr(-,root,root)
%config /etc/gemrc
%config /etc/rpm/macros.ruby
%ghost %{_bindir}/erb
%ghost %{_bindir}/gem
%ghost %{_bindir}/irb
%ghost %{_bindir}/rake
%ghost %{_bindir}/rdoc
%ghost %{_bindir}/ri
%ghost %{_bindir}/ruby
%ghost %{_bindir}/testrb
%ghost %_sysconfdir/alternatives/erb
%{_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)