changeset 0:9668c317e887

Initial revision
author Guido Berhoerster <guido+packaging@berhoerster.name>
date Wed, 10 Jul 2013 19:23:16 +0200
parents
children 1697a2bdcf59
files sources uwsgi-do-not-install-plugins-into-plugin_dir.patch uwsgi-link-against-boost-mt.patch uwsgi-no-rpath.patch uwsgi.conf uwsgi.ini uwsgi.init uwsgi.logrotate uwsgi.spec
diffstat 9 files changed, 953 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,2 @@
+9a83f2dca648ce491f043abd81e02db4 fe9425920713f11d3636ae3924867147fabcc02c.zip
+e331f96469166520a0e3d02296199cbd uwsgi-1.9.13.tar.gz
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi-do-not-install-plugins-into-plugin_dir.patch	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,16 @@
+Index: uwsgi-1.9.13/uwsgiconfig.py
+===================================================================
+--- uwsgi-1.9.13.orig/uwsgiconfig.py
++++ uwsgi-1.9.13/uwsgiconfig.py
+@@ -1170,10 +1170,7 @@ def build_plugin(path, uc, cflags, ldfla
+     except:
+         pass
+ 
+-    if uc:
+-        plugin_dest = uc.get('plugin_dir') + '/' + name + '_plugin'
+-    else:
+-        plugin_dest = name + '_plugin'
++    plugin_dest = name + '_plugin'
+ 
+     shared_flag = '-shared'
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi-link-against-boost-mt.patch	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,52 @@
+Index: uwsgi-1.9.13/plugins/emperor_mongodb/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/emperor_mongodb/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/emperor_mongodb/uwsgiplugin.py
+@@ -8,7 +8,7 @@ LDFLAGS = []
+ LIBS = []
+ if not 'UWSGI_MONGODB_NOLIB' in os.environ:
+     LIBS.append('-lmongoclient')
+-    LIBS.append('-lboost_thread')
++    LIBS.append('-lboost_thread-mt')
+     LIBS.append('-lboost_filesystem')
+ 
+ GCC_LIST = ['plugin', 'emperor_mongodb.cc']
+Index: uwsgi-1.9.13/plugins/stats_pusher_mongodb/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/stats_pusher_mongodb/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/stats_pusher_mongodb/uwsgiplugin.py
+@@ -8,7 +8,7 @@ LDFLAGS = []
+ LIBS = []
+ if not 'UWSGI_MONGODB_NOLIB' in os.environ:
+     LIBS.append('-lmongoclient')
+-    LIBS.append('-lboost_thread')
++    LIBS.append('-lboost_thread-mt')
+     LIBS.append('-lboost_filesystem')
+ 
+ GCC_LIST = ['plugin', 'stats_pusher_mongodb.cc']
+Index: uwsgi-1.9.13/plugins/mongodb/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/mongodb/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/mongodb/uwsgiplugin.py
+@@ -2,7 +2,7 @@ NAME='mongodb'
+ 
+ CFLAGS = []
+ LDFLAGS = []
+-LIBS = ['-Wl,-whole-archive', '-lmongoclient', '-Wl,-no-whole-archive', '-lboost_thread', '-lboost_system', '-lboost_filesystem']
++LIBS = ['-Wl,-whole-archive', '-lmongoclient', '-Wl,-no-whole-archive', '-lboost_thread-mt', '-lboost_system', '-lboost_filesystem']
+ 
+ GCC_LIST = ['plugin']
+ 
+Index: uwsgi-1.9.13/plugins/gridfs/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/gridfs/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/gridfs/uwsgiplugin.py
+@@ -9,7 +9,7 @@ LIBS = []
+ if not 'UWSGI_MONGODB_NOLIB' in os.environ:
+     LIBS.append('-lmongoclient')
+     LIBS.append('-lstdc++')
+-    LIBS.append('-lboost_thread')
++    LIBS.append('-lboost_thread-mt')
+     LIBS.append('-lboost_system')
+     LIBS.append('-lboost_filesystem')
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi-no-rpath.patch	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,66 @@
+Index: uwsgi-1.9.13/plugins/php/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/php/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/php/uwsgiplugin.py
+@@ -22,7 +22,6 @@ CFLAGS = [os.popen(PHPPATH + ' --include
+ LDFLAGS = os.popen(PHPPATH + ' --ldflags').read().rstrip().split()
+ if ld_run_path:
+     LDFLAGS.append('-L%s' % ld_run_path)
+-    os.environ['LD_RUN_PATH'] = ld_run_path
+ 
+ LIBS = [os.popen(PHPPATH + ' --libs').read().rstrip(), '-lphp5']
+ 
+Index: uwsgi-1.9.13/plugins/python/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/python/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/python/uwsgiplugin.py
+@@ -44,10 +44,8 @@ if not 'UWSGI_PYTHON_NOLIB' in os.enviro
+     else:
+         try:
+             LDFLAGS.append("-L%s" % sysconfig.get_config_var('LIBDIR'))
+-            os.environ['LD_RUN_PATH'] = "%s" % (sysconfig.get_config_var('LIBDIR'))
+         except:
+             LDFLAGS.append("-L%s/lib" % sysconfig.PREFIX)
+-            os.environ['LD_RUN_PATH'] = "%s/lib" % sysconfig.PREFIX
+ 
+         LIBS.append('-lpython%s' % get_python_version())
+ else:
+Index: uwsgi-1.9.13/plugins/rack/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/rack/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/rack/uwsgiplugin.py
+@@ -44,7 +44,6 @@ LIBS = os.popen(RUBYPATH + " -e \"requir
+ 
+ if has_shared == 'yes':
+     LDFLAGS.append('-L' + libpath )
+-    os.environ['LD_RUN_PATH'] = libpath
+     LIBS.append(os.popen(RUBYPATH + " -e \"require 'rbconfig';print '-l' + %s::CONFIG['RUBY_SO_NAME']\"" % rbconfig).read().rstrip())
+ else:
+     GCC_LIST.append("%s/%s" % (libpath, os.popen(RUBYPATH + " -e \"require 'rbconfig';print %s::CONFIG['LIBRUBY_A']\"" % rbconfig).read().rstrip()))
+Index: uwsgi-1.9.13/plugins/ruby19/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/ruby19/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/ruby19/uwsgiplugin.py
+@@ -40,6 +40,5 @@ LDFLAGS = os.popen(RUBYPATH + " -e \"req
+ 
+ libpath = os.popen(RUBYPATH + " -e \"require 'rbconfig';print %s::CONFIG['libdir']\"" % rbconfig).read().rstrip()
+ LDFLAGS.append('-L' + libpath )
+-os.environ['LD_RUN_PATH'] = libpath
+ LIBS = os.popen(RUBYPATH + " -e \"require 'rbconfig';print '-l' + %s::CONFIG['RUBY_SO_NAME']\"" % rbconfig).read().rstrip().split()
+ 
+Index: uwsgi-1.9.13/plugins/jvm/uwsgiplugin.py
+===================================================================
+--- uwsgi-1.9.13.orig/plugins/jvm/uwsgiplugin.py
++++ uwsgi-1.9.13/plugins/jvm/uwsgiplugin.py
+@@ -59,11 +59,6 @@ if "-framework JavaVM" in JVM_LIBPATH:
+ 
+ GCC_LIST = ['jvm_plugin']
+ 
+-if 'LD_RUN_PATH' in os.environ:
+-    os.environ['LD_RUN_PATH'] += ':' + JVM_LIBPATH[0][2:]
+-else:
+-    os.environ['LD_RUN_PATH'] = JVM_LIBPATH[0][2:]
+-
+ def post_build(config):
+     if os.system("javac %s/plugins/jvm/uwsgi.java" % os.getcwd()) != 0:
+         os._exit(1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi.conf	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,1 @@
+LoadModule uwsgi_module modules/mod_uwsgi.so
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi.ini	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,10 @@
+[uwsgi]
+uid = uwsgi
+gid = uwsgi
+umask = 022
+pidfile = /var/run/uwsgi/uwsgi.pid
+daemonize = /var/log/uwsgi.log
+log-date = true
+emperor = /etc/uwsgi.d
+emperor-tyrant = true
+cap = setgid,setuid
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi.init	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,118 @@
+#!/bin/sh
+#
+# uwsgi - Manages uWSGI application container server instances
+#
+# chkconfig:   - 20 80
+# description: uWSGI Emperor for managing uWSGI application container server \
+#              instances
+
+### BEGIN INIT INFO
+# Provides: uwsgi
+# Required-Start: $local_fs $network $remote_fs
+# Required-Stop: $local_fs $network $remote_fs
+# Should-Start:
+# Should-Stop:
+# Default-Start:
+# Default-Stop: 0 1 2 3 4 5 6
+# Short-Description: uWSGI emperor
+# Description: uWSGI Emperor for managing uWSGI application container server
+#              instances
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/sbin/uwsgi"
+prog="$(basename "$exec")"
+config="/etc/uwsgi.ini"
+
+lockfile=/var/lock/subsys/$prog
+rundir=/var/run/$prog
+pidfile=$rundir/$prog.pid
+
+start() {
+    mkdir -p $rundir
+    chown uwsgi:uwsgi $rundir
+    [ -x $exec ] || exit 5
+    [ -f $config ] || exit 6
+    echo -n $"Starting $prog: "
+    daemon --pidfile=$pidfile $exec --ini /etc/uwsgi.ini 2>/dev/null
+    retval=$?
+    if [ $retval -eq 0 ]; then
+        touch $lockfile
+        success
+    else
+        retval=1
+        failure
+    fi
+    echo
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    killproc -p $pidfile $prog -QUIT
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    echo -n $"Reloading $prog: "
+    killproc -p $pidfile $prog -HUP
+    retval=$?
+    echo
+    return $retval
+}
+
+force_reload() {
+    restart
+}
+
+rh_status() {
+    # run checks to determine if the service is running or use generic status
+    status $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
+esac
+exit $?
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi.logrotate	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,5 @@
+/var/log/uwsgi.log {
+    copytruncate
+    missingok
+    notifempty
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uwsgi.spec	Wed Jul 10 19:23:16 2013 +0200
@@ -0,0 +1,683 @@
+# revision of the uwsgi documentation corresponding to the packaged release
+%global uwsgi_docs_rev  fe9425920713f11d3636ae3924867147fabcc02c
+
+Name:           uwsgi
+Version:        1.9.13
+Release:        1%{?dist}
+Summary:        Complete Stack for Building Clustered/Distributed Network Applications
+
+Group:          System Environment/Daemons
+License:        GPLv2+
+URL:            http://projects.unbit.it/uwsgi
+Source0:        http://projects.unbit.it/downloads/%{name}-%{version}.tar.gz
+Source1:        https://github.com/unbit/uwsgi-docs/archive/%{uwsgi_docs_rev}.zip
+Source2:        %{name}.ini
+Source3:        %{name}.conf
+Source4:        %{name}.init
+Source5:        %{name}.logrotate
+# prevent attempts to install plugins into plugin_dir at build time
+Patch0:         uwsgi-do-not-install-plugins-into-plugin_dir.patch
+# do not set rpath for plugins
+Patch1:         uwsgi-no-rpath.patch
+# link against libboost*-mt provided by RHEL/Fedora
+Patch2:         uwsgi-link-against-boost-mt.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires:  boost-devel
+BuildRequires:  bzip2-devel
+BuildRequires:  dos2unix
+BuildRequires:  erlang
+BuildRequires:  gcc-objc
+BuildRequires:  GeoIP-devel
+BuildRequires:  gloox-devel
+BuildRequires:  gmp-devel
+BuildRequires:  httpd-devel
+BuildRequires:  java-devel
+BuildRequires:  krb5-devel
+BuildRequires:  libattr-devel
+BuildRequires:  libcap-devel
+BuildRequires:  libcurl-devel
+BuildRequires:  libcurl-devel
+BuildRequires:  libedit-devel
+BuildRequires:  libuuid-devel
+BuildRequires:  libxml2-devel
+BuildRequires:  libxslt-devel
+BuildRequires:  libyaml-devel
+BuildRequires:  lua-devel
+BuildRequires:  mongodb-devel
+BuildRequires:  mono-devel
+BuildRequires:  openldap-devel
+BuildRequires:  openssl-devel
+BuildRequires:  pam-devel
+BuildRequires:  pcre-devel
+BuildRequires:  perl-Coro
+BuildRequires:  perl-devel
+BuildRequires:  perl-ExtUtils-Embed
+BuildRequires:  php-devel
+BuildRequires:  php-embedded
+BuildRequires:  postgresql-devel
+BuildRequires:  python2-devel
+BuildRequires:  python-greenlet-devel
+BuildRequires:  python-sphinx
+BuildRequires:  ruby
+BuildRequires:  ruby-devel
+BuildRequires:  sqlite-devel
+BuildRequires:  tcp_wrappers-devel
+BuildRequires:  v8-devel
+BuildRequires:  zeromq-devel
+Requires(pre):  shadow-utils
+Requires(post): chkconfig
+Requires(postun): initscripts
+Requires(preun): chkconfig
+Requires(preun): initscripts
+
+%description
+The uWSGI project aims at developing a full stack for building (and hosting)
+clustered/distributed network applications.
+
+Mainly targeted at the web and its standards, it has been successfully used in
+a lot of different contexts.
+
+Thanks to its pluggable architecture it can be extended without limits to
+support more platforms and languages. Currently, you can write plugins in C,
+C++ and Objective-C.
+
+The "WSGI" part in the name is a tribute to the namesake Python standard, as it
+has been the first developed plugin for the project.
+
+Versatility, performance, low-resource usage and reliability are the strengths
+of the project (and the only rules followed).
+
+%package devel
+Summary:        Development Files for uWSGI
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description devel
+This package contains the development headers needed for developing uWSGI
+plugins.
+
+%package -n python-uwsgidecorators
+Summary:        Python decorators providing access to the uwsgi API
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+Requires:       %{name}-plugin-python = %{version}-%{release}
+
+%description -n python-uwsgidecorators
+The uwsgidecorators Python module provides higher-level access to the uWSGI API.
+
+%package doc
+Summary:        uWSGI Documentation
+Group:          Documentation
+Requires:       %{name} = %{version}-%{release}
+BuildArch:      noarch
+
+%description doc
+This package contains the documentation for uWSGI.
+
+%package plugin-airbrake
+Summary:        uWSGI Plugin for Sending Backtraces to Airbrake-compatible Servers
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-airbrake
+The airbrake uWSGI plugin allows to send backtraces to Airbrake-compatible
+servers.
+
+%package plugin-alarm_curl
+Summary:        uWSGI Plugin for Sending Alarms via curl
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-alarm_curl
+The alarm_curl uWSGI plugin allows to send alarms via curl.
+
+%package plugin-alarm_xmpp
+Summary:        uWSGI Plugin for Sending Alarms via XMPP
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-alarm_xmpp
+The alarm_xmpp uWSGI plugin allows to send alarms via XMPP.
+
+%package plugin-coroae
+Summary:        uWSGI Plugin Perl Coro::AnyEvent Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-coroae
+The coroae uWSGI plugin enables support for the Perl Coro::AnyEvent loop engine.
+
+%package plugin-curl_cron
+Summary:        uWSGI Plugin for Invoking URLs as Cron Tasks via curl
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-curl_cron
+The curl_cron uWSGI plugin enables cron tasks to to invoke an URL via curl
+
+%package plugin-emperor_mongodb
+Summary:        uWSGI Plugin for Monitoring an Emperor through a MongoDB Database
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-emperor_mongodb
+The emperor_mongodb uWSGI plugin allows to monitor an emperor through a MongoDB
+database.
+
+%package plugin-emperor_pg
+Summary:        uWSGI Plugin for Monitoring an Emperor through a PostgresSQL Database
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-emperor_pg
+The emperor_pg uWSGI Plugin allows to monitor an emperor through a PostgresSQL
+database.
+
+%package plugin-geoip
+Summary:        uWSGI Plugin for GeoIP-based Routing
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-geoip
+The geoip uWSGI Plugin allows GeoIP-based routing.
+
+%package plugin-gridfs
+Summary:        uWSGI Plugin for Serving GridFS Database Contents
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-gridfs
+The gridfs uWSGI Plugin allows serving GridFS database contents.
+
+%package plugin-jvm
+Summary:        uWSGI Plugin Embedding a JVM
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-jvm
+The jvm uWSGI plugin allows to embed a JVM into uWSGI.
+
+%package plugin-ldap
+Summary:        uWSGI Plugin Providing LDAP Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-ldap
+The ldap uWSGI plugin provides LDAP support including authentication and reading
+uWSGI configuration from LDAP.
+
+%package plugin-lua
+Summary:        uWSGI Plugin Embedding Lua and Providing WSAPI Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-lua
+The lua uWSGI plugin embeds Lua into uWSGI and adds support for running WSAPI
+applications.
+
+%package plugin-pam
+Summary:        uWSGI Plugin Providing PAM Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-pam
+The pam uWSGI plugin provides support from PAM.
+
+%package plugin-php
+Summary:        uWSGI Plugin Embedding PHP
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-php
+The php uWSGI plugin embeds PHP into uWSGI.
+
+%package plugin-psgi
+Summary:        uWSGI Plugin Embedding Perl and Providing PSGI Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-psgi
+The psgi uWSGI plugin embeds Perl and adds support for running PSGI
+applications.
+
+%package plugin-python
+Summary:        uWSGI Plugin Embedding Python and Providing WSGI Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-python
+The python uWSGI plugin embeds Python and allows to run WSGI applications and
+provides access to the uWSGI API from Python.
+
+%package plugin-rack
+Summary:        uWSGI Plugin Providing Ruby Rack Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-rack
+The rack uWSGI plugin allows running Ruby Rack applications.
+
+%package plugin-router_access
+Summary:        uWSGI Plugin for TCP Wrapper-based Access Control
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-router_access
+The router_access uWSGI plugin enables TCP Wrapper-based access control.
+
+%package plugin-router_basicauth
+Summary:        uWSGI Plugin Providing HTTP-Authentication Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-router_basicauth
+The router_basicauth uWSGI plugin enables support for HTTP-authentication.
+
+%package plugin-ruby19
+Summary:        uWSGI Plugin Embdedding Ruby
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-ruby19
+The ruby19 uWSGI plugin embeds Ruby and provides access to the uWSGI API from
+Ruby.
+
+%package plugin-sqlite3
+Summary:        uWSGI Pluginfor Retrieving uWSGI Configuration from a SQLite3 Database
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-sqlite3
+The sqlite3 uWSGI plugin allows to retrieve the uWSGI Configuration from
+a SQLite3 database.
+
+%package plugin-stats_pusher_mongodb
+Summary:        uWSGI Plugin for Pushing Statistics to a MongoDB Database
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-stats_pusher_mongodb
+The stats_pusher_mongodb uWSGI plugin allows to push statistics to a MongoDB
+database.
+
+%package plugin-v8
+Summary:        uWSGI Plugin Embedding V8 and Providing JSGI 3.0 Support
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-v8
+The v8 uWSGI plugin embeds the V8 Javascript Engine and provides support for
+running JSGI 3.0 applications.
+
+%package plugin-xslt
+Summary:        uWSGI Plugin for Applying XSL Transformations
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description plugin-xslt
+The xslt uWSGI plugin allows to apply XSL Transformations
+
+%package -n mod_uwsgi
+Summary:        uwsgi Apache module
+Group:          System Environment/Libraries
+Requires:       httpd >= 2.4
+Requires:       %{name} = %{version}-%{release}
+
+%description -n mod_uwsgi
+This package contains the uwsgi Apache module.
+
+# prevent auto-generated requires and provides for Apache modules, see
+# https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering
+%{?filter_setup:
+%filter_provides_in %{_libdir}/httpd/modules/.*\.so$
+%filter_setup
+}
+
+%prep
+%setup -q -a1
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+pushd uwsgi-docs-%{uwsgi_docs_rev}
+# remove empty files
+find . -name '*.rst' -and -size 0 -exec rm {} \+
+# remove languages unknown to sphinx which otherwise cause build failures
+find . -name '*.rst' -exec sed -i 's|code-block:: .*$|code-block:: none|' {} \+
+# fix CRLF
+dos2unix PyPy.rst
+popd
+
+#
+# generate the build configuration
+#
+
+# examples without real use
+blacklist_plugins="example"
+blacklist_plugins="${blacklist_plugins} dummy"
+blacklist_plugins="${blacklist_plugins} cheaper_backlog2"
+blacklist_plugins="${blacklist_plugins} cplusplus"
+blacklist_plugins="${blacklist_plugins} exception_log"
+# stackless python is not available
+blacklist_plugins="${blacklist_plugins} stackless"
+# seems to conflic with python plugin
+blacklist_plugins="${blacklist_plugins} pyuwsgi"
+# requires modifications to PyPy
+blacklist_plugins="${blacklist_plugins} pypy"
+# uses Mac OS X API
+blacklist_plugins="${blacklist_plugins} alarm_speech"
+# internal hack
+blacklist_plugins="${blacklist_plugins} mongodb"
+# the Mono version provided by RHEL 6 is too old
+blacklist_plugins="${blacklist_plugins} mono"
+# Go is not available
+blacklist_plugins="${blacklist_plugins} go"
+# systemd is not available
+blacklist_plugins="${blacklist_plugins} systemd_logger"
+# Ruby 1.9 is not available
+blacklist_plugins="${blacklist_plugins} fiber"
+# gccgo is not available
+blacklist_plugins="${blacklist_plugins} gccgo"
+
+embed_plugins="null"
+
+for f in plugins/*/uwsgiplugin.py; do
+    plugin="${f#plugins/}"
+    plugin="${plugin%/uwsgiplugin.py}"
+    blacklisted=false
+    for blacklist_plugin in ${blacklist_plugins}; do
+        if [ "${plugin}" = "${blacklist_plugin}" ]; then
+            blacklisted=true
+            break
+        fi
+    done
+    if ! ${blacklisted}; then
+        enabled_plugins="${enabled_plugins}${enabled_plugins:+, }${plugin}"
+    fi
+done
+
+cat >buildconf/fedora.ini <<EOF
+[uwsgi]
+inherit = base
+; enable XML configuration format
+xml = true
+; configuration from SQlite database
+sqlite3 = true
+; configuration via LDAP
+ldap = true
+; enable SSL support
+ssl = true
+; enable PCRE support
+pcre = true
+; use libyaml for parsing YAML configuration
+yaml_implementation = libyaml
+; enable alarm subystem
+alarm = true
+; enable ZeroMQ transport layer
+zeromq = true
+; plugins to build
+plugins = ${enabled_plugins}
+; plugins to embed
+embedded_plugins = ${embed_plugins}
+; plugin installation path
+plugin_dir = %{_libdir}/%{name}
+EOF
+
+%build
+export UWSGICONFIG_LUALIB="lua"
+export UWSGICONFIG_LUAINC="%{_includedir}"
+export UWSGICONFIG_LUALIBPATH="%{_libdir}"
+export CFLAGS="%{optflags} -Wno-unused-but-set-variable -Wno-error"
+
+# build uwsgi executable and plugins
+python uwsgiconfig.py --build fedora.ini
+
+# build apache module
+pushd apache2
+apxs -c mod_uwsgi.c
+popd
+
+# build HTML documentation
+mkdir html
+sphinx-build -b html uwsgi-docs-%{uwsgi_docs_rev} html
+rm -rf html/.doctrees html/.buildinfo
+
+%install
+rm -rf %{buildroot}
+
+install -D -p -m 755 uwsgi %{buildroot}%{_sbindir}/uwsgi
+install -d -m 755 %{buildroot}%{_libdir}/uwsgi
+install -p -m 755 *_plugin.so %{buildroot}%{_libdir}/uwsgi
+install -D -p -m 644 uwsgidecorators.py \
+        %{buildroot}%{python_sitelib}/uwsgidecorators.py
+install -D -p -m 755 apache2/.libs/mod_uwsgi.so \
+        %{buildroot}%{_libdir}/httpd/modules/mod_uwsgi.so
+install -d -m 755 %{buildroot}%{_includedir}/uwsgi
+install -p -m 0644 *.h %{buildroot}%{_includedir}/uwsgi
+
+install -d -m 755 %{buildroot}%{_sysconfdir}/uwsgi.d
+install -d -m 755 %{buildroot}%{_localstatedir}/run/uwsgi
+
+install -D -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/uwsgi.ini
+install -D -p -m 755 %{SOURCE4} %{buildroot}%{_initddir}/uwsgi
+install -D -p -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/uwsgi
+install -D -p -m 644 %{SOURCE3} \
+        %{buildroot}%{_sysconfdir}/httpd/conf.d/10-uwsgi.conf
+
+%clean
+rm -rf %{buildroot}
+
+%pre
+getent group uwsgi >/dev/null || groupadd -r uwsgi
+getent passwd uwsgi >/dev/null || \
+    useradd -r -g uwsgi -d %{_localstatedir}/run/uwsgi -s /sbin/nologin \
+    -c "uWSGI daemon user" uwsgi
+exit 0
+
+%post
+/sbin/chkconfig --add uwsgi
+
+%preun
+if [ $1 -eq 0 ] ; then
+    /sbin/service uwsgi stop >/dev/null 2>&1
+    /sbin/chkconfig --del uwsgi
+fi
+
+%postun
+if [ "$1" -ge 1 ] ; then
+    /sbin/service uwsgi condrestart >/dev/null 2>&1 || :
+fi
+
+
+%files
+%defattr(-,root,root,-)
+%doc LICENSE README CONTRIBUTORS
+%{_initddir}/uwsgi
+%config(noreplace) %{_sysconfdir}/uwsgi.ini
+%dir %{_sysconfdir}/uwsgi.d
+%config(noreplace) %{_sysconfdir}/logrotate.d/uwsgi
+%{_sbindir}/uwsgi
+%dir %{_localstatedir}/run/uwsgi
+%dir %{_libdir}/uwsgi
+%{_libdir}/%{name}/cache_plugin.so
+%{_libdir}/%{name}/cgi_plugin.so
+%{_libdir}/%{name}/cheaper_busyness_plugin.so
+%{_libdir}/%{name}/clock_monotonic_plugin.so
+%{_libdir}/%{name}/clock_realtime_plugin.so
+%{_libdir}/%{name}/corerouter_plugin.so
+%{_libdir}/%{name}/dumbloop_plugin.so
+%{_libdir}/%{name}/echo_plugin.so
+%{_libdir}/%{name}/http_plugin.so
+%{_libdir}/%{name}/legion_cache_fetch_plugin.so
+%{_libdir}/%{name}/logcrypto_plugin.so
+%{_libdir}/%{name}/logfile_plugin.so
+%{_libdir}/%{name}/notfound_plugin.so
+%{_libdir}/%{name}/objc_gc_plugin.so
+%{_libdir}/%{name}/ping_plugin.so
+%{_libdir}/%{name}/rawrouter_plugin.so
+%{_libdir}/%{name}/router_cache_plugin.so
+%{_libdir}/%{name}/router_hash_plugin.so
+%{_libdir}/%{name}/router_http_plugin.so
+%{_libdir}/%{name}/router_memcached_plugin.so
+%{_libdir}/%{name}/router_radius_plugin.so
+%{_libdir}/%{name}/router_redirect_plugin.so
+%{_libdir}/%{name}/router_redis_plugin.so
+%{_libdir}/%{name}/router_rewrite_plugin.so
+%{_libdir}/%{name}/router_static_plugin.so
+%{_libdir}/%{name}/router_uwsgi_plugin.so
+%{_libdir}/%{name}/router_xmldir_plugin.so
+%{_libdir}/%{name}/rpc_plugin.so
+%{_libdir}/%{name}/signal_plugin.so
+%{_libdir}/%{name}/spooler_plugin.so
+%{_libdir}/%{name}/ssi_plugin.so
+%{_libdir}/%{name}/sslrouter_plugin.so
+%{_libdir}/%{name}/stats_pusher_statsd_plugin.so
+%{_libdir}/%{name}/symcall_plugin.so
+%{_libdir}/%{name}/transformation_chunked_plugin.so
+%{_libdir}/%{name}/transformation_gzip_plugin.so
+%{_libdir}/%{name}/transformation_offload_plugin.so
+%{_libdir}/%{name}/transformation_tofile_plugin.so
+%{_libdir}/%{name}/transformation_toupper_plugin.so
+%{_libdir}/%{name}/ugreen_plugin.so
+%{_libdir}/%{name}/webdav_plugin.so
+%{_libdir}/%{name}/xattr_plugin.so
+%{_libdir}/%{name}/zergpool_plugin.so
+%{_libdir}/%{name}/admin_plugin.so
+%{_libdir}/%{name}/syslog_plugin.so
+%{_libdir}/%{name}/rsyslog_plugin.so
+
+%{_libdir}/%{name}/carbon_plugin.so
+%{_libdir}/%{name}/emperor_amqp_plugin.so
+%{_libdir}/%{name}/emperor_zeromq_plugin.so
+%{_libdir}/%{name}/erlang_plugin.so
+%{_libdir}/%{name}/fastrouter_plugin.so
+%{_libdir}/%{name}/gevent_plugin.so
+%{_libdir}/%{name}/graylog2_plugin.so
+%{_libdir}/%{name}/greenlet_plugin.so
+%{_libdir}/%{name}/jwsgi_plugin.so
+%{_libdir}/%{name}/logsocket_plugin.so
+%{_libdir}/%{name}/mongodblog_plugin.so
+%{_libdir}/%{name}/nagios_plugin.so
+%{_libdir}/%{name}/pyerl_plugin.so
+%{_libdir}/%{name}/redislog_plugin.so
+%{_libdir}/%{name}/ring_plugin.so
+%{_libdir}/%{name}/router_spnego_plugin.so
+%{_libdir}/%{name}/rrdtool_plugin.so
+
+%files doc
+%defattr(-,root,root,-)
+%doc html/
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/uwsgi
+
+%files plugin-airbrake
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/airbrake_plugin.so
+
+%files plugin-alarm_curl
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/alarm_curl_plugin.so
+
+%files plugin-alarm_xmpp
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/alarm_xmpp_plugin.so
+
+%files plugin-coroae
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/coroae_plugin.so
+
+%files plugin-curl_cron
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/curl_cron_plugin.so
+
+%files plugin-emperor_mongodb
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/emperor_mongodb_plugin.so
+
+%files plugin-emperor_pg
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/emperor_pg_plugin.so
+
+%files plugin-geoip
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/geoip_plugin.so
+
+%files plugin-gridfs
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/gridfs_plugin.so
+
+%files plugin-jvm
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/jvm_plugin.so
+
+%files plugin-ldap
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/ldap_plugin.so
+
+%files plugin-lua
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/lua_plugin.so
+
+%files plugin-pam
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/pam_plugin.so
+
+%files plugin-php
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/php_plugin.so
+
+%files plugin-psgi
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/psgi_plugin.so
+
+%files plugin-python
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/python_plugin.so
+
+%files plugin-rack
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/rack_plugin.so
+
+%files plugin-router_access
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/router_access_plugin.so
+
+%files plugin-router_basicauth
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/router_basicauth_plugin.so
+
+%files plugin-ruby19
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/ruby19_plugin.so
+
+%files plugin-sqlite3
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/sqlite3_plugin.so
+
+%files plugin-stats_pusher_mongodb
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/stats_pusher_mongodb_plugin.so
+
+%files plugin-v8
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/v8_plugin.so
+
+%files plugin-xslt
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/xslt_plugin.so
+
+%files -n python-uwsgidecorators
+%defattr(-,root,root,-)
+%{python_sitelib}/uwsgidecorators.py*
+
+%files -n mod_uwsgi
+%defattr(-,root,root,-)
+%{_sysconfdir}/httpd/conf.d/10-uwsgi.conf
+%{_libdir}/httpd/modules/mod_uwsgi.so
+
+%changelog
+* Wed Jul 10 2013 Guido Berhoerster <guido+packaging@berhoerster.name> - 1.9.13-1
+- Initial packaging