1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00

- Integrate a upstream patch to fix lock bug when creating queue

- Switch to DB5
- Add a patch to fix configure to proper handling of --enable-threads
- Add LICENSE
- Bump PORTREVISION
- Move to plist to account for package installations

PR: ports/164442
Submitted by: maintainer, m.tsatsenko at gmail.com
Approved by: crees (mentor)
This commit is contained in:
Jason Helfman 2012-01-25 17:56:43 +00:00
parent 9f10d1d10f
commit 6571a3f76b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=289797
4 changed files with 59 additions and 3 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= memcacheq
PORTVERSION= 0.2.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE} \
${MASTER_SITE_GENTOO}
@ -16,6 +16,8 @@ MASTER_SITE_SUBDIR= distfiles
MAINTAINER= m.tsatsenko@gmail.com
COMMENT= Simple queue service over Memcache
LICENSE= BSD
LIB_DEPENDS= event-1.4:${PORTSDIR}/devel/libevent
USE_CSTD= gnu89
@ -23,14 +25,14 @@ CFLAGS+= -I"${BDB_INCLUDE_DIR}"
LDFLAGS+= -l"${BDB_LIB_NAME}" -L"${LOCALBASE}/lib"
USE_RC_SUBR= memcacheq
USE_BDB= 47+
USE_BDB= 5
GNU_CONFIGURE= YES
CONFIGURE_ARGS= --with-libevent=${LOCALBASE} --with-bdb=${LOCALBASE} --enable-threads
PLIST_FILES= bin/memcacheq
PORTDOCS= README
MCQDIR?= /var/db/memcacheq
PLIST_SUB= MCQDIR=${MCQDIR}
.include <bsd.port.pre.mk>

View File

@ -0,0 +1,41 @@
--- bdb.c.orig 2012-01-24 14:49:12.248201883 +0400
+++ bdb.c 2012-01-24 14:50:35.801194396 +0400
@@ -264,8 +264,6 @@
}
int bdb_create_queue(char *queue_name) {
- pthread_rwlock_wrlock(&qlist_ht_lock);
-
char *k = strdup(queue_name);
assert(k != NULL);
queue_t *q = (queue_t *)calloc(1, sizeof(queue_t));
@@ -309,14 +307,12 @@
CHECK_DB_RET(ret);
int result = hashtable_insert(qlist_htp, (void *)k, (void *)q);
assert(result != 0);
- pthread_rwlock_unlock(&qlist_ht_lock);
return 0;
dberr:
if (txnp != NULL){
txnp->abort(txnp);
}
fprintf(stderr, "bdb_create_queue: %s %s\n", queue_name, db_strerror(ret));
- pthread_rwlock_unlock(&qlist_ht_lock);
return -1;
}
@@ -554,12 +550,13 @@
if (NULL == q) {
pthread_rwlock_unlock(&qlist_ht_lock);
+ /* switch to write lock */
+ pthread_rwlock_wrlock(&qlist_ht_lock);
ret = bdb_create_queue(key);
if (0 != ret){
return -1;
}
/* search again */
- pthread_rwlock_rdlock(&qlist_ht_lock);
q = (queue_t *)hashtable_search(qlist_htp, (void *)key);
}

View File

@ -0,0 +1,11 @@
--- configure.orig 2011-10-14 14:34:47.367393592 +0400
+++ configure 2011-10-14 14:34:57.769420421 +0400
@@ -5505,7 +5505,7 @@
enableval=$enable_threads;
fi
-if test "x$enable_threads" == "xyes"; then
+if test "x$enable_threads" = "xyes"; then
{ echo "$as_me:$LINENO: checking for library containing pthread_create" >&5
echo $ECHO_N "checking for library containing pthread_create... $ECHO_C" >&6; }
if test "${ac_cv_search_pthread_create+set}" = set; then

View File

@ -0,0 +1,2 @@
bin/memcacheq
@exec /usr/bin/install -d -o nobody -g nobody %%MCQDIR%% || true