ports/80877: NEW port: www/spreadlogd

Meno Abels meno.abels at adviser.com
Wed May 11 06:30:12 UTC 2005


>Number:         80877
>Category:       ports
>Synopsis:       NEW port: www/spreadlogd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 11 06:30:10 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Meno Abels <meno.abels at adviser.com>
>Release:        FreeBSD 5.3 i386
>Organization:
Adviser COM
>Environment:
System: FreeBSD race 5.3 FreeBSD 5.3 #4: Tue Apr 19 14:18:44 CEST 2005 root at jamal.abels.adviser.com:/usr/obj/usr/src/sys/GENERIC i386


>Description:
	The spreadlogd is the backend for mod_log_spread.
>How-To-Repeat:
	not applied change request
>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	www/spreadlogd
#	www/spreadlogd/files
#	www/spreadlogd/files/patch-portfreebsd
#	www/spreadlogd/files/spreadlogd.sh
#	www/spreadlogd/pkg-plist
#	www/spreadlogd/pkg-descr
#	www/spreadlogd/distinfo
#	www/spreadlogd/Makefile
#
echo c - www/spreadlogd
mkdir -p www/spreadlogd > /dev/null 2>&1
echo c - www/spreadlogd/files
mkdir -p www/spreadlogd/files > /dev/null 2>&1
echo x - www/spreadlogd/files/patch-portfreebsd
sed 's/^X//' >www/spreadlogd/files/patch-portfreebsd << 'END-of-www/spreadlogd/files/patch-portfreebsd'
Xdiff -ur /tmp/orig/spreadlogd-1.4.2/config.h ./config.h
X--- /tmp/orig/spreadlogd-1.4.2/config.h	Mon Jan  1 19:08:46 2001
X+++ ./config.h	Sun Jan 30 21:38:06 2005
X@@ -11,9 +11,10 @@
X #ifndef _CONFIG_H_
X #define _CONFIG_H_
X 
X+#include <stdio.h>
X #include <stdlib.h>
X #include <sys/file.h>
X-#include <regex.h>
X+#include <gnu/posix/regex.h>
X #include <sp.h>
X 
X #include "hash.h"
Xdiff -ur /tmp/orig/spreadlogd-1.4.2/makefile ./makefile
X--- /tmp/orig/spreadlogd-1.4.2/makefile	Mon Nov 13 02:43:19 2000
X+++ ./makefile	Wed May 11 08:01:36 2005
X@@ -1,19 +1,11 @@
X-CC=gcc
X-CFLAGS=-g -D__USE_LARGEFILE64 -Wall
X-INCLUDES=-I/usr/local/include
X-
X-#### BEGIN ARCH DEPENDANT SECTION ####
X-# For Linux
X-LDFLAGS=-L/usr/local/lib -L.
X-LIBS=-lsp -lskiplist
X-
X-# For Solaris
X-#LIBS=-lsp -lskiplist -lnsl -lsocket -lucb 
X-#LDFLAGS=-L/usr/local/lib -L/usr/ucblib -R/usr/ucblib -L.
X-#BSDINCLUDES=-I/usr/ucbinclude
X-#### END ARCH DEPENDANT SECTION ####
X+# 
X+INCLUDES=-I${PREFIX}/include
X+MYCFLAGS=-DSTR_PREFIX=\"${PREFIX}\"
X 
X-YACC=bison -y
X+LDFLAGS=-L${PREFIX}/lib -L.
X+LIBS=-lskiplist -lgnuregex -lspread
X+
X+YACC=yacc 
X LEX=flex
X 
X OBJS=spreadlogd.o lex.yy.o y.tab.o config.o hash.o timefuncs.o
X@@ -28,25 +20,28 @@
X y.tab.c y.tab.h:	config_gram.y
X 	$(YACC) -d config_gram.y
X lex.yy.o: lex.yy.c y.tab.h
X-	$(CC) $(CFLAGS) $(INCLUDES) -c lex.yy.c
X+	$(CC) $(MYCFLAGS) $(CFLAGS) $(INCLUDES) -c lex.yy.c
X y.tab.o: y.tab.c config.h
X-	$(CC) $(CFLAGS) $(INCLUDES) -c y.tab.c
X+	$(CC) $(MYCFLAGS) $(CFLAGS) $(INCLUDES) -c y.tab.c
X 
X test.o:	test.c
X-	$(CC) $(CFLAGS) $(BSDINCLUDES) $(INCLUDES) -c $<
X+	$(CC) $(MYCFLAGS) $(CFLAGS) $(BSDINCLUDES) $(INCLUDES) -c $<
X 
X config.o:	config.c
X-	$(CC) $(CFLAGS) $(BSDINCLUDES) $(INCLUDES) -c $<
X+	$(CC) $(MYCFLAGS) $(CFLAGS) $(BSDINCLUDES) $(INCLUDES) -c $<
X hash.o:		hash.c
X-	$(CC) $(CFLAGS) $(BSDINCLUDES) $(INCLUDES) -c $<
X+	$(CC) $(MYCFLAGS) $(CFLAGS) $(BSDINCLUDES) $(INCLUDES) -c $<
X .c.o:	$*.c
X-	$(CC) $(CFLAGS) $(INCLUDES) -c $<
X+	$(CC) $(MYCFLAGS) $(CFLAGS) $(INCLUDES) -c $<
X 
X libskiplist.a:	$(LSLOBJS)
X 	$(AR) cq libskiplist.a $(LSLOBJS)
X 
X spreadlogd:	libskiplist.a $(OBJS)
X-	$(CC) -g -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
X+	$(CC) $(MYCFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
X+
X+install: all
X+	$(INSTALL) -s spreadlogd $(PREFIX)/libexec
X 
X clean:
X 	rm -f *~ *.o spreadlogd libskiplist.a y.tab.h y.tab.c lex.yy.c
Xdiff -ur /tmp/orig/spreadlogd-1.4.2/spreadlogd.c ./spreadlogd.c
X--- /tmp/orig/spreadlogd-1.4.2/spreadlogd.c	Tue Jul  3 22:09:48 2001
X+++ ./spreadlogd.c	Wed May 11 08:23:58 2005
X@@ -34,11 +34,11 @@
X int fdsetsize;
X int nr_open;
X 
X-static char *default_configfile = "/etc/spreadlogd.conf";
X+static char *default_configfile = STR_PREFIX"/etc/spreadlogd.conf";
X 
X void usage(char *progname) {
X   fprintf(stderr, "%s\t\tVERSION: %s\n \
X-\t-c configfile\t\t[default /etc/spreadlogd.conf]\n \
X+\t-c configfile\t\t[default "STR_PREFIX"/etc/spreadlogd.conf]\n \
X \t-s\t\t\tskip locking (flock) files (NOT RECOMMENDED)\n \
X \t-v\t\t\tverbose mode\n \
X \t-x\t\t\tlog errors talking with spread\n \
X@@ -114,9 +114,15 @@
X   }
X }
X void daemonize(void) {
X+  FILE *fd;
X+  char buf[16];
X   if(fork()!=0) exit(0);
X   setsid();
X   if(fork()!=0) exit(0);
X+  fd = fopen("/var/run/spreadlogd.pid", "w");
X+  sprintf(buf, "%d", getpid());
X+  fputs(buf, fd);
X+  fclose(fd);
X }
X int getnropen(void) {
X   struct rlimit rlim;
X@@ -127,9 +133,6 @@
X }
X 
X int main(int argc, char **argv) {
X-#ifdef SPREAD_VERSION
X-  int mver, miver, pver;
X-#endif
X   char *configfile = default_configfile;
X   char *message;
X   int getoption, debug = 0;
X@@ -137,7 +140,8 @@
X   sigset_t ourmask;
X 	nr_open = getnropen();
X 
X-  fdsetsize = getdtablesize();
X+  fdsetsize = 512; /* getdtablesize(); ugly fix for freebsd but the select fdset 
X+	           is not as big as dtablesize returns so we receive some cores MENO */
X   fds = (SpreadConfiguration **)malloc(sizeof(SpreadConfiguration *)*
X 				       fdsetsize);
X   memset(fds, 0, sizeof(SpreadConfiguration *)*fdsetsize);
X@@ -182,7 +186,7 @@
X 	    buffsize);
X   }
X 
X-  if(!debug) daemonize();
X+  if(!debug) { daemonize(); }
X  
X   /* Set up HUP signal */
X   signalaction.sa_handler = sig_handler;
END-of-www/spreadlogd/files/patch-portfreebsd
echo x - www/spreadlogd/files/spreadlogd.sh
sed 's/^X//' >www/spreadlogd/files/spreadlogd.sh << 'END-of-www/spreadlogd/files/spreadlogd.sh'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
X# PROVIDE: spreadlogd
X# REQUIRE: spread
X# KEYWORD: FreeBSD shutdown
X
X#
X# Add the following lines to /etc/rc.conf to enable spread:
X#
X#spreadlogd_enable="YES"
X#
X#
X
X. %%RC_SUBR%%
X
Xname=spreadlogd
Xrcvar=`set_rcvar`
X
Xcommand="%%PREFIX%%/libexec/spreadlogd"
Xcommand_args=""
Xpidfile=/var/run/${name}.pid
Xrequired_files=%%PREFIX%%/etc/${name}.conf
X
X# set defaults
X
Xspreadlogd_enable=${spreadlogd_enable:-"NO"}
Xspreadlogd_flags=${spreadlogd_flags:-""}
X
Xload_rc_config ${name}
Xrun_rc_command "$1"
END-of-www/spreadlogd/files/spreadlogd.sh
echo x - www/spreadlogd/pkg-plist
sed 's/^X//' >www/spreadlogd/pkg-plist << 'END-of-www/spreadlogd/pkg-plist'
Xetc/rc.d/spreadlogd.sh
Xetc/spreadlogd.conf.sample
Xsbin/spreadlogd
X%%PORTDOCS%%%%DOCSDIR%%/README
X%%PORTDOCS%%%%DOCSDIR%%/Artistic.txt
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
END-of-www/spreadlogd/pkg-plist
echo x - www/spreadlogd/pkg-descr
sed 's/^X//' >www/spreadlogd/pkg-descr << 'END-of-www/spreadlogd/pkg-descr'
XIf you kill -HUP or kill the spreadlogd process, it will not actually
Xprocess the signal until after it has received its next message from
XSpread.  You can move you log files to new names and then kill -HUP 
Xand it will reopen the log files.  This is useful for seamless log rotation
Xwithout losing any messages.
X
XSpread is really cool.  It is a poweful group communication toolkit 
Xdeveloped at the Center for Networking and Distributed Systems at the
XJohns Hopkins University.  http://www.spread.org/ and
Xhttp://www.cnds.jhu.edu/, respectively.
X
XWWW: http://www.lethargy.org/mod_log_spread/
END-of-www/spreadlogd/pkg-descr
echo x - www/spreadlogd/distinfo
sed 's/^X//' >www/spreadlogd/distinfo << 'END-of-www/spreadlogd/distinfo'
XMD5 (spreadlogd-1.4.2.tar.gz) = 220651bcc124b1be2786401d0eab45ab
XSIZE (spreadlogd-1.4.2.tar.gz) = 17072
END-of-www/spreadlogd/distinfo
echo x - www/spreadlogd/Makefile
sed 's/^X//' >www/spreadlogd/Makefile << 'END-of-www/spreadlogd/Makefile'
X# New ports collection makefile for:	mod_log_spread
X# Date created:                2005-05-08
X# Whom:                        Meno Abels <meno.abels at adviser.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	spreadlogd
XPORTVERSION=	1.4.2
XCATEGORIES=	www net
XMASTER_SITES=	http://www.lethargy.org/mod_log_spread/
X
XMAINTAINER=	meno.abels at adviser.com
XCOMMENT=	The spreadlogd provides the backend to mod_log_spread
X
XLIB_DEPENDS=    spread.1:${PORTSDIR}/net/spread
X
XMAKEFILE=   	makefile
X
XUSE_RC_SUBR=    yes
XRC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
X
XDOCS=	README Artistic.txt
X
X.include <bsd.port.pre.mk>
X
Xpost-build:
X	${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X 		${FILESDIR}/spreadlogd.sh > ${WRKDIR}/spreadlogd.sh
X
Xpost-install:
X	${INSTALL_SCRIPT} ${WRKDIR}/spreadlogd.sh ${PREFIX}/etc/rc.d/spreadlogd.sh
X	${INSTALL} ${WRKSRC}/spreadlogd.conf ${PREFIX}/etc/spreadlogd.conf.sample
X.if !defined(NOPORTDOCS)
X	${INSTALL} -d -o root -g wheel -m 0755 ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/Artistic.txt ${DOCSDIR}
X.endif
X
X.include <bsd.port.post.mk>
END-of-www/spreadlogd/Makefile
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list