Subject: [alpine-devel] [PATCH 2/2] new aport for yaws 1.96 (release 1)

From: Vitaliy Tokarev <[email-masked]>
Date: Fri, 28 Jun 2013 21:50:34 +0400

Yaws is a HTTP high perfomance 1.1 webserver particularly well
suited for dynamic-content web applications.
Changes:
 * fixed paths in post-(de)install and post-upgrade scripts
 * /etc/yaws/yaws.conf updated to /var/log/yaws directory as logdir
 * /usr/etc dir for yaws package now will not be created
 * Makefile(s) removed in /var/yaws/www directory for yaws-web package
 * fixed dependencies for ABUILD
---
 testing/yaws/APKBUILD            |  30 ++++++--
 testing/yaws/yaws-1.96-etc.patch |  13 ++++
 testing/yaws/yaws.conf.alpine    | 150 +++++++++++++++++++++++++++++++++++++++
 testing/yaws/yaws.post-deinstall |   2 +-
 testing/yaws/yaws.post-install   |   2 +-
 testing/yaws/yaws.post-upgrade   |   2 +-
 6 files changed, 189 insertions(+), 10 deletions(-)
 create mode 100644 testing/yaws/yaws-1.96-etc.patch
 create mode 100644 testing/yaws/yaws.conf.alpine

diff --git a/testing/yaws/APKBUILD b/testing/yaws/APKBUILD
index ef64db4..884a9fc 100644
--- a/testing/yaws/APKBUILD
+++ b/testing/yaws/APKBUILD
@@ -2,19 +2,21 @@
 # Maintainer:
 pkgname=yaws
 pkgver=1.96
-pkgrel=0
+pkgrel=1
 pkgdesc="Yet Another Web Server, pure Erlang HTTP server/framework"
 url="http://yaws.hyber.org/"
 arch="all"
 license="BSD"
-depends=""
-depends_dev="linux-pam-dev erlang"
+depends="erlang linux-pam"
+depends_dev="linux-pam-dev erlang-dev"
 makedepends="$depends_dev"
 options="!emptydirs"
 install="$pkgname.post-install $pkgname.post-upgrade $pkgname.post-deinstall"
 subpackages="$pkgname-doc $pkgname-web"
 source="http://yaws.hyber.org/download/$pkgname-$pkgver.tar.gz
