%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: 2%{?dist} Group: Development/Tools License: ASL 2.0 URL: http://openshift.redhat.com Source0: http://mirror.openshift.com/pub/crankcase/source/rubygem-%{gem_name}-%{version}.tar.gz 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 %setup -q mkdir SELinux cp doc/selinux/stickshift.te SELinux cp doc/selinux/stickshift.fc SELinux cp doc/selinux/stickshift.if SELinux %build %install rm -rf %{buildroot} mkdir -p %{buildroot}%{gem_dir} mkdir -p %{buildroot}%{ruby_sitelibdir} mkdir -p %{buildroot}/usr/share/selinux/packages/%{name} # Build and install into the rubygem structure gem build %{gem_name}.gemspec gem install --local --install-dir %{buildroot}%{gem_dir} --force %{gem_name}-%{version}.gem 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 * 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