Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RPM build scripts for supervisord 3.0 (CentOS/RHEL)
--- a/supervisor/options.py
+++ b/supervisor/options.py
@@ -539,11 +539,11 @@
base = os.path.dirname(os.path.abspath(fp.name))
else:
base = '.'
for pattern in files:
pattern = os.path.join(base, pattern)
- for filename in glob.glob(pattern):
+ for filename in sorted(glob.glob(pattern)):
self.parse_warnings.append(
'Included extra file "%s" during parsing' % filename)
try:
parser.read(filename)
except ConfigParser.ParsingError, why:
--- a/supervisor/options.py
+++ b/supervisor/options.py
@@ -102,7 +102,7 @@
searchpaths = [os.path.join(here, 'etc', 'supervisord.conf'),
os.path.join(here, 'supervisord.conf'),
'supervisord.conf', 'etc/supervisord.conf',
- '/etc/supervisord.conf']
+ '/etc/supervisord.conf', '/etc/supervisor/supervisord.conf']
self.searchpaths = searchpaths
def default_configfile(self):
# Defaults for supervisor initscript
# sourced by /etc/init.d/supervisor
# installed at /etc/default/supervisor by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c /etc/supervisor/supervisord.conf"
/var/log/supervisor/*.log {
missingok
weekly
notifempty
nocompress
}
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Summary: A System for Allowing the Control of Process State on UNIX
Name: supervisor
Version: 3.0
Release: 1%{?dist}
License: ZPLv2.1 and BSD and MIT
Group: System Environment/Base
URL: http://supervisord.org/
Source0: https://pypi.python.org/packages/source/s/%{name}/%{name}-%{version}.tar.gz
Source1: supervisord.init
Source2: supervisord.conf
Source3: supervisor.logrotate
Source4: supervisor.default
Patch1: supervisor-conf-order.patch
Patch2: supervisor-extra-conf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
Requires: python-meld3
Requires(preun): /sbin/service, /sbin/chkconfig
Requires: python-meld3 >= 0.6.5
Requires: python-setuptools
%description
The supervisor is a client/server system that allows its users to control a
number of processes on UNIX-like operating systems.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
set -x
CFLAGS="%{optflags}" python setup.py build -q
%install
set -x
rm -rf %{buildroot}
python setup.py install -q --skip-build --root %{buildroot}
mkdir -p %{buildroot}/%{_sysconfdir}
mkdir -p %{buildroot}/%{_sysconfdir}/supervisor/conf.d
mkdir -p %{buildroot}/%{_sysconfdir}/logrotate.d/
mkdir -p %{buildroot}/%{_initrddir}
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig
mkdir -p %{buildroot}/%{_localstatedir}/log/%{name}
chmod 770 %{buildroot}/%{_localstatedir}/log/%{name}
install -p -m 755 %{SOURCE1} %{buildroot}/%{_initrddir}/supervisord
install -p -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/supervisor/supervisord.conf
install -p -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/logrotate.d/supervisor
install -p -m 644 %{SOURCE4} %{buildroot}/etc/sysconfig/supervisor
sed -i s'/^#!.*//' $(find %{buildroot}/%{python_sitelib}/supervisor/ -type f)
rm -rf %{buildroot}/%{python_sitelib}/supervisor/meld3/
%clean
set -x
rm -rf %{buildroot}
%post
set -x
/sbin/chkconfig --add %{name}d || :
%preun
set -x
if [ $1 = 0 ]; then
/sbin/service supervisord stop > /dev/null 2>&1 || :
/sbin/chkconfig --del %{name}d || :
fi
%files
%defattr(-,root,root,-)
%doc CHANGES.txt COPYRIGHT.txt README.rst LICENSES.txt PLUGINS.rst TODO.txt
%dir %{_localstatedir}/log/%{name}
%{_initrddir}/supervisord
%{python_sitelib}/*
%{_bindir}/supervisor*
%{_bindir}/echo_supervisord_conf
%{_bindir}/pidproxy
%config(noreplace) %{_sysconfdir}/supervisor/supervisord.conf
%dir %{_sysconfdir}/supervisor/conf.d
%config(noreplace) %{_sysconfdir}/logrotate.d/supervisor
%config(noreplace) %{_sysconfdir}/sysconfig/supervisor
%changelog
* Fri Feb 7 2014 Ionel Cristian Maries <contact@ionelmc.ro> 3.0-1
- Initial packaging
#!/bin/bash -eEx
if ! which rpmbuild > /dev/null; then
sudo yum install -y rpmbuild
fi
getvar() {
grep -m 1 "$1:" supervisor.spec | cut -f2 -d' '
}
build() {
rpmbuild --define "_topdir $target" \
--define "_sourcedir $source" \
$*
}
url="$(getvar Source0 | sed s/%{name}/$(getvar Name)/g | sed s/%{version}/$(getvar Version)/g)"
source="$(pwd)"
target="$(pwd)/TOP"
rm -rf "$target"
mkdir -p "$target"
curl -O "$url"
build -ba supervisor.spec
mv $target/RPMS/noarch/*.rpm .
mv $target/SRPMS/*.rpm .
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
#!/bin/bash
#
# supervisord This scripts turns supervisord on
#
# Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd)
#
# chkconfig: - 95 04
#
# description: supervisor is a process control utility. It has a web based
# xmlrpc interface as well as a few other nifty features.
# processname: supervisord
# config: /etc/supervisord.conf
# pidfile: /var/run/supervisord.pid
#
# source function library
. /etc/rc.d/init.d/functions
# Include supervisor defaults if available
if [ -f /etc/sysconfig/supervisor ] ; then
. /etc/sysconfig/supervisor
fi
RETVAL=0
start() {
echo -n $"Starting supervisord: "
daemon supervisord $DAEMON_OPTS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
}
stop() {
echo -n $"Stopping supervisord: "
killproc supervisord
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/supervisord
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/supervisord ] && restart
;;
status)
status supervisord
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
exit 1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.