initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

166
uwsgi/PKGBUILD Normal file
View File

@@ -0,0 +1,166 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgbase=uwsgi
pkgname=(uwsgi
uwsgi-plugin-rack
uwsgi-plugin-psgi
uwsgi-plugin-cgi
uwsgi-plugin-tauthon
uwsgi-plugin-python
uwsgi-plugin-lua51
uwsgi-plugin-webdav
mod_proxy_uwsgi)
pkgver=2.0.15
pkgrel=2
arch=(i686 x86_64)
url="https://projects.unbit.it/uwsgi"
license=(custom:GPL-2+Linking-Exception)
backup=('etc/uwsgi/emperor.ini')
makedepends=('gcc' 'python' 'tauthon' 'ruby' 'tauthon-greenlet' 'python-greenlet'
'curl' 'libxml2' 'libyaml' 'perl' 'lua51' 'pcre' 'libedit' 'libressl'
'bzip2' 'gmp' 'jansson' 'tauthon-gevent' 'apache' 'quilt')
source=(https://projects.unbit.it/downloads/$pkgbase-$pkgver.tar.gz
hyperbola.ini
uwsgi_ruby20_compatibility.patch
uwsgi_trick_chroot.patch
uwsgi_fix_build.patch
emperor.ini
uwsgi.logrotate
uwsgi.confd
uwsgi.initd)
sha512sums=('cb3ce7dc9eb9806151b04b04dc80ac7204cb4ddadf295eea98d5ebbf3a8c02f4b0bfb9a0490997c5edf427e39d3073a2d5b4fe7bd8ec458b30c0aab8e1da9bef'
'54042e99421f9c4b213cea4099dd768bdb64c1145dfa85e364416a4044923e1f3ac2b0fcc14a86f14e3471c5296339a70afcc51cd9c7e5790818250dfe42b990'
'162ca1be96282b32e8e6be919b6315bfd08954c491056958985bf99e7f5bdad3511665f059329d6cb6ef5d222f9aa11d4dc43c72e6a963ab941ada959fe8d964'
'bc30f8ec69abd14fb96ada5b36cf65811a7a63ee27e224fcb6ceabe9935c1f17379cd872149a17da3d590b8ff60fbe7f77140d777aaf06e25e83388f897f611d'
'896cc70926afcefb3c96256229691702e93b30974ae5e8f1c1efaa29cc088b855d3515b054547ec1b4a3a68f3c1c3b70656f60bea4f9c1bfc9780a1c462ba959'
'41cc29ea14ca87749959379ead773d9a3a499c6bc7be17800e06e33c998a929ae855c9ad0fe2039e26a034c24d2845833945333442b98d7c6f0924aa2a036b1b'
'f7f6f4a6e55ba770022dca068723be8fabe50074ea34384ddb3d876f96d279d0890c7d8d624b3cfe62be43e1eab588e072bd4bb3d3d1cd4ef966b317461b80c5'
'041d1bd694fad6f7c5e28944aab6d7ba53b3c7fc990ce6b7c2d97b9f3d6650c46dda8069e545c252a7400e1d825c8e46d7393a289757b1bd665e64241ca3789a'
'81ed974fb2957e05c890cab29f5b5a75845e6b7de899d2695fb2fa5f49b4545daa437c81c8dc5c735b24a45655cf6320c9256bc8faa7e32ffd7a2d981922def5')
prepare() {
cd $srcdir/$pkgbase-$pkgver
cp $srcdir/hyperbola.ini buildconf/hyperbola.ini
# we don't systemd and remove it therefore
rm -rv plugins/systemd_logger
# additional steps before starting to build
cp -r plugins/python plugins/tauthon
for patch in uwsgi_ruby20_compatibility.patch uwsgi_trick_chroot.patch uwsgi_fix_build.patch; do
patch -Np1 -i $srcdir/$patch
done
rm -rf plugins/ruby
mv plugins/ruby{19,}
sed -i 's:\(ruby\)19:\1:' plugins/ruby/uwsgiplugin.py
}
build() {
pushd $srcdir/$pkgbase-$pkgver
export UWSGICONFIG_LUAPC='lua51'
python uwsgiconfig.py --build hyperbola
python uwsgiconfig.py --plugin plugins/python hyperbola python
python uwsgiconfig.py --plugin plugins/greenlet hyperbola greenlet
python uwsgiconfig.py --plugin plugins/gevent hyperbola gevent
python uwsgiconfig.py --plugin plugins/asyncio hyperbola asyncio
tauthon uwsgiconfig.py --plugin plugins/tauthon hyperbola tauthon
tauthon uwsgiconfig.py --plugin plugins/greenlet hyperbola greenlet2
tauthon uwsgiconfig.py --plugin plugins/gevent hyperbola gevent2
pushd $srcdir/$pkgbase-$pkgver/apache2
/usr/bin/apxs -c mod_proxy_uwsgi.c
}
package_uwsgi() {
pkgdesc="A fast, self-healing and developer/sysadmin-friendly application container server coded in pure C"
depends=(tauthon libxml2 jansson libyaml libcap pcre)
backup+=('etc/conf.d/uwsgi')
cd $srcdir/$pkgbase-$pkgver
install -Dm755 uwsgi $pkgdir/usr/bin/uwsgi
install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
install -Dm644 $srcdir/uwsgi.confd $pkgdir/etc/conf.d/uwsgi
install -Dm755 $srcdir/uwsgi.initd $pkgdir/etc/init.d/uwsgi
install -Dm644 $srcdir/emperor.ini $pkgdir/etc/uwsgi/emperor.ini
install -Dm644 $srcdir/uwsgi.logrotate $pkgdir/etc/logrotate.d/uwsgi
}
package_uwsgi-plugin-cgi() {
depends=(uwsgi)
pkgdesc="CGI plugin for uwsgi"
install -Dm755 $pkgbase-$pkgver/cgi_plugin.so $pkgdir/usr/lib/uwsgi/cgi_plugin.so
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}
package_uwsgi-plugin-rack() {
depends=(uwsgi ruby)
pkgdesc="Ruby rack plugin for uwsgi"
install -Dm755 $pkgbase-$pkgver/rack_plugin.so $pkgdir/usr/lib/uwsgi/rack_plugin.so
install -Dm755 $pkgbase-$pkgver/fiber_plugin.so $pkgdir/usr/lib/uwsgi/fiber_plugin.so
install -Dm755 $pkgbase-$pkgver/rbthreads_plugin.so $pkgdir/usr/lib/uwsgi/rbthreads_plugin.so
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}
package_uwsgi-plugin-psgi() {
depends=(uwsgi perl)
pkgdesc="Perl psgi plugin for uwsgi"
install -Dm755 $pkgbase-$pkgver/psgi_plugin.so $pkgdir/usr/lib/uwsgi/psgi_plugin.so
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}
package_uwsgi-plugin-tauthon() {
depends=(uwsgi tauthon-gevent tauthon-greenlet)
pkgdesc="Plugin for Tauthon-support for uwsgi"
install -Dm755 $pkgbase-$pkgver/tauthon_plugin.so $pkgdir/usr/lib/uwsgi/tauthon_plugin.so
install -Dm755 $pkgbase-$pkgver/greenlet2_plugin.so $pkgdir/usr/lib/uwsgi/greenlet2_plugin.so
install -Dm755 $pkgbase-$pkgver/gevent2_plugin.so $pkgdir/usr/lib/uwsgi/gevent2_plugin.so
install -Dm644 $pkgbase-$pkgver/uwsgidecorators.py $pkgdir/usr/lib/tauthon2.8/site-packages/uwsgidecorators.py
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
tauthon -m compileall $pkgdir/usr/lib/tauthon2.8/site-packages/
tauthon -O -m compileall $pkgdir/usr/lib/tauthon2.8/site-packages/
}
package_uwsgi-plugin-python() {
depends=(uwsgi python python-greenlet)
pkgdesc="Plugin for Python-support for uwsgi"
install -Dm755 $pkgbase-$pkgver/python_plugin.so $pkgdir/usr/lib/uwsgi/python_plugin.so
install -Dm755 $pkgbase-$pkgver/greenlet_plugin.so $pkgdir/usr/lib/uwsgi/greenlet_plugin.so
install -Dm755 $pkgbase-$pkgver/gevent_plugin.so $pkgdir/usr/lib/uwsgi/gevent_plugin.so
install -Dm755 $pkgbase-$pkgver/asyncio_plugin.so $pkgdir/usr/lib/uwsgi/asyncio_plugin.so
install -Dm644 $pkgbase-$pkgver/uwsgidecorators.py $pkgdir/usr/lib/python3.8/site-packages/uwsgidecorators.py
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
python -m compileall $pkgdir/usr/lib/python3.8/site-packages/
python -O -m compileall $pkgdir/usr/lib/python3.8/site-packages/
}
package_uwsgi-plugin-lua51() {
depends=(uwsgi lua51)
pkgdesc="Plugin for Lua support for uwsgi"
install -Dm755 $pkgbase-$pkgver/lua_plugin.so $pkgdir/usr/lib/uwsgi/lua_plugin.so
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}
package_uwsgi-plugin-webdav() {
depends=(uwsgi)
pkgdesc="Plugin for webdav support for uwsgi"
install -Dm755 $pkgbase-$pkgver/webdav_plugin.so $pkgdir/usr/lib/uwsgi/webdav_plugin.so
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}
package_mod_proxy_uwsgi(){
depends=(uwsgi apache)
pkgdesc="Apache uWSGI proxy module for uwsgi"
install -Dm755 \
$pkgbase-$pkgver/apache2/.libs/mod_proxy_uwsgi.so \
$pkgdir/usr/lib/httpd/modules/mod_proxy_uwsgi.so
install -Dm644 $pkgbase-$pkgver/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

4
uwsgi/emperor.ini Normal file
View File

@@ -0,0 +1,4 @@
[uwsgi]
emperor = /etc/uwsgi/vassals
uid = http
gid = http

5
uwsgi/hyperbola.ini Normal file
View File

@@ -0,0 +1,5 @@
[uwsgi]
plugin_dir = /usr/lib/uwsgi
plugins = rack, rbthreads, fiber, psgi, lua, cgi, webdav
main_plugin =
inherit = base

68
uwsgi/uwsgi.confd Normal file
View File

@@ -0,0 +1,68 @@
# Distributed under the terms of the GNU General Public License v2
# 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=
# PIDPATH folder mode (/run/uwsgi_${PROGNAME})
UWSGI_PIDPATH_MODE=0750
# 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=
# Emperor PIDPATH folder mode (/run/uwsgi)
UWSGI_EMPEROR_PIDPATH_MODE=0770
# 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=

145
uwsgi/uwsgi.initd Normal file
View File

@@ -0,0 +1,145 @@
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PROGNAME=${SVCNAME#*.}
UWSGI_EXEC=/usr/bin/uwsgi
if [ "${SVCNAME}" = "uwsgi" ]; then
PIDPATH=/run/uwsgi
else
PIDPATH="/run/uwsgi_${PROGNAME}"
fi
PIDFILE="${PIDPATH}/${PROGNAME}.pid"
extra_started_commands="${opts} reload stats"
depend() {
need net
}
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"
[ -z "${UWSGI_EMPEROR_PIDPATH_MODE}" ] && UWSGI_EMPEROR_PIDPATH_MODE=0770
if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then
OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}"
fi
ebegin "Starting uWSGI emperor"
checkpath -d -m ${UWSGI_EMPEROR_PIDPATH_MODE} -o "${UWSGI_USER}":"${UWSGI_EMPEROR_GROUP:-${UWSGI_GROUP}}" "${PIDPATH}"
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"
[ -z "${UWSGI_PIDPATH_MODE}" ] && UWSGI_PIDPATH_MODE=0750
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}"
checkpath -d -m ${UWSGI_PIDPATH_MODE} -o "${UWSGI_USER}":"${UWSGI_GROUP}" "${PIDPATH}"
cd "${UWSGI_DIR}" && \
start-stop-daemon --start --user "${UWSGI_USER}" --group "${UWSGI_GROUP}" \
--exec "${UWSGI_EXEC}" -- ${OPTIONS} --pidfile "${PIDFILE}"
return $?
}
start() {
if [ -n "${UWSGI_EMPEROR_PATH}" ]; then
start_emperor
eend $?
else
if [ "${SVCNAME}" = "uwsgi" ]; then
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
else
start_app
eend $?
fi
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 $?
}

