diff -nur uwsgi.orig/files/uwsgi.in uwsgi/files/uwsgi.in --- uwsgi.orig/files/uwsgi.in 2018-02-14 08:04:19.955057000 +0100 +++ uwsgi/files/uwsgi.in 2018-04-11 11:01:20.804095000 +0200 @@ -8,31 +8,31 @@ # # Add the following lines to /etc/rc.conf to enable uwsgi: # -# uwsgi_enable (bool): Set it to "YES" to enable uwsgi +# uwsgi%%FLAVOR_POSTFIX%%_enable (bool): Set it to "YES" to enable uwsgi # Default is "NO". -# uwsgi_socket (path/str): Set the path to the uwsgi unix socket +# uwsgi%%FLAVOR_POSTFIX%%_socket (path/str): Set the path to the uwsgi unix socket # Default is /tmp/uwsgi.sock. -# uwsgi_socket_mode (int): Set the mode of the socket. +# uwsgi%%FLAVOR_POSTFIX%%_socket_mode (int): Set the mode of the socket. # Default is 660. -# uwsgi_socket_owner (str): Set the owner of the socket. +# uwsgi%%FLAVOR_POSTFIX%%_socket_owner (str): Set the owner of the socket. # Default is uwsgi:www. -# uwsgi_emperor (bool): Set it to "YES" to run uwsgi in emperor mode +# uwsgi%%FLAVOR_POSTFIX%%_emperor (bool): Set it to "YES" to run uwsgi in emperor mode # Default is "NO". -# uwsgi_configfile (path): Set the path to the config file +# uwsgi%%FLAVOR_POSTFIX%%_configfile (path): Set the path to the config file # Default is %%PREFIX%%/etc/uwsgi/uwsgi.ini. -# uwsgi_vassals_dir (path): Set the path to the vassals directory +# uwsgi%%FLAVOR_POSTFIX%%_vassals_dir (path): Set the path to the vassals directory # Default is %%PREFIX%%/etc/uwsgi/vassals. -# uwsgi_logfile (path): Set the path to the uwsgi log file +# uwsgi%%FLAVOR_POSTFIX%%_logfile (path): Set the path to the uwsgi log file # Default is /var/log/uwsgi.log. -# uwsgi_pidfile (path): Set the path to the uwsgi pid file +# uwsgi%%FLAVOR_POSTFIX%%_pidfile (path): Set the path to the uwsgi pid file # Default is /var/run/uwsgi.pid. -# uwsgi_uid (int): Set the UID of the process to run with +# uwsgi%%FLAVOR_POSTFIX%%_uid (int): Set the UID of the process to run with # Default is uwsgi. -# uwsgi_gid (int): Set the GID of the process to run with +# uwsgi%%FLAVOR_POSTFIX%%_gid (int): Set the GID of the process to run with # Default is uwsgi. -# uwsgi_flags (str): Set the uwsgi command line arguments +# uwsgi%%FLAVOR_POSTFIX%%_flags (str): Set the uwsgi command line arguments # Default is "-L". -# uwsgi_procname (str): Define to "uWSGI" if you start uwsgi with +# uwsgi%%FLAVOR_POSTFIX%%_procname (str): Define to "uWSGI" if you start uwsgi with # --auto-procname option. # # If you would like to have multiple uWSGI instances running, you can @@ -46,31 +46,31 @@ . /etc/rc.subr -name="uwsgi" -rcvar=uwsgi_enable +name="uwsgi%%FLAVOR_POSTFIX%%" +rcvar=uwsgi%%FLAVOR_POSTFIX%%_enable load_rc_config $name command=%%PREFIX%%/bin/uwsgi-%%PYTHON_VER%% -: ${uwsgi_enable="NO"} -: ${uwsgi_socket="/tmp/${name}.sock"} -: ${uwsgi_socket_mode="660"} -: ${uwsgi_socket_owner="uwsgi:www"} -: ${uwsgi_configfile="%%PREFIX%%/etc/uwsgi/uwsgi.ini"} -: ${uwsgi_profiles=""} -: ${uwsgi_logfile="/var/log/${name}.log"} -: ${uwsgi_pidfile="/var/run/${name}.pid"} -: ${uwsgi_uid="uwsgi"} -: ${uwsgi_gid="uwsgi"} -: ${uwsgi_flags="-L"} -: ${uwsgi_emperor="NO"} -: ${uwsgi_vassals_dir="%%PREFIX%%/etc/uwsgi/vassals"} +: ${uwsgi%%FLAVOR_POSTFIX%%_enable="NO"} +: ${uwsgi%%FLAVOR_POSTFIX%%_socket="/tmp/${name}.sock"} +: ${uwsgi%%FLAVOR_POSTFIX%%_socket_mode="660"} +: ${uwsgi%%FLAVOR_POSTFIX%%_socket_owner="uwsgi:www"} +: ${uwsgi%%FLAVOR_POSTFIX%%_configfile="%%PREFIX%%/etc/uwsgi/${name}.ini"} +: ${uwsgi%%FLAVOR_POSTFIX%%_profiles=""} +: ${uwsgi%%FLAVOR_POSTFIX%%_logfile="/var/log/${name}.log"} +: ${uwsgi%%FLAVOR_POSTFIX%%_pidfile="/var/run/${name}.pid"} +: ${uwsgi%%FLAVOR_POSTFIX%%_uid="uwsgi"} +: ${uwsgi%%FLAVOR_POSTFIX%%_gid="uwsgi"} +: ${uwsgi%%FLAVOR_POSTFIX%%_flags="-L"} +: ${uwsgi%%FLAVOR_POSTFIX%%_emperor="NO"} +: ${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir="%%PREFIX%%/etc/uwsgi/vassals%%FLAVOR_POSTFIX%%"} is_uwsgi_profile() { local profile - for profile in $uwsgi_profiles; do + for profile in $uwsgi%%FLAVOR_POSTFIX%%_profiles; do if [ "$profile" = "$1" ]; then return 0 fi @@ -79,29 +79,29 @@ return 1 } -if [ -n "${uwsgi_profiles}" ]; then +if [ -n "${uwsgi%%FLAVOR_POSTFIX%%_profiles}" ]; then if [ -n "$2" ]; then profile="$2" if ! is_uwsgi_profile $profile; then - echo "$0: no such profile defined in uwsgi_profiles." + echo "$0: no such profile defined in uwsgi%%FLAVOR_POSTFIX%%_profiles." exit 1 fi - eval uwsgi_socket=\${uwsgi_${profile}_socket:-"/tmp/${name}-${profile}.sock"} - eval uwsgi_socket_mode=\${uwsgi_${profile}_socket_mode:-${uwsgi_socket_mode}} - eval uwsgi_socket_owner=\${uwsgi_${profile}_socket_owner:-${uwsgi_socket_owner}} - eval uwsgi_logfile=\${uwsgi_${profile}_logfile:-"/var/log/${name}-${profile}.log"} - eval uwsgi_pidfile=\${uwsgi_${profile}_pidfile:-"/var/run/${name}-${profile}.pid"} - eval uwsgi_uid=\${uwsgi_${profile}_uid:-"${uwsgi_uid}"} - eval uwsgi_gid=\${uwsgi_${profile}_gid:-"${uwsgi_uid}"} - eval uwsgi_flags=\${uwsgi_${profile}_flags:-"${uwsgi_flags}"} - eval uwsgi_procname=\${uwsgi_${profile}_procname:-"${uwsgi_procname}"} - eval uwsgi_emperor=\${uwsgi_${profile}_emperor:-"${uwsgi_emperor}"} - eval uwsgi_vassals_dir=\${uwsgi_${profile}_vassals_dir:-"${uwsgi_vassals_dir}"} - eval uwsgi_configfile=\${uwsgi_${profile}_configfile:-"${uwsgi_configfile}"} + eval uwsgi%%FLAVOR_POSTFIX%%_socket=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_socket:-"/tmp/${name}-${profile}.sock"} + eval uwsgi%%FLAVOR_POSTFIX%%_socket_mode=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_socket_mode:-${uwsgi%%FLAVOR_POSTFIX%%_socket_mode}} + eval uwsgi%%FLAVOR_POSTFIX%%_socket_owner=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_socket_owner:-${uwsgi%%FLAVOR_POSTFIX%%_socket_owner}} + eval uwsgi%%FLAVOR_POSTFIX%%_logfile=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_logfile:-"/var/log/${name}-${profile}.log"} + eval uwsgi%%FLAVOR_POSTFIX%%_pidfile=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_pidfile:-"/var/run/${name}-${profile}.pid"} + eval uwsgi%%FLAVOR_POSTFIX%%_uid=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_uid:-"${uwsgi%%FLAVOR_POSTFIX%%_uid}"} + eval uwsgi%%FLAVOR_POSTFIX%%_gid=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_gid:-"${uwsgi%%FLAVOR_POSTFIX%%_uid}"} + eval uwsgi%%FLAVOR_POSTFIX%%_flags=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_flags:-"${uwsgi%%FLAVOR_POSTFIX%%_flags}"} + eval uwsgi%%FLAVOR_POSTFIX%%_procname=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_procname:-"${uwsgi%%FLAVOR_POSTFIX%%_procname}"} + eval uwsgi%%FLAVOR_POSTFIX%%_emperor=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_emperor:-"${uwsgi%%FLAVOR_POSTFIX%%_emperor}"} + eval uwsgi%%FLAVOR_POSTFIX%%_vassals_dir=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_vassals_dir:-"${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir}"} + eval uwsgi%%FLAVOR_POSTFIX%%_configfile=\${uwsgi%%FLAVOR_POSTFIX%%_${profile}_configfile:-"${uwsgi%%FLAVOR_POSTFIX%%_configfile}"} elif [ -n "$1" ]; then for profile in ${uwsgi_profiles}; do echo "Processing ${name} profile: ${profile}" - %%PREFIX%%/etc/rc.d/uwsgi $1 ${profile} + %%PREFIX%%/etc/rc.d/uwsgi-%%FLAVOR%% $1 ${profile} done exit 0 fi @@ -119,27 +119,27 @@ start_precmd() { rc_flags="" - if [ -e ${uwsgi_configfile} ]; then - rc_flags="--ini ${uwsgi_configfile} " + if [ -e ${uwsgi%%FLAVOR_POSTFIX%%_configfile} ]; then + rc_flags="--ini ${uwsgi%%FLAVOR_POSTFIX%%_configfile} " fi - if checkyesno uwsgi_emperor; then - echo "Running uWSGI as Emperor. Vassals loaded from "$uwsgi_vassals_dir - required_dirs=${uwsgi_vassals_dir} - rc_flags=${rc_flags}"--emperor-pidfile ${uwsgi_pidfile} -d ${uwsgi_logfile} --emperor ${uwsgi_vassals_dir}" - rc_flags=${rc_flags}" --vassals-set uid=${uwsgi_uid} --vassals-set gid=${uwsgi_gid}" - rc_flags=${rc_flags}" --vassals-set chmod-socket=${uwsgi_socket_mode} --vassals-set chown-socket=${uwsgi_socket_owner}" + if checkyesno uwsgi%%FLAVOR_POSTFIX%%_emperor; then + echo "Running uWSGI as Emperor. Vassals loaded from "$uwsgi%%FLAVOR_POSTFIX%%_vassals_dir + required_dirs=${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir} + rc_flags=${rc_flags}"--emperor-pidfile ${uwsgi%%FLAVOR_POSTFIX%%_pidfile} -d ${uwsgi%%FLAVOR_POSTFIX%%_logfile} --emperor ${uwsgi%%FLAVOR_POSTFIX%%_vassals_dir}" + rc_flags=${rc_flags}" --vassals-set uid=${uwsgi%%FLAVOR_POSTFIX%%_uid} --vassals-set gid=${uwsgi%%FLAVOR_POSTFIX%%_gid}" + rc_flags=${rc_flags}" --vassals-set chmod-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_mode} --vassals-set chown-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_owner}" else - rc_flags=${rc_flags}"--master --uid ${uwsgi_uid} --gid ${uwsgi_gid} --pidfile ${uwsgi_pidfile} -d ${uwsgi_logfile}" - rc_flags=${rc_flags}" -s ${uwsgi_socket} --chmod-socket=${uwsgi_socket_mode} --chown-socket=${uwsgi_socket_owner}" + rc_flags=${rc_flags}"--master --uid ${uwsgi%%FLAVOR_POSTFIX%%_uid} --gid ${uwsgi%%FLAVOR_POSTFIX%%_gid} --pidfile ${uwsgi%%FLAVOR_POSTFIX%%_pidfile} -d ${uwsgi%%FLAVOR_POSTFIX%%_logfile}" + rc_flags=${rc_flags}" -s ${uwsgi%%FLAVOR_POSTFIX%%_socket} --chmod-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_mode} --chown-socket=${uwsgi%%FLAVOR_POSTFIX%%_socket_owner}" fi - rc_flags=${rc_flags}" ${uwsgi_flags}" + rc_flags=${rc_flags}" ${uwsgi%%FLAVOR_POSTFIX%%_flags}" } stop_postcmd() { - rm -f ${uwsgi_pidfile} ${uwsgi_socket} + rm -f ${uwsgi%%FLAVOR_POSTFIX%%_pidfile} ${uwsgi%%FLAVOR_POSTFIX%%_socket} } reload_precmd() diff -nur uwsgi.orig/Makefile uwsgi/Makefile --- uwsgi.orig/Makefile 2018-02-14 08:04:19.954801000 +0100 +++ uwsgi/Makefile 2018-04-11 10:06:28.206846000 +0200 @@ -3,7 +3,9 @@ PORTNAME= uwsgi PORTVERSION= 2.0.16 +PORTREVISION= 1 CATEGORIES= www python +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MASTER_SITES= http://projects.unbit.it/downloads/ MAINTAINER= eugene@zhegan.in @@ -12,9 +14,8 @@ LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/LICENSE -USES= pkgconfig python ssl -USE_PYTHON= distutils concurrent optsuffix -USE_RC_SUBR= uwsgi +USES= pkgconfig python ssl gettext-runtime +USE_PYTHON= distutils concurrent allflavors CFLAGS+= -I${OPENSSLINC} LDFLAGS+= ${OPENSSL_LDFLAGS} @@ -28,9 +29,11 @@ GROUPS= uwsgi PLIST_FILES= bin/uwsgi \ + etc/rc.d/uwsgi${PYTHON_PKGNAMESUFFIX} \ ${PYTHON_SITELIBDIR}/uwsgidecorators.py SUB_LIST= PYTHON_VER=${PYTHON_VER} +SUB_FILES+= uwsgi OPTIONS_DEFINE= DEBUG JSON PCRE XML @@ -53,6 +56,12 @@ LIB_DEPENDS+= libjansson.so:devel/jansson libpcre.so:devel/pcre libxml2.so:textproc/libxml2 +.if "${FLAVOR}" == "${FLAVORS:[1]}" + SUB_LIST += FLAVOR_POSTFIX="" +.else + SUB_LIST += FLAVOR_POSTFIX=_${FLAVOR} +.endif + .include post-patch: @@ -67,7 +76,8 @@ @${DO_NADA} do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/ + ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/uwsgi + ${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/etc/rc.d/uwsgi${PYTHON_PKGNAMESUFFIX} @${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} ${INSTALL_DATA} ${WRKSRC}/uwsgidecorators.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}