[rubygem-narray/el5] several improvements for RHEL <= 6 and added needed bits for RHEL <= 5 added needed Provides

Björn Esser besser82 at fedoraproject.org
Tue Dec 10 14:58:26 UTC 2013


commit b799129f221d0f3ce13842b65edae103fd9771af
Author: Björn Esser <bjoern.esser at gmail.com>
Date:   Tue Dec 10 13:38:16 2013 +0100

    several improvements for RHEL <= 6 and added needed bits for RHEL <= 5
    added needed Provides

 rubygem-narray.spec |  141 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 91 insertions(+), 50 deletions(-)
---
diff --git a/rubygem-narray.spec b/rubygem-narray.spec
index 13f9c28..650594b 100644
--- a/rubygem-narray.spec
+++ b/rubygem-narray.spec
@@ -1,57 +1,84 @@
-%{?!ruby_ver:		%global ruby_ver %(ruby -rrbconfig -W0 -e 'puts Config::CONFIG["RUBY_PROGRAM_VERSION"]' || echo 0)}
 %global gem_name narray
 
+# For compatibility with RHEL <= 6
+%{!?ruby_vendorlibdir:	%global ruby_vendorlibdir	%(ruby -rrbconfig -W0 -e "puts Config::CONFIG['sitelibdir']")}
+%{!?ruby_vendorarchdir:	%global ruby_vendorarchdir	%(ruby -rrbconfig -W0 -e "puts Config::CONFIG['sitearchdir']")}
+%{!?gem_dir:		%global gem_dir			%(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)}
+%{!?gem_instdir:	%global gem_instdir		%{gem_dir}/gems/%{gem_name}-%{version}}
+%{!?gem_libdir:		%global gem_libdir		%{gem_instdir}/lib}
+%{!?gem_cache:		%global gem_cache		%{gem_dir}/cache/%{gem_name}-%{version}.gem}
+%{!?gem_spec:		%global gem_spec		%{gem_dir}/specifications/%{gem_name}-%{version}.gemspec}
+%{!?gem_docdir:		%global gem_docdir		%{gem_dir}/doc/%{gem_name}-%{version}}
+%{!?gem_extdir_mri:	%global gem_extdir_mri		%{ruby_vendorarchdir}}
+
+# Get the Ruby-version for dependencies
+%{!?ruby_ver:		%global ruby_ver	%(ruby -rrbconfig -W0 -e 'puts Config::CONFIG["RUBY_PROGRAM_VERSION"]' 2>/dev/null || echo 0)}
+
 Name:		rubygem-%{gem_name}
 Version:	0.6.0.8
-Release:	5%{?dist}
+Release:	6%{?dist}
 Summary:	N-dimensional Numerical Array class for Ruby
+%{?el5:Group:	System Environment/Libraries}
 
 License:	BSD and Ruby
 URL:		http://narray.rubyforge.org
 Source0:	http://rubygems.org/downloads/%{gem_name}-%{version}.gem
 
+%{?el5:BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)}
 BuildRequires:	ruby-devel
-BuildRequires:	rubygems-devel
 
 %if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
-Requires:	ruby(release)	= %{?ruby_ver}
+BuildRequires:	rubygems-devel
+
+Requires:	ruby(release)			=  %{?ruby_ver}
 %else
-Requires:	ruby(abi)	= %{?ruby_ver}
+BuildRequires:	rubygems%{!?rhel:-devel}
+
+Requires:	ruby(abi)			=  %{?ruby_ver}
 %endif
 Requires:	rubygems
 
-Obsoletes:	%{name}-common <= %{version}-%{release}
+%if 0%{?fedora} && 0%{?fedora} <= 22
+Obsoletes:	%{name}-common			<= %{version}-%{release}
+%endif
+
+Provides:	rubygem(%{gem_name})		=  %{version}
+Provides:	rubygem(%{gem_name})%{?_isa}	=  %{version}
 
 %description
-NArray is a Numerical N-dimensional Array class.  Supported element
-types are 1/2/4-byte Integer, single/double-precision, Real/Complex and
-Ruby Object.  This extension library incorporates fast calculation and
-easy manipulation of large numerical arrays into the Ruby language.
-NArray has features similar to NumPy, but NArray has vector and matrix
-sub-classes.
+NArray is a Numerical N-dimensional Array class.  Supported element types are
+1/2/4-byte Integer, single/double-precision, Real/Complex and Ruby Object.
+This extension library incorporates fast calculation and easy manipulation of
+large numerical arrays into the Ruby language.  NArray has features similar to
+NumPy, but NArray has vector and matrix sub-classes.
 
 
 %package devel
 Summary:	Development files and developer's docs for %{name}
+%{?el5:Group:	Development/Libraries}
 
-Requires:	%{name}%{?_isa} = %{version}-%{release}
+%{!?el5:BuildArch:	noarch}
+Requires:	%{name}%{?el5:%{?_isa}}		=  %{version}-%{release}
 
-Obsoletes:	%{name}-common-devel <= %{version}-%{release}
-Obsoletes:	%{name}-doc <= %{version}-%{release}
+%if 0%{?fedora} && 0%{?fedora} <= 22
+Obsoletes:	%{name}-devel			<= %{version}-%{release}
+Obsoletes:	%{name}-common-devel		<= %{version}-%{release}
+Obsoletes:	%{name}-doc			<= %{version}-%{release}
+%endif
 
 %description devel
-This package contains the development files and the developer's
-documentation for %{name}.
+This package contains the development files and the developer's documentation
+for %{name}.
 
 
 %prep