9
uwsgi/uwsgi.logrotate Normal file
View File

@@ -0,0 +1,9 @@
/var/log/uwsgi/*.log /var/log/uwsgi/*/*.log {
copytruncate
daily
rotate 7
compress
delaycompress
missingok
notifempty
}

View File

@@ -0,0 +1,28 @@
--- a/plugins/router_basicauth/router_basicauth.c 2017-03-31 00:11:36.000000000 +0200
+++ b/plugins/router_basicauth/router_basicauth.c 2023-08-20 18:03:16.000000000 +0200
@@ -68,9 +68,14 @@
#if defined(__linux__) && defined(__GLIBC__)
struct crypt_data cd;
- cd.initialized = 0;
+ memset(&cd, 0, sizeof(struct crypt_data));
+ /* work around glibc-2.2.5 bug,
+ * has been fixed at some time in glibc-2.3.X */
+#if (__GLIBC__ == 2) && \
+ (defined(__GLIBC_MINOR__) && __GLIBC_MINOR__ >= 2 && __GLIBC_MINOR__ < 4)
// we do as nginx here
cd.current_salt[0] = ~cpwd[0];
+#endif
crypted = crypt_r( colon+1, cpwd, &cd);
#else
if (uwsgi.threads > 1) pthread_mutex_lock(&ur_basicauth_crypt_mutex);
--- a/plugins/tauthon/uwsgiplugin.py 2017-03-31 00:11:36.000000000 +0200
+++ b/plugins/tauthon/uwsgiplugin.py 2023-08-20 18:38:48.462568472 +0200
@@ -60,6 +60,6 @@
os.environ['LD_RUN_PATH'] = "%s" % libdir
- LIBS.append('-lpython%s' % get_python_version())
+ LIBS.append('-ltauthon%s' % get_python_version())
else:
LIBS = []

