%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")} %global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gemname linecache %global geminstdir %{gemdir}/gems/%{gemname}-%{version} Summary: Caches (Ruby source) files Name: rubygem-%{gemname} Version: 0.43 Release: 3%{?dist} Group: Development/Languages License: GPLv2 URL: http://rubyforge.org/projects/rocky-hacks/ Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem Patch0: rubygem-linecache-0.43-trace_nums.so.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: ruby(abi) = 1.8 Requires: rubygems BuildRequires: rubygems BuildRequires: rubygem(rake) BuildRequires: ruby-devel Provides: rubygem(%{gemname}) = %{version} %description Caches (Ruby source) files as might be used in a debugger or a tool that works with sets of Ruby source files. %prep %setup -q -T -c mkdir -p ./%{gemdir} %build %install rm -rf %{buildroot} export CONFIGURE_ARGS="--with-cflags='%{optflags}'" gem install \ --local \ --install-dir ./%{gemdir} \ -V --force \ %{SOURCE0} mkdir -p %{buildroot}%{gemdir} cp -a ./%{gemdir}/* %{buildroot}%{gemdir} mkdir -p %{buildroot}/%{ruby_sitearch} mv %{buildroot}/%{geminstdir}/lib/trace_nums.so %{buildroot}/%{ruby_sitearch} pushd %{buildroot}/%{geminstdir} patch -p0 < %{PATCH0} popd # Remove backup files find %{buildroot}/%{geminstdir} -type f -name "*~" -delete # Fix anything executable that does not have a shebang for file in `find %{buildroot}/%{geminstdir} -type f -perm /a+x`; do [ -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 644 $file done # Find files with a shebang that do not have executable permissions for file in `find %{buildroot}/%{geminstdir} -type f ! -perm /a+x -name "*.rb"`; do [ ! -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 755 $file done # Find files that have non-standard-executable-perm find %{buildroot}/%{geminstdir} -type f -perm /g+wx -exec chmod -v g-w {} \; # Find files that are not readable find %{buildroot}/%{geminstdir} -type f ! -perm /go+r -exec chmod -v go+r {} \; # Remove these hidden files rm -rf %{buildroot}/%{geminstdir}/.project rm -rf %{buildroot}/%{geminstdir}/.loadpath rm -rf %{buildroot}/%{geminstdir}/ext #rm -rf %{buildroot}/%{geminstdir}/lib %check pushd %{_builddir}/%{name}-%{version}/%{geminstdir} rake test popd %clean rm -rf %{buildroot} %files %defattr(-, root, root, -) %dir %{geminstdir}/ %doc %{gemdir}/doc/%{gemname}-%{version} %doc %{geminstdir}/AUTHORS %doc %{geminstdir}/COPYING %doc %{geminstdir}/ChangeLog %doc %{geminstdir}/NEWS %doc %{geminstdir}/README %doc %{geminstdir}/Rakefile %doc %{geminstdir}/VERSION %{geminstdir}/lib %{geminstdir}/test %{gemdir}/cache/%{gemname}-%{version}.gem %{ruby_sitearch}/*.so %{gemdir}/specifications/%{gemname}-%{version}.gemspec %changelog * Mon Dec 14 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 0.43-3 - Fix %%define vs. %%global * Sat Nov 14 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 0.43-2 - Review * Wed Oct 14 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 0.43-1 - First package