diff options
author | Alexys Jacob <ultrabug@gentoo.org> | 2013-03-01 09:50:15 +0000 |
---|---|---|
committer | Alexys Jacob <ultrabug@gentoo.org> | 2013-03-01 09:50:15 +0000 |
commit | 5ff9b260d5b849e92e25ce84277a373391c5bf98 (patch) | |
tree | 0b8e37ae1333cc19107b3c43cd691ba3dbf36cc9 /www-servers/uwsgi | |
parent | Add pre released ebuild (diff) | |
download | historical-5ff9b260d5b849e92e25ce84277a373391c5bf98.tar.gz historical-5ff9b260d5b849e92e25ce84277a373391c5bf98.tar.bz2 historical-5ff9b260d5b849e92e25ce84277a373391c5bf98.zip |
Introduce UWSGI_GROUP and UWSGI_EMPEROR_GROUP conf.d variables
Package-Manager: portage-2.1.11.52/cvs/Linux x86_64
Manifest-Sign-Key: 0xB658FA13
Diffstat (limited to 'www-servers/uwsgi')
-rw-r--r-- | www-servers/uwsgi/ChangeLog | 8 | ||||
-rw-r--r-- | www-servers/uwsgi/Manifest | 11 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.confd-r3 | 63 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.initd-r3 | 144 | ||||
-rw-r--r-- | www-servers/uwsgi/uwsgi-1.4.6-r1.ebuild | 329 |
5 files changed, 550 insertions, 5 deletions
diff --git a/www-servers/uwsgi/ChangeLog b/www-servers/uwsgi/ChangeLog index 8b1aec0a7c94..14bfa7d74616 100644 --- a/www-servers/uwsgi/ChangeLog +++ b/www-servers/uwsgi/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for www-servers/uwsgi # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/ChangeLog,v 1.39 2013/02/26 08:55:22 ultrabug Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/ChangeLog,v 1.40 2013/03/01 09:50:06 ultrabug Exp $ + +*uwsgi-1.4.6-r1 (01 Mar 2013) + + 01 Mar 2013; Ultrabug <ultrabug@gentoo.org> +uwsgi-1.4.6-r1.ebuild, + +files/uwsgi.confd-r3, +files/uwsgi.initd-r3: + Introduce UWSGI_GROUP and UWSGI_EMPEROR_GROUP conf.d variables *uwsgi-1.4.6 (26 Feb 2013) diff --git a/www-servers/uwsgi/Manifest b/www-servers/uwsgi/Manifest index 34c640534025..3e88e2dcfcc4 100644 --- a/www-servers/uwsgi/Manifest +++ b/www-servers/uwsgi/Manifest @@ -9,9 +9,11 @@ AUX 42_mod_uwsgi.conf 159 SHA256 b759712baa7b8abab2ffd56c3cbc970cb9189ef1efa3f3a AUX uwsgi-1.0.2.1-no-werror.patch 567 SHA256 64ee1684a12ea64b6b6892209c77863061a54cc752156131c6fc55f7f8785153 SHA512 8ebd116d1fd75385f13cf072ac44dfb0055f789dd7fc1f37433b6dd98c62cb439b2fbf99fe891d919139f93404f5017e3600093d8dc21c8463f0f50e3bb72460 WHIRLPOOL 0de33344956bd2723f364da07ad6a48adca3ffc43e53cad9ee70c92707ea6f9b47004f1fdd8b14318ba39d0995085986a3d606e26d07fd293d71ebdab17eaf17 AUX uwsgi.confd 1116 SHA256 3c238b934f8db9eae87f77dc3d131499e442526d5e45438b5461c0d7590b772f SHA512 888d174ed0c83e93724b473712288e42ce97e0b367b7aca3c707795e8bf4753a242982d8fa35274662851a6638eef3a55860982aae1d94fb234cd29ca4382bfd WHIRLPOOL a3708ed41de4e21562eca5ea89afed6e6cb234c0c37583b58ee346478de64569e68b8eed45ca0349222cb07ee8b85683ecebeea404c2f0ded1c91dff90cbfdbc AUX uwsgi.confd-r1 1438 SHA256 baa1522d488523daf67d3d480f9aa5076ae3252ab2731f4c25ef564caba8cfd2 SHA512 51e7154ced90a6a531944db8df7bdc2d502550501845ff153e05f94623d0d547180b78fe80203a272af60306b9d3d8575dc101e4069b655091a821929a6e4436 WHIRLPOOL cb12c57c5eb636941e429900ae8f932129ace89620d46d537108ba3aa15e694eb4038bca5739eefba544dc02c8ecefdb53419509ed542c40ec5803f4f0516ff5 +AUX uwsgi.confd-r3 1816 SHA256 4cb047e311aecd0f498da1d6a4c0947dd6dc7cc98575d54cb2ef150cacf8425c SHA512 9f00afb2aa574bbc59040f945475712b8c40da0c06eeb5699de5510aa116148e35ab0429fa891084cf0cd7868876d5a80e1601b7c85d0e2e9ea2a1f54cdde619 WHIRLPOOL 5b20118c3b5950d2457d909bf7cca15f21edd13358da1a9284ff4412fda3ab13958df5dd0714e12d0c38e9e516c46c779a71cd872164165074045adb008a639c AUX uwsgi.initd 2843 SHA256 93ac80033db1b9fcb9bc42ec22463cbc2b6c4135b458cd921ec699d86f976e8f SHA512 e3dcaa5d5bf18f38271f7cbdd315c77f42a951e45b9d311fca8c5e97e0213b890ccbc3cfc2be634d24e6d3a88fb633e17039bcaad166aa8b304adcb37169d726 WHIRLPOOL 44244eb504c13e1d9db2c34d3a94ee1049a0d1b31c3503853da92c3071df7ec44114d7f609f84151073d3d31b8b94b35ed0f391e17986e17b468ce3558470213 AUX uwsgi.initd-r1 3352 SHA256 857940e7c6c97c0e23db85015a47d295a102607100f0662ae69dc9c3c5bef14c SHA512 8c32618696be688001597d685f2a91eb6bbf65464889dd1ec30e40fe3cea2290cfe2cf0ec41dc3a2e35461781400f1a6fe881d666ab0771dde37a65b8ab873a8 WHIRLPOOL 954357c5c6c529a3b763cd5a09b0c7af2c738f7cba0823ddb80405fb5d31a06edc1677a13043fe1396ef0e9aef6142365cca223342bd10d090cddff7f15d0dad AUX uwsgi.initd-r2 3436 SHA256 1983e7346e50996ea9a34ac8f399b965596232bf7b9b38a98226562f11143463 SHA512 0eb9f844bacc3133615f4cd521adccb8830f58bd5b8c6d602e86191a7005157cc52fc5259654de79735f7ac4a41d0d2fd093f0dd08f62d3732efe482450b7590 WHIRLPOOL bbbf4cdb82710468caa6365536423e79ac13d0b81e393f50fed0be95bea5f73cc31ca19f99bdc0c6b54f7fdfea8175f6af6e8975b5c6b28828790dd2bf022921 +AUX uwsgi.initd-r3 3614 SHA256 58b998b025e4a9df20ca917bc93e287f9a8cf02d278d513fa461f70e1d08f799 SHA512 ab9dc6277bd05821287f6f8beb3ac2504f0e41db38e11b4d2884ac026f14ac7bfaaca138f045afa712d4f2843f94de105bf0d43fad35d18679ac33b507cd187e WHIRLPOOL 7bf4b1d5263ddb3ea0e3c81fe4906debaa3a3ee0a59a177b4f12a24d883bcb2049dffa4b11d9564c1ce4324a23a67cd4e8110f1955c05287f53cbd4b4e75e7cc DIST uwsgi-1.0.2.1.tar.gz 465250 SHA256 78280b57a970db7842e4481f8b00f13d011f27b340c869dc1ad28d564d716439 SHA512 de7761b24ae92aea62b4b5d4523d1b812dd5c25c09551baf7007a0e1a97461c62033762cb02e90a9bd85f2aef78477c5151c5a359c8b878150a0c926e3a759ee WHIRLPOOL 47ca0115d55a09b99006fff9c6fb6b5daa71b0b4ea64bbc65390ff64c05f62a661a17b1ec172e05f78f75dd9a36efad3d9dacb57c980639038be6f718480d7b6 DIST uwsgi-1.2.6.tar.gz 515869 SHA256 49d2fbedbd42b3c95a684f7ddf43302f881297f3614c7edd0af4a4c44e2032a5 SHA512 79297cc3d348e6fbbd1d7da5fb4d03844cc14ce36411ce55d6951e8f0c50614d87c3038de6986589362e9e84543aec9754a871c52002065d5f17a27a7ad32f01 WHIRLPOOL cdd74205572f0fce1390f3335e4f3cd6413d3cd5be9fb91a259a38c7330fe6b53057985e3ed6b8a67f6fba5339609506be4fbf2ae10251518406d6b02c831f09 DIST uwsgi-1.4.4.tar.gz 589158 SHA256 419f45aea5469b6bec5b20e0edfe481c91a5efcd150cfaa49ca977bc14beddb9 SHA512 0736edadcda323ee4923c3163996e27eb3b7cb6c6603055c63ba527cc7408c3e39448cdc35e70ceec0dd4551e1a451ed04e2cf7bc6a3ca39726f144a0b818813 WHIRLPOOL 0d5be288a5e8b685ddbec922fee3ee0068143aabf6c7a3b38f68f20b9ca63775d8212ac0584b85e57352adb460a1c851e3605e9018d9ec65d59d8c4c03fbd4c1 @@ -21,13 +23,14 @@ EBUILD uwsgi-1.0.2.1.ebuild 1891 SHA256 1078d427a2cd4abe8a7ed4a5ec4a477fea989c2b EBUILD uwsgi-1.2.6.ebuild 8658 SHA256 98585a8e43e7af3f9bf516994fc7778e817a1857bca75658eacde9d1389c6033 SHA512 9b53d4ade90665886881c02869b8619e4128fcdeaa3340efec02b8dc645de3f99cba69a827cc4b0273dc8c94af72c2bc9ec0021f7f76616c14f21e6f41275b24 WHIRLPOOL b18455b534307639fe9b37fd54d3047c5ebbbceaa8438688bb6d89f9b4b63ccf4c0b03590e23ba1c6d2fa70224ce5bb5b135c87d74df0389dfb07407784569aa EBUILD uwsgi-1.4.4.ebuild 9559 SHA256 58c6c34168966b915caa3c25dbcef3cfc60b9ae25056c1ddaa739e35963195d6 SHA512 43338613228a61db00e7c97c0217d0e65269a6612eb6a21fccc04d4dec6f577cda4b3889f3ea0afdb02a3e997b44580e85e70d56732faf17f1b4ea7242c33802 WHIRLPOOL 795667e01e8a4ddf0f01558b6bbe2bcc85472d5f5015bc6e87cf990b3e71f7dfb789a80107efe3511b56c0c3c7ad92f64cff1e7091b6d0a0081e12b20ba4e04a EBUILD uwsgi-1.4.5-r1.ebuild 9562 SHA256 ffeda3dce0dba8c1aa29b05a5f057bbe30f86325473ef3e6427bc37a6789c0c8 SHA512 149ca6773547dc5b2eb122fb2cb8a3ccc066ce1e8e339a39df2d1bbd037407919bc9ae8b1cb42aadc0999d425511cf5b73c6bf9fc8696cc6d12ef70e459af1e0 WHIRLPOOL 2f0cb2606080afd7acee1e6359d34ed4fded90839eb88252777f09c1c537fd5fe57e0176f9a1f900767f008f82ef76c1565078eaa9f296711a4c4c7589253cf9 +EBUILD uwsgi-1.4.6-r1.ebuild 9562 SHA256 64e5834cc5768cf2b8cc96f9e075e155bbbe1929d3d64267380dd2c7dffd4e0d SHA512 428e867eca4721a5d754e9bff95a952834f70023ba1808c6d12f52ca6276a405d9368c2852dd32ae5b368ef4801c1c5a7008d2fcc5adaa84db8ae7e29970b85a WHIRLPOOL 1594df00049c7ae13746215c72ef092703b23255eb911af5445040daed825d6e7bcc8807dde599b1a74d5201a8a6f4b36c0c9ae1045ce4c4b016895d1ea0d488 EBUILD uwsgi-1.4.6.ebuild 9559 SHA256 d606c46c5d9c3d422faa13113138eaa84812e08dad807741261314887e75ac5a SHA512 2006048503b70e59d3a0515c889ad88fdab59af1a2ccbfa8eaddf5f926b164b9932c223d52f376cd57c1c068415daef1a2815f0dc2e736cab4224ad9209dc601 WHIRLPOOL 31ee2ae6954d97388c2681376e67431f00ef497c11892eb7b6938ca235811a42d1ee309619633836594c6729f2bbc6fdfb860d40047e618aed1983aac74e45d4 -MISC ChangeLog 7236 SHA256 77c8efd4501ab71d6bf3aed919ebf2d90f3f0e9c5df8fa20ca35e92b090d24f9 SHA512 d9e0586970254febe2303009f5943beb51c14329a2a92e46f49867139487e1cfb7dbcdff4eff4eea4722639a16b54e2c1b092b10145c3adea07f030bb1e51b00 WHIRLPOOL 9982dcf310b61fd1c4e99c726921595cae4360759b89c69946dc3e535be877b9337d6ccd41ee77e7f13dc2d30dcb5e0f01cddd5805cf76b5cd62cd867e03cac7 +MISC ChangeLog 7451 SHA256 bead8f11c8f3a80b873437b6114f9c874490a4e88b74abf4addefd0f87849248 SHA512 b626696e3ea7507129411f1e33e92d3100719df82297852c46073651dbc8885acc7f0d548841cf7c02ec57a5d71fc7fef6a4172acaafc6265418f37c7f861daf WHIRLPOOL 99dec9abb7b669ad728312347c46b8a241809ffa8dde35af737f1c5c2d98c03e5167407742f2f67a29a92097b68a0437e7cb4c25ec62040778e5efaf2bb0cda5 MISC metadata.xml 1857 SHA256 eec5b1ed09980d423c5e6fec1c85ade0459bb589bba1bb863dc378f7f348abcf SHA512 a3e9aee2176ce686259cc4be0166545cc323e5aa17f28f797b80bd6d711ab1af43a64a51480baf0b87ad53b0b6ecd7158c950768dd6154817daf7faf9021bd10 WHIRLPOOL b5383be7268e47688cde206a9635b7d6d52f21986e3274b2d0ed308e56d693f07ada4fed3405c7c82741259ab1f09eaa617bdd5c279ee733918db0b347e06c10 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) -iF4EAREIAAYFAlEseH8ACgkQKiQSS7ZY+hN3+AD+KBx2T+xu/PKDhE5tOcqLfjuS -+4y+BCV8bvNCb56TVJsA/A0l0u/hosSMyoWZFYKM9kR8yxcZpfsQG8G6sQU5qjpW -=6Fcq +iF4EAREIAAYFAlEwedUACgkQKiQSS7ZY+hMnYwEA3TQ2o5OvSyUDbE6ulvq0TrP6 +Vul7urVAJJd3gCHA1yUA/1ogerQDEnfIwlDLqgvG/wYM1mtlT6RoEIBRitkLxJR0 +=8qTn -----END PGP SIGNATURE----- diff --git a/www-servers/uwsgi/files/uwsgi.confd-r3 b/www-servers/uwsgi/files/uwsgi.confd-r3 new file mode 100644 index 000000000000..7759361981fb --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.confd-r3 @@ -0,0 +1,63 @@ +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/files/uwsgi.confd-r3,v 1.1 2013/03/01 09:50:06 ultrabug Exp $ + +# YOU SHOULD ONLY MODIFY THIS FILE IF YOU USE THE UWSGI EMPEROR MODE! +# IF YOU WANT TO RUN A SINGLE APP INSTANCE, CREATE A COPY AND MODIFY THAT INSTEAD! + +# Path (or name) of UNIX/TCP socket to bind to +# Example : UWSGI_SOCKET=127.0.0.1:1234 +UWSGI_SOCKET= + +# Enable threads? (1 = yes, 0 = no). The default is 0 +# +UWSGI_THREADS=0 + +# The path to your uWSGI application. +# +UWSGI_PROGRAM= + +# The path to your uWSGI xml config file. +# +UWSGI_XML_CONFIG= + +# The number of child processes to spawn. The default is 1. +# +UWSGI_PROCESSES=1 + +# The log file path. If empty, log only errors +# +UWSGI_LOG_FILE= + +# If you want to run your application inside a chroot then specify the +# directory here. Leave this blank otherwise. +# +UWSGI_CHROOT= + +# If you want to run your application from a specific directiory specify +# it here. Leave this blank otherwise. +# +UWSGI_DIR= + +# The user to run your application as. If you do not specify these, +# the application will be run as user root. +# +UWSGI_USER= + +# The group to run your application as. If you do not specify these, +# the application will be run as group root. +# +UWSGI_GROUP= + +# Run the uwsgi emperor which loads vassals dynamically from this PATH +# see http://projects.unbit.it/uwsgi/wiki/Emperor +# The advised Gentoo folder is /etc/uwsgi.d/ +UWSGI_EMPEROR_PATH= + +# The group the emperor should run as. This is different from the UWSGI_GROUP +# as you could want your apps share some sockets with other processes such as +# www servers while preserving your emperor logs from being accessible by them. +UWSGI_EMPEROR_GROUP= + +# Additional options you might want to pass to uWSGI +# +UWSGI_EXTRA_OPTIONS= diff --git a/www-servers/uwsgi/files/uwsgi.initd-r3 b/www-servers/uwsgi/files/uwsgi.initd-r3 new file mode 100644 index 000000000000..15ae1a8a9057 --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r3 @@ -0,0 +1,144 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/files/uwsgi.initd-r3,v 1.1 2013/03/01 09:50:06 ultrabug Exp $ + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +if [ "${SVCNAME}" == "uwsgi" ]; then + PIDPATH=/var/run/uwsgi +else + PIDPATH="/var/run/uwsgi_${PROGNAME}" +fi +PIDFILE="${PIDPATH}/${PROGNAME}.pid" + +extra_started_commands="${opts} reload stats" + +depend() { + need net +} + +start_pre() { + checkpath -d -m 0750 -o "${UWSGI_USER}":"${UWSGI_GROUP}" "${PIDPATH}" +} + +start_emperor() { + local OPTIONS + OPTIONS="--daemonize" + + if [ -n "${UWSGI_LOG_FILE}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_LOG_FILE}" + else + OPTIONS="${OPTIONS} /dev/null --disable-logging" + fi + + [ -z "${UWSGI_DIR}" ] && UWSGI_DIR="/" + [ -z "${UWSGI_USER}" ] && UWSGI_USER="root" + [ -z "${UWSGI_GROUP}" ] && UWSGI_GROUP="root" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --exec "${UWSGI_EXEC}" \ + --group ${UWSGI_EMPEROR_GROUP:-${UWSGI_GROUP}} \ + -- --emperor "${UWSGI_EMPEROR_PATH}" ${OPTIONS} --pidfile "${PIDFILE}" + return $? +} + +start_app() { + local OPTIONS + OPTIONS="--master --daemonize" + + if [ -n "${UWSGI_LOG_FILE}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_LOG_FILE}" + else + OPTIONS="${OPTIONS} /dev/null --disable-logging" + fi + + [ -z "${UWSGI_DIR}" ] && UWSGI_DIR="/" + [ -z "${UWSGI_USER}" ] && UWSGI_USER="root" + [ -z "${UWSGI_GROUP}" ] && UWSGI_GROUP="root" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + if [ "${UWSGI_THREADS}" = "1" ]; then + OPTIONS="${OPTIONS} --enable-threads" + fi + + if [ -n "${UWSGI_SOCKET}" ]; then + OPTIONS="${OPTIONS} --socket ${UWSGI_SOCKET}" + fi + + if [ -n "${UWSGI_PROCESSES}" ]; then + OPTIONS="${OPTIONS} --processes ${UWSGI_PROCESSES}" + fi + + if [ -n "${UWSGI_CHROOT}" ]; then + OPTIONS="${OPTIONS} --chroot ${UWSGI_CHROOT}" + fi + + if [ -n "${UWSGI_PROGRAM}" ]; then + OPTIONS="${OPTIONS} --fileserve-mode ${UWSGI_PROGRAM}" + fi + + if [ -n "${UWSGI_XML_CONFIG}" ]; then + OPTIONS="${OPTIONS} --xmlconfig ${UWSGI_XML_CONFIG}" + fi + + ebegin "Starting uWSGI application ${PROGNAME}" + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --group "${UWSGI_GROUP}" \ + --exec "${UWSGI_EXEC}" -- ${OPTIONS} --pidfile "${PIDFILE}" + return $? +} + +start() { + if [ "${SVCNAME}" == "uwsgi" ]; then + if [ -n "${UWSGI_EMPEROR_PATH}" ]; then + start_emperor + eend $? + else + eerror "You are not supposed to run this script directly unless you" + eerror "want to run in Emperor mode. In that case please set the UWSGI_EMPEROR_PATH." + eerror "Otherwise create a symlink for the uwsgi application you want to run as well as" + eerror "a copy of the configuration file and modify it appropriately like so..." + eerror + eerror " ln -s uwsgi /etc/init.d/uwsgi.trac" + eerror " cp /etc/conf.d/uwsgi /etc/conf.d/uwsgi.trac" + eerror " nano /etc/conf.d/uwsgi.trac" + eerror + return 1 + fi + else + start_app + eend $? + fi +} + +stop() { + if [ -n "${UWSGI_EMPEROR_PATH}" ]; then + ebegin "Stopping uWSGI emperor" + else + ebegin "Stopping uWSGI application ${PROGNAME}" + fi + start-stop-daemon --stop --signal QUIT --pidfile "${PIDFILE}" + eend $? +} + +reload() { + ebegin "Reloading uWSGI" + start-stop-daemon --signal HUP --pidfile "${PIDFILE}" + eend $? +} + +stats() { + ebegin "Logging uWSGI statistics" + start-stop-daemon --signal USR1 --pidfile "${PIDFILE}" + eend $? +} diff --git a/www-servers/uwsgi/uwsgi-1.4.6-r1.ebuild b/www-servers/uwsgi/uwsgi-1.4.6-r1.ebuild new file mode 100644 index 000000000000..0cc5e4678028 --- /dev/null +++ b/www-servers/uwsgi/uwsgi-1.4.6-r1.ebuild @@ -0,0 +1,329 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/uwsgi-1.4.6-r1.ebuild,v 1.1 2013/03/01 09:50:06 ultrabug Exp $ + +EAPI="5" +PYTHON_DEPEND="python? *" +PYTHON_MODNAME="uwsgidecorators" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="*-jython 2.7-pypy-*" +USE_RUBY="ruby18 ree18 ruby19" +RUBY_OPTIONAL="yes" +PHP_EXT_NAME="dummy" +PHP_EXT_INI="no" +USE_PHP="php5-3 php5-4" # deps must be registered separately below +PHP_EXT_OPTIONAL_USE="php" + +MY_P="${P/_/-}" + +inherit apache-module eutils python multilib pax-utils php-ext-source-r2 ruby-ng versionator + +DESCRIPTION="uWSGI server for Python web applications" +HOMEPAGE="http://projects.unbit.it/uwsgi/" +SRC_URI="http://projects.unbit.it/downloads/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="apache2 +caps +carbon cgi debug erlang gevent graylog2 json ldap lua +nagios pam perl +pcre php probepg +python rrdtool rsyslog ruby spooler sqlite syslog +xml yaml zeromq" +REQUIRED_USE="|| ( cgi erlang lua perl php python ruby )" + +# util-linux is required for libuuid when requesting zeromq support +CDEPEND="caps? ( sys-libs/libcap ) + json? ( dev-libs/jansson ) + erlang? ( dev-lang/erlang ) + gevent? ( >=dev-python/gevent-1.0_beta2 ) + graylog2? ( sys-libs/zlib ) + ldap? ( net-nds/openldap ) + lua? ( dev-lang/lua ) + pcre? ( dev-libs/libpcre ) + perl? ( dev-lang/perl ) + php? ( + php_targets_php5-3? ( dev-lang/php:5.3[embed] ) + php_targets_php5-4? ( dev-lang/php:5.4[embed] ) + ) + probepg? ( dev-db/postgresql-base:= ) + ruby? ( $(ruby_implementations_depend) ) + sqlite? ( dev-db/sqlite:3 ) + rsyslog? ( app-admin/rsyslog ) + xml? ( dev-libs/libxml2 ) + yaml? ( dev-libs/libyaml ) + zeromq? ( net-libs/zeromq sys-apps/util-linux )" +DEPEND="${CDEPEND} + virtual/pkgconfig" +RDEPEND="${CDEPEND} + rrdtool? ( net-analyzer/rrdtool )" + +S="${WORKDIR}/${MY_P}" +APXS2_S="${S}/apache2" +APACHE2_MOD_CONF="42_mod_uwsgi-r1 42_mod_uwsgi" + +want_apache2_2 + +use_true_false() { + if use $1 ; then + echo "true" + else + echo "false" + fi +} + +src_unpack() { + default +} + +pkg_setup() { + depend.apache_pkg_setup + python_pkg_setup +} + +src_prepare() { + epatch \ + "${FILESDIR}/1.1.2-threaded-php.patch" \ + "${FILESDIR}/1.2.3-pyerl.patch" + + sed -i \ + -e "s|'-O2', ||" \ + -e "s|'-Werror', ||" \ + -e "s|uc.get('plugin_dir')|uc.get('plugin_build_dir')|" \ + uwsgiconfig.py || die "sed failed" + + sed -i \ + -e 's|python\([0-9].[0-9]\)-config|python-config-\1|' \ + plugins/python/uwsgiplugin.py || die "sed failed" + + sed -i \ + -e "s|/lib|/$(get_libdir)|" \ + plugins/php/uwsgiplugin.py || die "sed failed" +} + +src_configure() { + local plugins="" + use carbon && plugins+=", carbon" + use graylog2 && plugins+=", graylog2" + use nagios && plugins+=", nagios" + use pam && plugins+=", pam" + use rrdtool && plugins+=", rrdtool" + use rsyslog && plugins+=", rsyslog" + use syslog && plugins+=", syslog" + + # Notes: + # * the embedded_plugins mostly follows the list of embedded_plugins + # in buildconf/base.ini, make sure you compare the list when bumping uWSGI + # * thus: keep the order in embedded_plugins the same as in the base.ini + cat > "buildconf/gentoo.ini" << EOF +[uwsgi] +xml = $(use_true_false xml) +ini = true +yaml = $(use_true_false yaml) +json = $(use_true_false json) +sqlite3 = $(use_true_false sqlite) +zeromq = $(use_true_false zeromq) +snmp = true +sctp = false +spooler = true +embedded = true +ssl = auto +udp = true +multicast = true +threading = true +sendfile = true +minterpreters = true +async = true +evdis = false +ldap = $(use_true_false ldap) +pcre = $(use_true_false pcre) +routing = auto +alarm = auto +debug = $(use_true_false debug) +unbit = false +xml_implementation = libxml2 +yaml_implementation = libyaml +malloc_implementation = libc +plugins = +bin_name = uwsgi +append_version = +plugin_dir = /usr/$(get_libdir)/uwsgi +plugin_build_dir = ${T}/plugins +embedded_plugins = ping, cache, rpc, corerouter, fastrouter, http, ugreen, signal, logsocket, router_uwsgi, router_redirect, router_basicauth, zergpool, redislog, mongodblog, router_rewrite, router_http, logfile, router_cache, rawrouter ${plugins} +as_shared_library = false + +locking = auto +event = auto +timer = auto +filemonitor = auto + +embed_files = + +embed_config = +[python] +paste = true +web3 = true +EOF + use caps || sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed" + use zeromq || sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed" + + if use probepg ; then + PGPV="$(best_version dev-db/postgresql-base)" + PGSLOT="$(get_version_component_range 1-2 ${PGPV##dev-db/postgresql-base-})" + sed -i \ + -e "s|pg_config|pg_config${PGSLOT/.}|" \ + plugins/probepg/uwsgiplugin.py || die "sed failed" + fi +} + +each_ruby_compile() { + cd "${WORKDIR}/${MY_P}" + + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rack gentoo rack_${RUBY##*/} || die "building plugin for ${RUBY} failed" + + if [[ "${RUBY}" == *ruby19 ]] ; then + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/fiber gentoo || die "building fiber plugin for ${RUBY} failed" + fi +} + +install_python_lib() { + insinto $(python_get_sitedir) + doins uwsgidecorators.py +} + +src_compile() { + python uwsgiconfig.py --build gentoo || die "building uwsgi failed" + + mkdir -p "${T}/plugins" + + if use erlang ; then + python uwsgiconfig.py --plugin plugins/erlang gentoo || die "building plugin for erlang failed" + fi + + if use lua ; then + # setting LUALIB explicitly since lua is not slotted on Gentoo + # and uwsgi otherwise looks for lua5.1 + UWSGICONFIG_LUALIB="lua" python uwsgiconfig.py --plugin plugins/lua gentoo || die "building plugin for lua failed" + fi + + if use perl ; then + python uwsgiconfig.py --plugin plugins/psgi gentoo || die "building plugin for perl failed" + fi + + if use php ; then + for s in $(php_get_slots); do + UWSGICONFIG_PHPDIR="/usr/$(get_libdir)/${s}" python uwsgiconfig.py --plugin plugins/php gentoo ${s/.} || die "building plugin for ${s} failed" + done + fi + + if use python ; then + for a in ${PYTHON_ABIS} ; do + python${a} uwsgiconfig.py --plugin plugins/python gentoo python${a/.} || die "building plugin for python-${a} failed" + + if use gevent ; then + python${a} uwsgiconfig.py --plugin plugins/gevent gentoo gevent${a/.} || die "building plugin for gevent-support in python-${a} failed" + fi + if use erlang ; then + python${a} uwsgiconfig.py --plugin plugins/pyerl gentoo pyerl${a/.} || die "building plugin for erlang-support in python failed" + fi + done + fi + + if use ruby ; then + ruby-ng_src_compile + fi + + if use spooler ; then + python uwsgiconfig.py --plugin plugins/spooler gentoo || die "building plugin for spooler failed" + fi + + if use cgi ; then + python uwsgiconfig.py --plugin plugins/cgi gentoo || die "building plugin for cgi failed" + fi + + if use probepg ; then + python uwsgiconfig.py --plugin plugins/probepg gentoo || die "building plugin for postgresql probe failed" + fi + + if use apache2 ; then + for m in proxy_uwsgi Ruwsgi uwsgi ; do + APXS2_ARGS="-c mod_${m}.c" + apache-module_src_compile + done + fi +} + +src_install() { + dobin uwsgi + pax-mark m "${D}"/usr/bin/uwsgi + + insinto /usr/$(get_libdir)/uwsgi + doins "${T}/plugins"/*.so + + use cgi && dosym uwsgi /usr/bin/uwsgi_cgi + use erlang && dosym uwsgi /usr/bin/uwsgi_erlang + use lua && dosym uwsgi /usr/bin/uwsgi_lua + use perl && dosym uwsgi /usr/bin/uwsgi_psgi + + if use php ; then + for s in $(php_get_slots); do + dosym uwsgi /usr/bin/uwsgi_${s/.} + done + fi + + if use python ; then + python_execute_function install_python_lib + for a in ${PYTHON_ABIS} ; do + dosym uwsgi /usr/bin/uwsgi_python${a/.} + done + fi + + if use apache2; then + for m in proxy_uwsgi Ruwsgi uwsgi ; do + APACHE2_MOD_FILE="${APXS2_S}/.libs/mod_${m}.so" + apache-module_src_install + done + fi + + newinitd "${FILESDIR}"/uwsgi.initd-r3 uwsgi + newconfd "${FILESDIR}"/uwsgi.confd-r3 uwsgi + keepdir /etc/"${PN}".d + use spooler && keepdir /var/spool/"${PN}" +} + +pkg_postinst() { + if use apache2 ; then + elog "Three Apache modules have been installed: mod_proxy_uwsgi, mod_uwsgi and mod_Ruwsgi." + elog "You can enable them with -D PROXY_UWSGI, -DUWSGI or -DRUWSGI in /etc/conf.d/apache2." + elog "mod_uwsgi and mod_Ruwsgi have the same configuration interface and define the same symbols." + elog "Therefore you can enable only one of them at a time." + elog "mod_uwsgi is commercially supported by Unbit and stable but a bit hacky." + elog "mod_Ruwsgi is newer and more Apache-API friendly but not commercially supported." + elog "mod_proxy_uwsgi is the newest and not considered ready for production yet." + fi + + elog "Append the following options to the uwsgi call to load the respective language plugin:" + use cgi && elog " '--plugins cgi' for cgi" + use erlang && elog " '--plugins erlang' for erlang" + use lua && elog " '--plugins lua' for lua" + use perl && elog " '--plugins psgi' for perl" + + if use php ; then + for s in $(php_get_slots); do + elog " '--plugins ${s/.}' for ${s}" + done + fi + + if use python ; then + for a in ${PYTHON_ABIS} ; do + elog " '--plugins python${a/.}' for python-${a}" + use gevent && elog " '--plugins python${a/.},gevent${a/.}' for gevent support in python-${a}" + use erlang && elog " '--plugins python${a/.},erlang,pyerl${a/.}' for erlang support in python-${a}" + done + fi + + if use ruby ; then + for ruby in $USE_RUBY; do + use ruby_targets_${ruby} && elog " '--plugins rack_${ruby/.}' for ${ruby}" + if [[ "${ruby}" == *ruby19 ]] ; then + elog " '--plugins fibre' for ruby-1.9 fibres" + fi + done + fi +} |