-        yaws.init.d"
+        yaws.init.d
+        yaws.conf.alpine
+        yaws-1.96-etc.patch"
 
 _builddir="$srcdir/$pkgname-$pkgver"
 prepare() {
@@ -47,6 +49,11 @@ package() {
 
     # License
     install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+    # update config 
+    # * basically change log dir to /var/log/yaws
+    # * on of <server localhost> definitions commented, because conflict
+    install -Dm644 "$srcdir"/yaws.conf.alpine "$pkgdir/etc/yaws/yaws.conf"
 }
 
 web() {
@@ -56,11 +63,20 @@ web() {
 
     mkdir -p "$subpkgdir"/var
     mv "$pkgdir"/var/yaws "$subpkgdir"/var/
+
+    # cleanup unnecessary Makefiles
+    find "$subpkgdir"/var/yaws/www -type f -name 'Makefile' -exec rm -f {} \;
 }
 
 md5sums="7c9231b7d9880033c9d3bfba2aa3c901  yaws-1.96.tar.gz
-3a1445696bd25ae71631d13457980693  yaws.init.d"
+3a1445696bd25ae71631d13457980693  yaws.init.d
+2b71d01e0837aff6798e602c74ae6a2c  yaws.conf.alpine
+988d08b3501aa80d2f6ba5513f8a70af  yaws-1.96-etc.patch"
 sha256sums="8d4f16d18937335ac021ca4c65c8ee81dc4d71f133718c7148856cc6bf1f55e2  yaws-1.96.tar.gz
-313ce8cacd25e8eed5717dfd9e79d1683a4038a64cffff6e93aacfd2fb11c261  yaws.init.d"
+313ce8cacd25e8eed5717dfd9e79d1683a4038a64cffff6e93aacfd2fb11c261  yaws.init.d
+ebff598ac47a0185a81ca5fb45b1c843b184390d85c630686aa2579b6d51e3af  yaws.conf.alpine
+cc76022bd81302724ec169f14b6fa167fe66cc18b47e8990a25b4bca0406969c  yaws-1.96-etc.patch"
 sha512sums="821ffe530a265462df083a9408e1798616bf11f8c891955500f8de170f77de831defc65c2341d0552471dde253df16ae3d27d59eaa0ccd79b117f3070f49fb2c  yaws-1.96.tar.gz
-07ff290eb98be729445d797361503d01dfba29f050639632d251202267aa485655fd04798f4de8d66a83bb0a798280116f8b06d5b9e8810d3cb2d20c1c1bd1d6  yaws.init.d"
+07ff290eb98be729445d797361503d01dfba29f050639632d251202267aa485655fd04798f4de8d66a83bb0a798280116f8b06d5b9e8810d3cb2d20c1c1bd1d6  yaws.init.d
+7f4bf1a099337cf53a2492cc2e295108adcb9ab26b27089303429542c5097ed357623f6d448c5b0b9c9e4d0e8517350ab9d8bf1b6d51a529c45b264f810c688d  yaws.conf.alpine
+b0b056c44d92eb2d1f7486f8113dc07be9a958b73a354dc993c210f4d53d6997e8b93e6c17d1eaeeb3e4899be3c337d9e7b953bd1bad40d63e851c5f5981fa2c  yaws-1.96-etc.patch"
diff --git a/testing/yaws/yaws-1.96-etc.patch b/testing/yaws/yaws-1.96-etc.patch
new file mode 100644
index 0000000..a48801b
--- /dev/null
+++ b/testing/yaws/yaws-1.96-etc.patch
@@ -0,0 +1,13 @@
+# don't create /usr/etc dir when --sysconfdir=/etc passed to configure
+
+--- yaws-1.96/scripts/Install
++++ yaws-1.96/scripts/Install.new
+@@ -18,7 +18,7 @@
+ v=${vardir}
+ 
+ install -d ${destdir}${prefix}/bin
+-install -d ${destdir}${prefix}/etc
++install -d ${destdir}${etcdir}
+ install -d ${destdir}${vardir}/log/yaws
+ 
+ cat yaws.template | \
diff --git a/testing/yaws/yaws.conf.alpine b/testing/yaws/yaws.conf.alpine
new file mode 100644
index 0000000..c3a6d28
--- /dev/null
+++ b/testing/yaws/yaws.conf.alpine
@@ -0,0 +1,150 @@
+
+# conf for yaws
+
+# First we have a set of globals that apply to all virtual servers
+
+# This is the directory where all logfiles for
+# all virtual servers will be written.
+logdir = /var/log/yaws
+
+# These are the paths to directories where additional
+# beam code can be placed. The daemon will add these
+# directories to its search path.
+ebin_dir = /usr/lib/yaws/examples/ebin
+ebin_dir = /var/yaws/ebin
+
+# This is a directory where application specific .hrl
+# files can be placed. Application-specific .yaws code can
+# then include these .hrl files.
+include_dir = /usr/lib/yaws/examples/include
+
+# Set this to an integer value to control
+# max number of connections from clients into the server.
+max_connections = nolimit
+
+# Normally, yaws does not restrict the number of times a connection is
+# kept alive using keepalive. Setting this parameter to an integer X
+# will ensure that connections are closed once they have been used X times.
+# This can be a useful to guard against long running connections
+# collecting too much garbage in the Erlang VM.
+keepalive_maxuses = nolimit
+
+# Override the garbage collection option parameters for processes
+# that handle new connections. Useful for systems expecting long-lived
+# connections that handle a lot of data. The default value is Erlang's
+# default. Valid options are {fullsweep_after, X} and/or {min_heap_size, Y} where
+# X and Y are integers. See Erlang's erlang:spawn_opt/4 function for more
+# details. The value type is a quoted string containing an Erlang proplist or
+# the atom undefined.
+process_options = "[]"
+
+# Set the size of the cached acceptor process pool. The value must be an
+# integer greater than or equal to 0. The default pool size is 8. Setting
+# the pool size to 0 effectively disables the pool.
+#acceptor_pool_size = 8
+
+# This is a debug variable, possible values are http | traffic | false
+# It is also possible to set the trace (possibly to the tty) while
+# invoking yaws from the shell as in
+# yaws -i -T -x (see man yaws).
+trace = false
+
+# Enable this if we want to use the old OTP ssl implementation
+# OTP R13B03 is known to work with this flag set to false (default).
+use_old_ssl = false
+
+# It is possible to have yaws start additional application-specific code at
+# startup. Set runmod to the name of the module you want yaws to start. It
+# assumes the module has an exported function start/0. To have multiple
+# runmods just add more "runmod = xyz" lines.
+#
+# runmod = mymodule
+
+# By default yaws will copy the erlang error_log and
+# append it to a wrap log called report.log (in the logdir).
+# This feature can be turned off. This would typically
+# be the case when yaws runs within another larger app.
+copy_error_log = true
+
+# Logs are wrap logs
+log_wrap_size = 1000000
+
+# Possibly resolve all hostnames in logfiles so webalizer
+# can produce the nice geography piechart
+log_resolve_hostname = false
+
+# Fail completely or not if yaws fails to bind a listen socket.
+fail_on_bind_err = true
+
+# If HTTP auth is used, it is possible to have a specific
+# auth log. As of release 1.90 the global auth_log is
+# deprecated and ignored. Now, this variable must be set in
+# server part
+#auth_log = true
+
+# When we're running multiple yaws systems on the same
+# host, we need to give each yaws system an individual
+# name. Yaws will write a number of runtime files under
+# ${HOME}/.yaws/yaws/${id}
+# The default value is "default"
+# If we're not planning to run multiple webservers on the
+# same host it's much better to leave this value unset since
+# then all the ctl function (--stop et.el) work without having
+# to supply the id.
+#
+# id = myname
+
+# Earlier versions of Yaws picked the first virtual host
+# in a list of hosts with the same IP/PORT when the Host:
+# header doesn't match any name on any Host.
+# This is often nice in testing environments but not
+# acceptable in real-world hosting scenarios;
+# think http://porn.bigcompany.com
+pick_first_virthost_on_nomatch = true
+
+# If the HTTP client session is to be kept alive, wait this many
+# milliseconds for a new request before timing out the connection. Note
+# that infinity is a valid value but it's not recommended.
+keepalive_timeout = 30000
+
+# Now, a set of virtual servers.
+# The examples below first show two virthosted servers on the same IP (0.0.0.0)
+# in this case, but an explicit IP can be given as well.
+
+#<server localhost>
+#        port = 80
+#        listen = 0.0.0.0
+#        docroot = /var/yaws/www
+#        auth_log = true
+#        appmods = <cgi-bin, yaws_appmod_cgi>
+#</server>
+
+<server localhost>
+        port = 80
+        listen = 0.0.0.0
+        docroot = /tmp
+        dir_listings = true
+        auth_log = true
+        statistics = true
+        <auth>
+                realm = foobar
+                dir = /
+                user = foo:bar
+                user = baz:bar
+        </auth>
+</server>
+
+# Now an SSL server
+
+<server localhost>
+        port = 443
+        docroot = /tmp
+        listen = 0.0.0.0
+        dir_listings = true
+        auth_log = true
+        <ssl>
+                keyfile = /etc/yaws/yaws-key.pem
+                certfile = /etc/yaws/yaws-cert.pem
+                depth = 0
+        </ssl>
+</server>
diff --git a/testing/yaws/yaws.post-deinstall b/testing/yaws/yaws.post-deinstall
index 60dd86d..821981d 100644
--- a/testing/yaws/yaws.post-deinstall
+++ b/testing/yaws/yaws.post-deinstall
@@ -1,2 +1,2 @@
 #!/bin/sh
-rmdir --ignore-fail-on-non-empty /usr/var/log/yaws && exit 0
+rmdir --ignore-fail-on-non-empty /var/log/yaws && exit 0
diff --git a/testing/yaws/yaws.post-install b/testing/yaws/yaws.post-install
index 17ac6d7..b8f3f5a 100644
--- a/testing/yaws/yaws.post-install
+++ b/testing/yaws/yaws.post-install
@@ -1,2 +1,2 @@
 #!/bin/sh
-mkdir -p /usr/var/log/yaws && exit 0
+mkdir -p /var/log/yaws && exit 0
diff --git a/testing/yaws/yaws.post-upgrade b/testing/yaws/yaws.post-upgrade
index 17ac6d7..b8f3f5a 100644
--- a/testing/yaws/yaws.post-upgrade
+++ b/testing/yaws/yaws.post-upgrade
@@ -1,2 +1,2 @@
 #!/bin/sh
-mkdir -p /usr/var/log/yaws && exit 0
+mkdir -p /var/log/yaws && exit 0
-- 
1.8.2.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Sun, 30 Jun 2013 13:15:58 +0200

On Fri, 28 Jun 2013 21:50:34 +0400
Vitaliy Tokarev <[email-masked]> wrote:

> testing/yaws/yaws.post-upgrade   |   2 +- 6 files changed, 189
> insertions(+), 10 deletions(-) create mode 100644
> testing/yaws/yaws-1.96-etc.patch create mode 100644
> testing/yaws/yaws.conf.alpine

both patches applied. I removed the install scripts as apk can handle
an empty /var/log/yaws dir. I also did minor whitespace cleanup and
renamed init script to .initd for consistency.

Thanks!

-nc

---