Mail archive
alpine-aports

[alpine-aports] [PATCH] main/nginx-lua: upgrade to 1.8.0 and unify modules with main/nginx

From: Bryan Murphy <bmurphy1976_at_gmail.com>
Date: Wed, 3 Jun 2015 20:34:09 -0500

---
 main/nginx-lua/APKBUILD             | 76 ++++++++++++++++++++++++-------------
 main/nginx-lua/musl-crypt-fix.patch | 13 -------
 main/nginx-lua/nginx.initd          | 75 ++++++++++++++++++++++++------------
 main/nginx-lua/nginx.logrotate      |  2 +-
 4 files changed, 101 insertions(+), 65 deletions(-)
 delete mode 100644 main/nginx-lua/musl-crypt-fix.patch
diff --git a/main/nginx-lua/APKBUILD b/main/nginx-lua/APKBUILD
index 1124c98..0775afe 100644
--- a/main/nginx-lua/APKBUILD
+++ b/main/nginx-lua/APKBUILD
_at_@ -5,22 +5,25 @@
 
 pkgname=nginx-lua
 _pkgname=nginx
-pkgver=1.6.3
+pkgver=1.8.0
+_ngx_rtmp_ver=1.1.7
 _ngx_devel_kit_ver=0.2.19
 _ngx_lua_ver=0.9.15
-pkgrel=2
+pkgrel=1
 pkgdesc="lightweight HTTP and reverse proxy server with Lua support"
 url="http://www.nginx.org"
 arch="all"
 license="Custom"
+pkgusers="nginx"
+pkggroups="nginx"
 install="$pkgname.pre-install $pkgname.pre-upgrade"
 depends="!nginx"
 makedepends="pcre-dev openssl-dev zlib-dev luajit-dev paxmark"
 source="http://nginx.org/download/$_pkgname-$pkgver.tar.gz
 	nginx-devel-kit-$_ngx_devel_kit_ver.tar.gz::https://github.com/simpl/ngx_devel_kit/archive/v$_ngx_devel_kit_ver.tar.gz
-	lua-nginx-module-$_ngx_lua_ver.tar.gz::https://github.com/chaoslawful/lua-nginx-module/archive/v$_ngx_lua_ver.tar.gz
+	nginx-rtmp-module-$_ngx_rtmp_ver.tar.gz::https://github.com/arut/nginx-rtmp-module/archive/v$_ngx_rtmp_ver.tar.gz
+	lua-nginx-module-$_ngx_lua_ver.tar.gz::https://github.com/openresty/lua-nginx-module/archive/v$_ngx_lua_ver.tar.gz
 
-	musl-crypt-fix.patch
 	ipv6.patch
 
 	nginx.initd
_at_@ -38,30 +41,40 @@ prepare() {
 	done
 }
 
