%global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']") %global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gemname stickshift-node %global geminstdir %{gemdir}/gems/%{gemname}-%{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-%{gemname} Version: 0.14.1 Release: 1%{?dist} Group: Development/Tools License: ASL 2.0 URL: http://openshift.redhat.com Source0: http://mirror.openshift.com/pub/crankcase/source/rubygem-%{gemname}-%{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 BuildRequires: rubygems BuildArch: noarch Provides: rubygem(%{gemname}) = %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}%{gemdir} mkdir -p %{buildroot}%{ruby_sitelib} 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 %{gemname}.gemspec gem install --local --install-dir %{buildroot}%{gemdir} --force %{gemname}-%{version}.gem # Move the gem binaries to the standard filesystem location mv %{buildroot}%{gemdir}/bin/* %{buildroot}%{_bindir} rm -rf %{buildroot}%{gemdir}/bin # Move the gem configs to the standard filesystem location mv %{buildroot}%{geminstdir}/conf/* %{buildroot}%{_sysconfdir}/stickshift #move the shell binaries into proper location mv %{buildroot}%{geminstdir}/misc/bin/* %{buildroot}%{_bindir}/ rm -rf %{buildroot}%{geminstdir}/misc mv httpd/000001_stickshift_node.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/ %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{_bindir}/* %{gemdir}/doc/%{gemname}-%{version} %{gemdir}/gems/%{gemname}-%{version} %{gemdir}/cache/%{gemname}-%{version}.gem %{gemdir}/specifications/%{gemname}-%{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 * Mon Jul 12 2012 Brenton Leanhardt 0.14.1-1 - Initial package creation for Fedora