Permalink
Browse files

Updating for systemd on Fedora 15+

  • Loading branch information...
1 parent 6a3a21b commit 02c2051493c9fa90234fd09a7f5a71c5906a25a6 @herlo committed Jan 6, 2012
Showing with 62 additions and 14 deletions.
  1. +62 −14 pkg/rpm/salt.spec
View
@@ -1,9 +1,18 @@
+%if ! (0%{?rhel} >= 6 || 0%{?fedora} > 12)
+%global with_python26 1
+%define pybasever 2.6
+%define __python_ver 26
+%define __python %{_bindir}/python%{?pybasever}
+%endif
+
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+%{!?%_unitdir: %global _unitdir /lib/systemd/system}
+
Name: salt
Version: 0.9.4
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: A parallel remote execution system
Group: System/Utilities
@@ -14,22 +23,44 @@ Source0: https://github.com/downloads/saltstack/%{name}/%{name}-%{version}.tar.g
Source1: %{name}-master
Source2: %{name}-syndic
Source3: %{name}-minion
+Source4: %{name}-master.service
+Source5: %{name}-syndic.service
+Source6: %{name}-minion.service
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-Requires: python(abi)
-Requires: PyYAML
-Requires: python-crypto
-Requires: m2crypto
-Requires: python-zmq
-Requires: python-jinja
-
BuildArch: noarch
+Requires: python(abi) >= 2.6
+
+%if 0%{?with_python26}
+BuildRequires: python26-zmq
+BuildRequires: python26-crypto
+BuildRequires: python26-devel
+BuildRequires: python26-PyYAML
+BuildRequires: python26-m2crypto
+
+Requires: python26-crypto
+Requires: python26-zmq
+Requires: python26-jinja2
+Requires: python26-PyYAML
+Requires: python26-m2crypto
+
+%else
+
BuildRequires: python-zmq
BuildRequires: python-crypto
-BuildRequires: m2crypto
-BuildRequires: PyYAML
BuildRequires: python-devel
+BuildRequires: PyYAML
+BuildRequires: m2crypto
+
+Requires: python-crypto
+Requires: python-zmq
+Requires: python-jinja2
+Requires: PyYAML
+Requires: m2crypto
+
+%endif
+
%description
Salt is a distributed remote execution system used to execute commands and
@@ -42,7 +73,7 @@ servers, handle them quickly and through a simple and manageable interface.
%package -n salt-master
Group: System/Utilities
Summary: Management component for salt, a parallel remote execution system
-Requires: salt
+Requires: salt >= 0.9.4-3
%description -n salt-master
Salt is a distributed remote execution system used to execute commands and
@@ -54,11 +85,9 @@ servers, handle them quickly and through a simple and manageable interface.
Summary: A parallel remote execution system
%package -n salt-minion
-Requires: salt
Group: System/Utilities
Summary: Client tools for salt, a parallel remote execution system
-Requires: salt
-#Requires: Cython
+Requires: salt >= 0.9.4-3
%description -n salt-minion
Salt is a distributed remote execution system used to execute commands and
@@ -78,10 +107,18 @@ Summary: Client utilities for Salt, a parallel remote execution system
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT
+
+%if (0%{?rhel} || 0%{?fedora} < 15)
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
install -p -m 0775 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/
install -p -m 0775 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/
install -p -m 0775 %{SOURCE3} $RPM_BUILD_ROOT%{_initrddir}/
+%else
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+install -p -m 0775 %{SOURCE4} $RPM_BUILD_ROOT%{_unitdir}/
+install -p -m 0775 %{SOURCE5} $RPM_BUILD_ROOT%{_unitdir}/
+install -p -m 0775 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
@@ -99,7 +136,11 @@ rm -rf $RPM_BUILD_ROOT
%doc %{_mandir}/man1/salt-minion.1.*
%{_bindir}/salt-minion
%{_bindir}/salt-call
+%if (0%{?rhel} || 0%{?fedora} < 15)
%{_initrddir}/salt-minion
+%else
+%{_unitdir}/salt-minion.service
+%endif
%config(noreplace) /etc/salt/minion
%files -n salt-master
@@ -116,11 +157,18 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/salt-cp
%{_bindir}/salt-key
%{_bindir}/salt-run
+%if (0%{?rhel} || 0%{?fedora} < 15)
%{_initrddir}/salt-master
%{_initrddir}/salt-syndic
+%else
+%{_unitdir}/salt-master.service
+%{_unitdir}/salt-syndic.service
+%endif
%config(noreplace) /etc/salt/master
%changelog
+* Thu Jan 5 2012 Clint Savage <herlo1@gmail.com> - 0.9.4-3
+- Updating for systemd on Fedora 15+
* Thu Dec 1 2011 Clint Savage <herlo1@gmail.com> - 0.9.4-2
- Removing requirement for Cython. Optional only for salt-minion

0 comments on commit 02c2051

Please sign in to comment.