%global gem_name stickshift-common # Conditionally set required macros for distros without rubygems-devel This can # be removed once https://bugzilla.redhat.com/show_bug.cgi?id=788001 is # resolved. %{!?gem_dir: %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)} %global selinux_variants mls strict targeted Summary: Common library code for stickshift OpenShift subsystem Name: rubygem-%{gem_name} Version: 0.13.1 Release: 3%{?dist} Group: Development/Tools License: ASL 2.0 URL: http://openshift.redhat.com Source0: http://mirror.openshift.com/pub/crankcase/source/%{gem_name}-%{version}.gem Source1: stickshift.fc Source2: stickshift.if Source3: stickshift.te BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: ruby(abi) >= 1.8 Requires: rubygems Requires: rubygem(activemodel) Requires: rubygem(json) Requires: rubygem(mongo) Requires: selinux-policy Requires: policycoreutils-python BuildRequires: ruby-devel %if 0%{?rhel} == 6 BuildRequires: rubygems %else BuildRequires: rubygems-devel %endif BuildRequires: make BuildRequires: selinux-policy BuildRequires: selinux-policy-devel BuildRequires: hardlink BuildArch: noarch Provides: rubygem(%{gem_name}) = %version %description This packages contains common library code for the stickshift OpenShift subsystem. %prep gem unpack %{SOURCE0} %setup -q -D -T -n %{gem_name}-%{version} mkdir SELinux cp %{SOURCE1} %{SOURCE2} %{SOURCE3} SELinux %build mkdir -p .%{gem_dir} # Create the gem as gem install only works on a gem file gem build %{gem_name}.gemspec export CONFIGURE_ARGS="--with-cflags='%{optflags}'" # gem install compiles any C extensions and installs into a directory # We set that to be a local directory so that we can move it into the # buildroot in %%install gem install -V \ --local \ --install-dir ./%{gem_dir} \ --bindir ./%{_bindir} \ --force \ --rdoc \ %{gem_name}-%{version}.gem %install mkdir -p %{buildroot}%{gem_dir} cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/ mkdir -p %{buildroot}/usr/share/selinux/packages/%{name} cd SELinux make -f %{_datadir}/selinux/devel/Makefile install -p -m 644 -D stickshift.pp $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/stickshift.pp make -f %{_datadir}/selinux/devel/Makefile clean cd - /usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{gem_dir}/doc/%{gem_name}-%{version} %{gem_dir}/gems/%{gem_name}-%{version} %{gem_dir}/cache/%{gem_name}-%{version}.gem %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec %doc SELinux/* %{_datadir}/selinux/packages/%{name}/ %post if [ "$1" -le "1" ] ; then # First install semodule -i %{_datadir}/selinux/packages/%{name}/stickshift.pp 2>/dev/null || : fixfiles -R rubygem-stickshift-common restore fi %preun if [ "$1" -lt "1" ] ; then # Final removal semodule -r stickshift 2>/dev/null || : fi %postun if [ "$1" -ge "1" ] ; then # Upgrade semodule -i %{_datadir}/selinux/packages/%{name}/stickshift.pp 2>/dev/null || : # TODO # What other packages should be added here? Probably anything that could be # affected by stickshift.fc, right? fixfiles -R rubygem-stickshift-common restore fi %changelog * Fri Jul 20 2012 Brenton Leanhardt 0.13.1-3 - Switched Source0 to gem * Wed Jul 18 2012 Brenton Leanhardt 0.13.1-2 - Added ruby-devel and rubygem-devel build requires and replaced the ruby_sitelib and geminstdir macros with the standard macros. - Renamed %%gemname to %%gem_name so %%geminstdir will work correctly. - Fixed several file mode problems with libraries * Mon Jul 09 2012 Brenton Leanhardt 0.13.1-1 - Initial package creation for Fedora - Removed rcov