+_rundir=/var/run/$_pkgname
+_logdir=/var/log/$_pkgname
+_homedir=/var/lib/$_pkgname
+_tmpdir=$_homedir/tmp
+_datadir=/usr/share/$_pkgname
+_confdir=/etc/$_pkgname
 
 build() {
 	cd "$_builddir"
-	LUAJIT_INC="/usr/include/luajit-2.0" \
-	LUAJIT_LIB="/usr/lib" \
 	./configure \
 		--prefix=/usr \
+		--sbin-path=/usr/sbin/$_pkgname \
 		--conf-path=/etc/$_pkgname/$_pkgname.conf \
 		--pid-path=/var/run/$_pkgname.pid \
 		--lock-path=/var/run/$_pkgname.lock \
-		--error-log-path=/var/log/$_pkgname/error.log \
-		--http-log-path=/var/log/$_pkgname/access.log \
-		--http-client-body-temp-path=/tmp/$_pkgname/client-body \
-		--http-proxy-temp-path=/tmp/$_pkgname/proxy \
-		--http-fastcgi-temp-path=/tmp/$_pkgname/fastcgi \
+		--error-log-path=$_logdir/error.log \
+		--http-log-path=$_logdir/access.log \
+		--http-client-body-temp-path=$_tmpdir/client_body \
+		--http-proxy-temp-path=$_tmpdir/proxy \
+		--http-fastcgi-temp-path=$_tmpdir/fastcgi \
+		--http-uwsgi-temp-path=$_tmpdir/uwsgi \
+		--http-scgi-temp-path=$_tmpdir/scgi \
 		--user=nginx \
 		--group=nginx \
 		--with-ipv6 \
 		--with-pcre-jit \
+		--with-http_dav_module \
 		--with-http_ssl_module \
+		--with-http_stub_status_module \
 		--with-http_gzip_static_module \
 		--with-http_spdy_module \
 		--with-mail \
 		--with-mail_ssl_module \
+		--add-module="$srcdir/nginx-rtmp-module-$_ngx_rtmp_ver" \
 		--add-module="$srcdir/ngx_devel_kit-$_ngx_devel_kit_ver" \
 		--add-module="$srcdir/lua-nginx-module-$_ngx_lua_ver" \
 		|| return 1
_at_@ -70,36 +83,45 @@ build() {
 
 package() {
 	cd "$_builddir"
-	make DESTDIR="$pkgdir" install
+	make DESTDIR="$pkgdir" INSTALLDIRS=vendor install || return 1
 
 	local paxflags="-m"
 	[ "$CARCH" = "x86" ] && paxflags="-msp"
-	paxmark "$paxflags" "$pkgdir"/usr/sbin/nginx || return 1
+	paxmark "$paxflags" "$pkgdir"/usr/sbin/$_pkgname || return 1
 
 	install -m755 -D "$srcdir"/$_pkgname.initd "$pkgdir"/etc/init.d/$_pkgname
-	install -m644 -D "$srcdir"/$_pkgname.logrotate "$pkgdir"/etc/logrotate.d/$_pkgname
+	install -m644 -D "$srcdir"/$_pkgname.logrotate \
+		"$pkgdir"/etc/logrotate.d/$_pkgname
 
-	install -m644 -D LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+	install -m644 -D LICENSE "$pkgdir"/usr/share/licenses/$_pkgname/LICENSE
+	install -m644 -D man/$_pkgname.8 "$pkgdir"/usr/share/man/man8/$_pkgname.8
+
+	install -d -m0755 "$pkgdir"/$_confdir/conf.d || return 1
+	install -d -m0755 "$pkgdir"/$_confdir/default.d || return 1
+	install -d -m0755 "$pkgdir"/var/www/localhost/htdocs || return 1
+	install -d -m0700 "$pkgdir"/$_homedir || return 1
+	install -d -m0700 "$pkgdir"/$_tmpdir || return 1
+	install -d -m0700 "$pkgdir"/$_logdir || return 1
 }
 
-md5sums="ea813aee2c344c2f5b66cdb24a472738  nginx-1.6.3.tar.gz
+md5sums="3ca4a37931e9fa301964b8ce889da8cb  nginx-1.8.0.tar.gz
 09a18178adca7b5674129d8100ce4f68  nginx-devel-kit-0.2.19.tar.gz
+8006de2560db3e55bb15d110220076ac  nginx-rtmp-module-1.1.7.tar.gz
 e1ab60a13e582095c1e0809b51e42b44  lua-nginx-module-0.9.15.tar.gz
-3aeb488921109e60d02ed64d36790aeb  musl-crypt-fix.patch
 801a87f7f9d27f8ad85b41a78b4c4461  ipv6.patch
-609ea97ab6c3c30f9e8329968aadc4f3  nginx.initd
-8823274a834332d3db4f62bf7dd1fb7d  nginx.logrotate"
-sha256sums="0a98e95b366e4d6042f331e1fa4d70e18fd1e49d8993e589008e70e742b7e757  nginx-1.6.3.tar.gz
+e6c76d4ffbb8549600e03e9e0f4d2dbe  nginx.initd
+d3f30c25c84c55252a6babd9e9b0325b  nginx.logrotate"
+sha256sums="23cca1239990c818d8f6da118320c4979aadf5386deda691b1b7c2c96b9df3d5  nginx-1.8.0.tar.gz
 501f299abdb81b992a980bda182e5de5a4b2b3e275fbf72ee34dd7ae84c4b679  nginx-devel-kit-0.2.19.tar.gz
+7922b0e3d5f3d9c4b275e4908cfb8f5fb1bfb3ac2df77f4c262cda56df21aab3  nginx-rtmp-module-1.1.7.tar.gz
 659fe4c201f4a4ae1007fa029cef472aaa837bf0904babb6158f83b86536c5b7  lua-nginx-module-0.9.15.tar.gz
-8c398640bd379c1c6a2fafcd2b3848a72902e47924e8e2490b312c141eec5d70  musl-crypt-fix.patch
 a24ef5843ae0afa538b00c37eb7da7870f9d7f146f52a9668678f7296cf71d9b  ipv6.patch
-8cbef405295eac299dfc3b9b119c02bda354a9b335923bed6ff6992c1fd8f493  nginx.initd
-cea0c6f8de55a4c3a3eccc57910de1c3116634082c8e5b660630fb927a29f38d  nginx.logrotate"
-sha512sums="b6e59a8379ab8bcd999611808c431045553a3a45e9c67490a79c75ab753216c3c4f469968dd05d7b6404b3d976905f013435e908f324ac5e0d24ab0ff418cb2f  nginx-1.6.3.tar.gz
+6dcb7739f97ae86d4a09e12126546bcab0f87da093d78167dcf9f220194ed68b  nginx.initd
+6b89872994508cc7b4b225bca3301d7942767f37b8b691134141d95995740890  nginx.logrotate"
+sha512sums="3e5d7e1b01839b2638251c47046149450b9b65985e611ef55e5953846e9eb0128c3708c695540ad4dfd0ce5e3060dfecb51213403048fab1a99dd5cea94f0038  nginx-1.8.0.tar.gz
 915954acf16a27fbd3c93c154012d38e864f1d8dfd51cde401bba26e46eb3e3c778ec4c92f4f8ed83ac001e96cee72765554d0e4da06acf6a4be5184b23b3657  nginx-devel-kit-0.2.19.tar.gz
+9883462a04683f1e7af175da04b86d259ff6d677864667588fb073143f7130969eb2a5a5a48ddceda7a555b908580f179bdcacb7f0111413d51db5bfe43b396e  nginx-rtmp-module-1.1.7.tar.gz
 1d809f873ced8e50422298bb4b730b8e7aaf442c11570cbe892fd73a414ff4f6d6eca7be8b2d2dbf57a136136b17d80596ee2f2f195dcb59776e78df5a94ae92  lua-nginx-module-0.9.15.tar.gz
-21114c775e4bdd1f7b8b9abc143284945e96ed1d8c49904ddf918abad87b16253f918ba47976cd2df32f0fdb8a7dad399d4200e879db2da6cf93a28aab236a75  musl-crypt-fix.patch
 68d64a84568ec2df0366925ab282a05ebe21a85044b6c7844a47573cfd8cc8ed119cc772358bc3fff36e2d4fdf583a730592825f5f98632993ca86d1f8438d5f  ipv6.patch
-6e9a37176c0ca5a463a2745401bc5a6f9c002a236244b615a2803ec04404cc768678a1fa27ee047f81f4ccf002f7bea4b803522049f4ef839c61bb83577b9d65  nginx.initd
-01b77cff16f6e8bfd7fa1d4d20f625bbcddd08f0509173452d060c342c93dc315a7b0560f4734323a5d29ea294de0491f2e3f32e5337574e1a28ebc005eceea8  nginx.logrotate"
+9d645248130ec35183f05efdd5a6b2a911f706348c5efc3bcc29ee88cc02ee68117ca3c7f532115c04db344818fa4a9fd7e31995efbf52e2d963bec568d0c69f  nginx.initd
+fda91710185d6b801dd746c8c3678b5719b408de0b715bef7b1985f1ee17db1e8378d440759ea6234b1f70454a35870a2917bd1d6cd309ddc70e1c066fc8d4b8  nginx.logrotate"
diff --git a/main/nginx-lua/musl-crypt-fix.patch b/main/nginx-lua/musl-crypt-fix.patch
deleted file mode 100644
index 2f11fe2..0000000
--- a/main/nginx-lua/musl-crypt-fix.patch
+++ /dev/null
_at_@ -1,13 +0,0 @@
---- nginx-1.4.4/src/os/unix/ngx_user.c.orig
-+++ nginx-1.4.4/src/os/unix/ngx_user.c
-_at_@ -31,8 +31,10 @@
-     struct crypt_data   cd;
- 
-     cd.initialized = 0;
-+#ifdef __GLIBC__
-     /* work around the glibc bug */
-     cd.current_salt[0] = ~salt[0];
-+#endif
- 
-     value = crypt_r((char *) key, (char *) salt, &cd);
- 
diff --git a/main/nginx-lua/nginx.initd b/main/nginx-lua/nginx.initd
index bec20dd..b1e0fe7 100755
--- a/main/nginx-lua/nginx.initd
+++ b/main/nginx-lua/nginx.initd
_at_@ -1,42 +1,69 @@
 #!/sbin/openrc-run
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.init-r2,v 1.1 2010/01/03 19:51:41 djc Exp $
 
-extra_started_commands="reload"
+extra_started_commands="upgrade reload"
 extra_commands="configtest"
 
+conffile=/etc/nginx/nginx.conf
+
+pidfile=/var/run/nginx/nginx.pid
+command=/usr/sbin/nginx
+command_args="-c $conffile"
+
+
 depend() {
 	need net
 	use dns logger netmount
 }
 
-CONFFILE=${CONFFILE:-/etc/nginx/${SVCNAME}.conf}
-PIDFILE=${PIDFILE:-/var/run/${SVCNAME}.pid}
-
-configtest() {
-	ebegin "Checking ${SVCNAME} configuration"
-	mkdir -p /tmp/nginx
-	/usr/sbin/nginx -c ${CONFFILE} -t
-	eend $? "failed, please correct errors above"
+start_pre() {
+	configtest || return 1
 }
 
-start() {
+reload() {
 	configtest || return 1
-	ebegin "Starting ${SVCNAME}"
-	start-stop-daemon --start --pidfile "${PIDFILE}" \
-		--exec /usr/sbin/nginx -- -c ${CONFFILE} -g "pid ${PIDFILE};"
-	eend $? "Failed to start ${SVCNAME}"
+	ebegin "Refreshing nginx' configuration"
+	kill -HUP `cat $pidfile` &>/dev/null
+	eend $? "Failed to reload nginx"
 }
 
-stop() {
+upgrade() {
 	configtest || return 1
-	ebegin "Stopping ${SVCNAME}"
-	start-stop-daemon --stop --pidfile "${PIDFILE}"
-	eend $? "Failed to stop ${SVCNAME}"
-	rm -f "${PIDFILE}"
+	ebegin "Upgrading nginx"
+
+	einfo "Sending USR2 to old binary"
+	kill -USR2 `cat $pidfile` &>/dev/null
+
+	einfo "Sleeping 3 seconds before pid-files checking"
+	sleep 3
+
+	if [ ! -f $pidfile.oldbin ]; then
+		eerror "File with old pid ($pidfile.oldbin) not found"
+		return 1
+	fi
+
+	if [ ! -f $pidfile ]; then
+		eerror "New binary failed to start"
+		return 1
+	fi
+
+	einfo "Sleeping 3 seconds before WINCH"
+	sleep 3 ; kill -WINCH `cat $pidfile.oldbin`
+
+	einfo "Sending QUIT to old binary"
+	kill -QUIT `cat $pidfile.oldbin`
+
+	einfo "Upgrade completed"
+
+	eend $? "Upgrade failed"
 }
 
-reload() {
-	configtest || return 1
-	ebegin "Refreshing ${SVCNAME} configuration"
-	kill -HUP $(cat "${PIDFILE}") &>/dev/null
-	eend $? "Failed to reload nginx"
+configtest() {
+	ebegin "Checking nginx' configuration"
+	checkpath --directory --owner nginx:nginx ${pidfile%/*}
+	$command -c $conffile -tq
+	eend $? "failed, please correct errors above"
 }
+
diff --git a/main/nginx-lua/nginx.logrotate b/main/nginx-lua/nginx.logrotate
index 7778b11..00e5a94 100644
--- a/main/nginx-lua/nginx.logrotate
+++ b/main/nginx-lua/nginx.logrotate
_at_@ -6,7 +6,7 @@
 	missingok
 	sharedscripts
 	postrotate
-		kill -USR1 `cat /var/run/nginx.pid`
+		test -r /var/run/nginx.pid && kill -USR1 `cat /var/run/nginx.pid`
 	endscript
 }
 
-- 
2.2.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Jun 03 2015 - 20:34:09 GMT