+rm -rf %{gem_name}-%{version}
 gem unpack %{SOURCE0}
 %setup -qDTn  %{gem_name}-%{version}
-gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
+gem spec %{SOURCE0} -l %{!?el5:--ruby} > %{gem_name}.gemspec
 
 
 %build
-%configure ||:
 gem build %{gem_name}.gemspec
 
 %if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
@@ -59,61 +86,75 @@ gem build %{gem_name}.gemspec
 %else
 export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
 mkdir -p ./%{gem_dir}
-gem install -V --local --force --rdoc				\
-	--install-dir ./%{gem_dir}				\
-	--bindir ./%{_bindir}					\
-	%{gem_name}-%{version}.gem
+gem install								\
+	-V --local --install-dir ./%{gem_dir} --bindir ./%{_bindir}	\
+	--force --backtrace %{gem_name}-%{version}.gem
 %endif
 
 
 %install
-mkdir -p %{buildroot}%{gem_dir}					\
-	%{buildroot}%{gem_extdir_mri}				\
+%{?el5:rm -rf %{buildroot}}
+mkdir -p %{buildroot}%{gem_dir}						\
+	%{buildroot}%{gem_extdir_mri}					\
 	%{buildroot}%{ruby_vendorarchdir}
 cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}
-mv -f %{buildroot}%{gem_instdir}/%{gem_name}.so			\
+mv -f %{buildroot}%{gem_instdir}/%{gem_name}.so				\
 	%{buildroot}%{gem_extdir_mri}
 
-# Some applications expect the so-plugin, %%{gem_name}_ext.rb and
-# the headers to be placed inside %%{ruby_vendorarchdir}.
-ln -fs %{gem_extdir_mri}/%{gem_name}.so				\
-	%{buildroot}%{ruby_vendorarchdir}
-ln -fs %{gem_instdir}/%{gem_name}_ext.rb			\
-	%{buildroot}%{ruby_vendorarchdir}
-for _header in %{buildroot}%{gem_instdir}/*.h
-do
-  ln -fs `echo ${_header} | sed -e 's!^%{buildroot}!!g'`	\
-	%{buildroot}%{ruby_vendorarchdir}
-done
+# This gem needs to live in %%{ruby_sitearch} to work properly
+[[ ! -f %{buildroot}%{ruby_vendorarchdir}/%{gem_name}.so ]] &&		\
+	ln -fs %{gem_extdir_mri}/%{gem_name}.so				\
+		%{buildroot}%{ruby_vendorarchdir}
+ln -fs %{gem_dir}/%{gem_name}_ext.rb %{buildroot}%{ruby_vendorarchdir}
+
+# Clean-up
+find %{buildroot}%{gem_instdir} -depth -type f -name '*.so' -print0 |	\
+	xargs -0 rm -rf
+find %{buildroot} -depth -type f -name '.*' -print0 |			\
+	xargs -0 rm -rf
+find %{buildroot} -depth -type f -name '*.o' -print0 |			\
+	xargs -0 rm -rf
+find %{buildroot} -depth -size 0 -type f -print0 |			\
+	xargs -0 rm -rf
+rm -rf									\
+%if 0%{?fedora} || 0%{?rhel} >= 7
+	%{buildroot}%{gem_cache}					\
+%endif
+	%{buildroot}%{gem_instdir}/src					\
+	%{buildroot}%{gem_instdir}/%{gem_name}.gemspec
+
 
-# Some clean-up of 0-size files, unneded stuff and files, which get
-# picked-up by %doc later.
-find %{buildroot} -depth -size 0 -type f -print0 | xargs -0 rm -rf
-rm -rf %{buildroot}%{gem_cache}					\
-	%{buildroot}%{gem_instdir}/{ChangeLog,README.*,src}
+%{?el5:%clean}
+%{?el5:rm -rf %{buildroot}}
 
 
 %files
-%doc ChangeLog README.*
+%doc %{gem_instdir}/ChangeLog
+%doc %{gem_instdir}/README.*
 %dir %{gem_instdir}
 %exclude %{gem_instdir}/MANIFEST
 %exclude %{gem_instdir}/SPEC.*
 %exclude %{gem_instdir}/*.h
-%{gem_extdir_mri}/%{gem_name}.so
-%{gem_instdir}/*
+%if 0%{?rhel} && 0%{?rhel} <= 6
+%{gem_cache}
+%endif
+%{gem_extdir_mri}
+%{gem_instdir}/*.rb
 %{gem_spec}
-%{ruby_vendorarchdir}/%{gem_name}.so
-%{ruby_vendorarchdir}/%{gem_name}_ext.rb
+%{ruby_vendorarchdir}/%{gem_name}*
 
 %files devel
 %doc %{gem_docdir}
-%{gem_instdir}/MANIFEST
-%{gem_instdir}/SPEC.*
+%doc %{gem_instdir}/MANIFEST
+%doc %{gem_instdir}/SPEC.*
 %{gem_instdir}/*.h
-%{ruby_vendorarchdir}/*.h
 
 
 %changelog
+* Tue Dec 10 2013 Björn Esser <bjoern.esser at gmail.com> - 0.6.0.8-6
+- several improvements for RHEL <= 6 and added needed bits for RHEL <= 5
+- added needed Provides
+
 * Mon Nov 25 2013 Björn Esser <bjoern.esser at gmail.com> - 0.6.0.8-5
 - Fedora <= 18 && RHEL <= 6 need Requires: ruby(abi)
 


More information about the scm-commits mailing list