%global gem_name stickshift-node # 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)} %{!?gem_instdir: %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}} # Used for openshift.com only default to False %global hosted 0 %define appdir %{_localstatedir}/lib/stickshift Summary: Application container runtime for OpenShift Name: rubygem-%{gem_name} Version: 0.14.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(json) Requires: rubygem(parseconfig) Requires: rubygem(stickshift-common) Requires: rubygem(rspec) Requires: python %if %{hosted} Requires: mercurial %endif BuildRequires: ruby-devel %if 0%{?rhel} == 6 BuildRequires: rubygems %else BuildRequires: rubygems-devel %endif BuildArch: noarch Provides: rubygem(%{gem_name}) = %version %description The Node subsystem is a environment for running OpenShift Cartridges (application containers). User applications are securely sandboxed through SELinux and cgroups. %prep %setup -q %build %install rm -rf %{buildroot} mkdir -p %{buildroot}%{_sysconfdir}/stickshift mkdir -p %{buildroot}%{gem_dir} mkdir -p %{buildroot}%{ruby_sitelibdir} mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{appdir} mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d mkdir -p %{buildroot}%{appdir}/.httpd.d ln -sf %{appdir}/.httpd.d %{buildroot}%{_sysconfdir}/httpd/conf.d/stickshift # 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 # Move the gem binaries to the standard filesystem location mv %{buildroot}%{gem_dir}/bin/* %{buildroot}%{_bindir} rm -rf %{buildroot}%{gem_dir}/bin # Move the gem configs to the standard filesystem location mv %{buildroot}%{gem_instdir}/conf/* %{buildroot}%{_sysconfdir}/stickshift #move the shell binaries into proper location mv %{buildroot}%{gem_instdir}/misc/bin/* %{buildroot}%{_bindir}/ rm -rf %{buildroot}%{gem_instdir}/misc mv httpd/000001_stickshift_node.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/ %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{_bindir}/* %{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 %config(noreplace) %{_sysconfdir}/stickshift %config(noreplace) %attr(0750,-,-) %{_sysconfdir}/httpd/conf.d/stickshift %config(noreplace) %{_sysconfdir}/httpd/conf.d/000001_stickshift_node.conf %attr(0755,-,-) %{_var}/lib/stickshift # TODO: determine if these restorecon calls are actually needed %post if [ $1 -ge 1 ] ; then # Handle first install and upgrade # No need to add this again if we're upgrading grep ss-trap-user /etc/shells [ $? -ne 0 ] && echo "/usr/bin/ss-trap-user" >> /etc/shells #restorecon -r %{_var}/lib/stickshift fi %preun if [ $1 -eq 0 ] ; then # Final removal sed -i "/ss-trap-user/d" /etc/shells #restorecon -r %{_var}/lib/stickshift fi %changelog * Wed Jul 18 2012 Brenton Leanhardt 0.14.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 12 2012 Brenton Leanhardt 0.14.1-1 - Initial package creation for Fedora