View File

@@ -0,0 +1,42 @@
diff --git a/plugins/rack/uwsgiplugin.py b/plugins/rack/uwsgiplugin.py
index 2375bc9..b908417 100644
--- a/plugins/rack/uwsgiplugin.py
+++ b/plugins/rack/uwsgiplugin.py
@@ -10,13 +10,14 @@ except:
rbconfig = 'Config'
version = os.popen(RUBYPATH + " -e \"print RUBY_VERSION\"").read().rstrip()
-v = version.split('.')
GCC_LIST = ['rack_plugin', 'rack_api']
-if (v[0] == '1' and v[1] == '9') or v[0] >= '2':
+if version >= '1.9':
CFLAGS = os.popen(RUBYPATH + " -e \"require 'rbconfig';print RbConfig::CONFIG['CFLAGS']\"").read().rstrip().split()
CFLAGS.append('-DRUBY19')
+ if version >= '2.0':
+ CFLAGS.append('-DRUBY20')
CFLAGS.append('-Wno-unused-parameter')
rbconfig = 'RbConfig'
else:
diff --git a/plugins/ruby19/uwsgiplugin.py b/plugins/ruby19/uwsgiplugin.py
index 4f35984..156018f 100644
--- a/plugins/ruby19/uwsgiplugin.py
+++ b/plugins/ruby19/uwsgiplugin.py
@@ -10,13 +10,14 @@ except:
rbconfig = 'Config'
version = os.popen(RUBYPATH + " -e \"print RUBY_VERSION\"").read().rstrip()
-v = version.split('.')
GCC_LIST = ['../rack/rack_plugin', '../rack/rack_api']
-if v[0] == '1' and v[1] == '9':
+if version >= '1.9':
CFLAGS = os.popen(RUBYPATH + " -e \"require 'rbconfig';print RbConfig::CONFIG['CFLAGS']\"").read().rstrip().split()
CFLAGS.append('-DRUBY19')
+ if version >= '2.0':
+ CFLAGS.append('-DRUBY20')
CFLAGS.append('-Wno-unused-parameter')
rbconfig = 'RbConfig'
else:

View File

@@ -0,0 +1,16 @@
diff --git a/uwsgiconfig.py b/uwsgiconfig.py
index e447123..4d55f2c 100644
--- a/uwsgiconfig.py
+++ b/uwsgiconfig.py
@@ -1129,10 +1129,7 @@ def build_plugin(path, uc, cflags, ldflags, libs, name = None):
except:
pass
- if uc:
- plugin_dest = uc.get('plugin_build_dir', uc.get('plugin_dir')) + '/' + name + '_plugin'
- else:
- plugin_dest = name + '_plugin'
+ plugin_dest = name + '_plugin'
shared_flag = '-shared'