beanstalkd: import version 1.12

Beanstalk is a simple, fast work queue. Its interface is generic, but was
originally designed for reducing the latency of page views in high-volume web
applications by running time-consuming tasks asynchronously.
This commit is contained in:
khorben 2021-03-18 22:54:52 +00:00
parent 2d8e709798
commit 2faa3d8fe0
7 changed files with 147 additions and 0 deletions

3
net/beanstalkd/DESCR Normal file
View file

@ -0,0 +1,3 @@
Beanstalk is a simple, fast work queue. Its interface is generic, but was
originally designed for reducing the latency of page views in high-volume web
applications by running time-consuming tasks asynchronously.

45
net/beanstalkd/Makefile Normal file
View file

@ -0,0 +1,45 @@
# $NetBSD: Makefile,v 1.1 2021/03/18 22:54:52 khorben Exp $
DISTNAME= ${GITHUB_PROJECT}-${PKGVERSION_NOREV}
PKGNAME= ${GITHUB_PROJECT}-1.12
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_GITHUB:=kr/}
GITHUB_PROJECT= beanstalkd
GITHUB_TAG= v${PKGVERSION_NOREV}
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://kr.github.io/beanstalkd/
COMMENT= Simple, fast work queue
LICENSE= mit
USE_TOOLS+= gmake
B_MANDIR= ${PKGMANDIR}/man1
B_DOCDIR= share/doc/${PKGBASE}
RCD_SCRIPTS+= beanstalkd
INSTALLATION_DIRS+= ${B_MANDIR} ${B_DOCDIR} share/examples/rc.d
PKG_GROUPS_VARS+= BEANSTALKD_GROUP
PKG_USERS_VARS= BEANSTALKD_USER
BUILD_DEFS+= BEANSTALKD_USER BEANSTALKD_GROUP BEANSTALKD_HOME VARBASE
BEANSTALKD_USER?= beanstalkd
FILES_SUBST+= BEANSTALK_USER=${BEANSTALKD_USER}
BEANSTALKD_GROUP?= beanstalkd
BEANSTALKD_HOME?= ${VARBASE}/chroot/beanstalkd
PKG_HOME.beanstalkd?= ${BEANSTALKD_HOME}
PLIST_SUBST+= BEANSTALK_HOME=${BEANSTALKD_HOME}
PKG_GROUPS= ${BEANSTALKD_GROUP}
PKG_GECOS.beanstalkd= beanstalk daemon
PKG_USERS= ${BEANSTALKD_USER}:${BEANSTALKD_GROUP}
OWN_DIRS_PERMS+= ${PKG_HOME.beanstalkd} ${PKG_USERS:S/:/ /1} 0700
post-patch:
${CP} ${WRKSRC}/freebsd.c ${WRKSRC}/netbsd.c
post-install:
${INSTALL_MAN} ${WRKSRC}/doc/beanstalkd.1 \
${DESTDIR}${PREFIX}/${B_MANDIR}
${INSTALL_DATA} ${WRKSRC}/doc/protocol.txt \
${DESTDIR}${PREFIX}/${B_DOCDIR}
.include "../../mk/bsd.pkg.mk"

5
net/beanstalkd/PLIST Normal file
View file

@ -0,0 +1,5 @@
@comment $NetBSD: PLIST,v 1.1 2021/03/18 22:54:52 khorben Exp $
bin/beanstalkd
man/man1/beanstalkd.1
share/doc/beanstalkd/protocol.txt
share/examples/rc.d/beanstalkd

8
net/beanstalkd/distinfo Normal file
View file

@ -0,0 +1,8 @@
$NetBSD: distinfo,v 1.1 2021/03/18 22:54:52 khorben Exp $
SHA1 (beanstalkd-1.12.tar.gz) = 09a6cbd7766f54875ee9b709ca64e245e58350c9
RMD160 (beanstalkd-1.12.tar.gz) = 7d211fe9585c777dc988acc0ad8a754e20e7ad75
SHA512 (beanstalkd-1.12.tar.gz) = 347f8cf29501d4bf1a01a472f8f6265d1211eadfaa4e5626c8fcab5b1f8116e1e0ddee2a0c82ac116ee60655a2e3b514d254f98c2154be76109a24d77f7d8210
Size (beanstalkd-1.12.tar.gz) = 79592 bytes
SHA1 (patch-Makefile) = bc96a1028ac2666f348ac842d4b39e7047f12340
SHA1 (patch-darwin.c) = 83db9922d20d12cff4f99c5214a45ffdc17285c2

View file

@ -0,0 +1,42 @@
#!/bin/sh
#
# $NetBSD: beanstalkd.sh,v 1.1 2021/03/18 22:54:52 khorben Exp $
#
# beanstalkd - simple, fast work queue daemon
#
# PROVIDE: beanstalkd
# REQUIRE: DAEMON NETWORKING SERVERS
#
# You will need to set some variables in @PKG_SYSCONFDIR@/rc.conf to start beanstalkd:
#
# beanstalkd=YES
. /etc/rc.subr
name="beanstalkd"
rcvar=${name}
beanstalkd_user="@BEANSTALK_USER@"
beanstalkd_host="127.0.0.1"
beanstalkd_port="11300"
start_cmd="beanstalkd_start"
restart_cmd="beanstalkd_stop ; beanstalkd_start"
stop_cmd="beanstalkd_stop"
command="@PREFIX@/bin/${name}"
command_args="-u ${beanstalkd_user} -l ${beanstalkd_host} -p ${beanstalkd_port}"
beanstalkd_start()
{
${command} ${command_args} &
}
beanstalkd_stop()
{
pkill -u @BEANSTALK_USER@ 2>/dev/null
}
if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
eval ${start_cmd}
fi

View file

@ -0,0 +1,12 @@
$NetBSD: patch-Makefile,v 1.1 2021/03/18 22:54:52 khorben Exp $
Fix NetBSD support.
--- Makefile.orig 2020-06-04 19:54:32.000000000 +0000
+++ Makefile
@@ -120,3 +120,5 @@ doc/beanstalkd.1 doc/beanstalkd.1.html:
ronn $<
freebsd.o: darwin.c
+
+netbsd.o: darwin.c

View file

@ -0,0 +1,32 @@
$NetBSD: patch-darwin.c,v 1.1 2021/03/18 22:54:52 khorben Exp $
Fix casting errors.
--- darwin.c.orig 2014-08-05 03:39:54.000000000 +0000
+++ darwin.c
@@ -79,7 +79,11 @@ sockwant(Socket *s, int rw)
ev->data = Infinity;
}
ev->flags = EV_ADD;
- ev->udata = s;
+#if defined(__NetBSD__)
+ ev->udata = (intptr_t) s;
+#else
+ ev->udata = s;
+#endif
s->added = ev->filter;
ev++;
n++;
@@ -105,7 +109,11 @@ socknext(Socket **s, int64 timeout)
}
if (r > 0) {
- *s = ev.udata;
+#if defined(__NetBSD__)
+ *s = (Socket *) ev.udata;
+#else
+ *s = ev.udata;
+#endif
if (ev.flags & EV_EOF) {
return 'h';
}