Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Sep 2009 16:18:18 +0100 (BST)
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/138987: [maintainer] textproc/sphinxsearch -- use bsd.options.mk, etc
Message-ID:  <200909201518.n8KFIIhb034996@happy-idiot-talk.infracaninophile.co.uk>
Resent-Message-ID: <200909201520.n8KFK6MX001014@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         138987
>Category:       ports
>Synopsis:       [maintainer] textproc/sphinxsearch -- use bsd.options.mk, etc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 20 15:20:05 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Matthew Seaman
>Release:        FreeBSD 7.2-STABLE i386
>Organization:
Infracaninophile
>Environment:
System: FreeBSD happy-idiot-talk.infracaninophile.co.uk 7.2-STABLE FreeBSD 7.2-STABLE #7: Sat Sep 19 23:39:03 BST 2009 root@happy-idiot-talk.infracaninophile.co.uk:/usr/obj/usr/src/sys/HAPPY-IDIOT-TALK i386


	
>Description:

Update the port to use the latest facilities provided by the bsd.port.mk
infrastructure:

   * bsd.options.mk
   * USERS / GROUPS for automatic creation of users from UIDs and GIDs
     files.
   * consolidate all directory creation into ${PREFIX}/etc/rc.d/sphinxsearch
     -- this eliminates the pkg-install script.
   * minor changes to placate portlint.

Note for committer:

   Deleted file  files/pkg-install.sh.in



>How-To-Repeat:
	
>Fix:

	

--- sphinxsearch.diff begins here ---
diff -Nur /usr/ports/textproc/sphinxsearch/Makefile sphinxsearch/Makefile
--- /usr/ports/textproc/sphinxsearch/Makefile	2008-11-12 06:32:48.000000000 +0000
+++ sphinxsearch/Makefile	2009-09-20 16:13:46.000000000 +0100
@@ -17,8 +17,6 @@
 MAINTAINER=	m.seaman@infracaninophile.co.uk
 COMMENT=	Sphinx Full-Text Search Engine
 
-CONFLICTS=	sphinxsearch-devel-[0-9]*
-
 # If expat is present on the system and configure finds it, it will
 # unconditionally link the output binary against it.  There's no way
 # of turning this off. So for consistency, make sure it's always on.
@@ -33,42 +31,9 @@
 ## FFR
 ##		LIBSTEMMER	 "compile with libstemmer support"  off
 
-SPHINX_USR?=	_sphinx
-SPHINX_UID?=	312
-SPHINX_GRP?=	_sphinx
-SPHINX_GID?=	312
-SPHINX_DIR?=	/var/db/${PORTNAME}
-SPHINX_RUN?=	/var/run/${PORTNAME}
-SPHINX_LOG?=	/var/log/${PORTNAME}
-
-# Yes, the conflation of CPPFLAGS and CXXFLAGS is deliberate.  No,
-# don't ask.
-
-GNU_CONFIGURE=	yes
-CONFIGURE_ENV+=		CC=${CC} CPPFLAGS="${CXXFLAGS}"
-CFGFILE=	${PREFIX}/etc/sphinx.conf
-USE_RC_SUBR=	sphinxsearch.sh
-SUB_LIST+=	PORTNAME=${PORTNAME}     \
-		CFGFILE=${CFGFILE}       \
-		SPHINX_USR=${SPHINX_USR} \
-		SPHINX_UID=${SPHINX_UID} \
-		SPHINX_GRP=${SPHINX_GRP} \
-		SPHINX_GID=${SPHINX_GID} \
-		SPHINX_DIR=${SPHINX_DIR} \
-		SPHINX_RUN=${SPHINX_RUN} \
-		SPHINX_LOG=${SPHINX_LOG}
-SUB_FILES+=	pkg-install pkg-deinstall
-
-.if !defined(NOPORTEXAMPLES)
-EXAMPLES=	example.sql api
-PORTEXAMPLES=	*
-.endif
-
-.if !defined(NOPORTDOCS)
-DOCS=		doc/sphinx.css doc/sphinx.html doc/sphinx.txt doc/sphinx.xml
-.endif
+CONFLICTS=	sphinxsearch-devel-[0-9]*
 
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
 
 # The port will successfully compile with both PGSQL and MYSQL support
 # simultaneously.  Not sure how useful that is in practice though.
@@ -122,6 +87,38 @@
 ## CONFIGURE_ARGS+=	--without-libstemmer
 ## .endif
 
+USERS?=		_sphinx
+GROUPS?=	_sphinx
+
+SPHINX_DIR?=	/var/db/${PORTNAME}
+SPHINX_RUN?=	/var/run/${PORTNAME}
+SPHINX_LOG?=	/var/log/${PORTNAME}
+
+# Yes, the conflation of CPPFLAGS and CXXFLAGS is deliberate.  No,
+# don't ask.
+
+GNU_CONFIGURE=	yes
+CONFIGURE_ENV+=		CC=${CC} CPPFLAGS="${CXXFLAGS}"
+CFGFILE=	${PREFIX}/etc/sphinx.conf
+USE_RC_SUBR=	sphinxsearch.sh
+SUB_LIST+=	PORTNAME=${PORTNAME}     \
+		CFGFILE=${CFGFILE}       \
+		SPHINX_USR=${USERS}	 \
+		SPHINX_GRP=${GROUPS}	 \
+		SPHINX_DIR=${SPHINX_DIR} \
+		SPHINX_RUN=${SPHINX_RUN} \
+		SPHINX_LOG=${SPHINX_LOG}
+SUB_FILES+=	pkg-deinstall
+
+.if !defined(NOPORTEXAMPLES)
+EXAMPLES=	example.sql api
+PORTEXAMPLES=	*
+.endif
+
+.if !defined(NOPORTDOCS)
+DOCS=		doc/sphinx.css doc/sphinx.html doc/sphinx.txt doc/sphinx.xml
+.endif
+
 # Fix up the sample configuration file to correspond to FreeBSD norms
 
 post-patch:
@@ -132,9 +129,6 @@
 	    -e "s!@CONFDIR@!${SPHINX_DIR}!"                                \
 	    ${WRKSRC}/sphinx.conf.in
 
-pre-install:
-	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-
 do-install: install-bin install-docs install-examples
 
 install-bin:
@@ -159,12 +153,9 @@
 .endfor
 .endif
 
-post-install: post-install-cfg
-	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
-
 post-install-cfg:
 	@if [ ! -f ${CFGFILE} ]; then \
 	  ${CP} -p ${CFGFILE}.sample ${CFGFILE} ; \
 	fi
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -Nur /usr/ports/textproc/sphinxsearch/files/pkg-deinstall.in sphinxsearch/files/pkg-deinstall.in
--- /usr/ports/textproc/sphinxsearch/files/pkg-deinstall.in	2007-01-30 23:13:36.000000000 +0000
+++ sphinxsearch/files/pkg-deinstall.in	2009-09-20 15:33:59.000000000 +0100
@@ -6,15 +6,15 @@
 sphinx_usr=%%SPHINX_USR%%
 sphinx_grp=%%SPHINX_GRP%%
 sphinx_dir=%%SPHINX_DIR%%
-sphinx_name=%%PORTNAME%%
+portname=%%PORTNAME%%
 
 case $2 in
     POST-DEINSTALL)
 
     cat <<EOMSG
 
-The $sphinx_name port has been deleted.  If you are not
-upgrading and don't intend to use $sphinx_name any more
+The $portname port has been deleted.  If you are not
+upgrading and don't intend to use $portname any more
 then you may wish to delete the $sphinx_usr account,
 and the $sphinx_grp group together with the working
 directory $sphinx_dir; which can be done with the
diff -Nur /usr/ports/textproc/sphinxsearch/files/pkg-install.in sphinxsearch/files/pkg-install.in
--- /usr/ports/textproc/sphinxsearch/files/pkg-install.in	2007-01-30 23:13:36.000000000 +0000
+++ sphinxsearch/files/pkg-install.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,123 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: ports/textproc/sphinxsearch/files/pkg-install.in,v 1.1 2007/01/30 23:13:36 pav Exp $
-#
-
-PATH=/usr/sbin:/usr/bin:/bin ; export PATH
-
-sphinx_dir=%%SPHINX_DIR%%
-sphinx_usr=%%SPHINX_USR%%
-sphinx_uid=%%SPHINX_UID%%
-sphinx_grp=%%SPHINX_GRP%%
-sphinx_gid=%%SPHINX_GID%%
-sphinx_run=%%SPHINX_RUN%%
-sphinx_log=%%SPHINX_LOG%%
-sphinx_name=%%PORTNAME%%
-
-sphinx_gcos="Sphinxsearch Owner"
-sphinx_home=/nonexistent
-sphinx_shell=/sbin/nologin
-
-create_group() {
-    local user uid group gid gcos home shell
-
-    user=$1
-    uid=$2
-    group=$3
-    gid=$4
-    gcos=$5
-    home=$6
-    shell=$7
-
-    if pw groupadd -n $group -g $gid ; then
-	echo "===> Group $group created"
-    else
-	cat <<-EOERRORMSG
-	*** Failed to create the $group group.
-
-	Please add the $user user and $group group
-	manually with the commands:
-
-	    pw groupadd -n $group -g $gid
-	    pw useradd -n $user -u $uid -g $group -c "$gcos" \\
-	        -d $home -s $shell -h -
-
-	and retry installing this package.
-	EOERRORMSG
-	exit 1
-    fi
-}
-
-
-create_user() {
-    local user uid group gid gcos home shell
-
-    user=$1
-    uid=$2
-    group=$3
-    gid=$4
-    gcos=$5
-    home=$6
-    shell=$7
-
-    if pw useradd -n $user -u $uid -g $group -c "$gcos" -d $home \
-	-s $shell -h - ; then
-	echo "===> Created $user user"
-    else
-	cat <<-EOERRORMSG
-	*** Failed to create the $user user.
-
-	Please add the $user user manually with the command:
-
-	    pw useradd -n $user -u $uid -g $group -c "$gcos" \\
-		        -d $home -s $shell -h -
-
-	and retry installing this package.
-	EOERRORMSG
-	exit 1
-    fi
-}
-
-
-case $2 in
-    PRE-INSTALL)
-
-        # Create the sphinx user and group if they do not already exist
-
-        if pw user show -n $sphinx_usr >/dev/null 2>&1 ; then
-	    echo "===> Using pre-existing user $sphinx_usr"
-	else
-	    if ! pw group show -n $sphinx_grp >/dev/null 2>&1 ; then
-		create_group $sphinx_usr $sphinx_uid $sphinx_grp $sphinx_gid \
-		    "$sphinx_gcos" $sphinx_home $sphinx_shell
-	    fi
-	    create_user $sphinx_usr $sphinx_uid $sphinx_grp $sphinx_gid \
-		"$sphinx_gcos" $sphinx_home $sphinx_shell
-	fi
-	;;
-    POST-INSTALL)
-
-    	# Create and set ownership of the Sphinx working directory
-        if [ -d $sphinx_dir ]; then
-	    echo "==> Using pre-existing directory $sphinx_dir"
-	else
-	    echo "==> Creating the Sphinx working directory: $sphinx_dir"
-	    mkdir -m 755 $sphinx_dir || exit 1
-	fi
-
-    	# Create and set ownership of the Sphinx data directory
-        if [ -d $sphinx_dir/data ]; then
-	    echo "==> Using pre-existing directory $sphinx_dir/data"
-	else
-	    echo "==> Creating the Sphinx data directory: $sphinx_dir/data"
-	    mkdir -m 755 $sphinx_dir/data || exit 1
-	fi
-
-        echo "===> Adjusting file ownership in $sphinx_dir"
-        chown -R $sphinx_usr:$sphinx_grp $sphinx_dir || exit 1
-	;;
-esac
-
-#
-# That's All Folks!
-#
diff -Nur /usr/ports/textproc/sphinxsearch/files/sphinxsearch.sh.in sphinxsearch/files/sphinxsearch.sh.in
--- /usr/ports/textproc/sphinxsearch/files/sphinxsearch.sh.in	2008-04-27 09:50:49.000000000 +0100
+++ sphinxsearch/files/sphinxsearch.sh.in	2009-09-20 15:46:54.000000000 +0100
@@ -24,6 +24,9 @@
 #                          -- group to run searchd as
 # %%PORTNAME%%_logdir="%%SPHINX_LOG%%"
 #                          -- directory searchd writes logs to
+# %%PORTNAME%%_dir="%%SPHINX_DIR%%"
+#                          -- working directory used by searchd et al:
+#                             must match setting in ${%%PORTNAME%%_conffile}
 #
 . /etc/rc.subr
 
@@ -38,6 +41,7 @@
 : ${%%PORTNAME%%_user="%%SPHINX_USR%%"}
 : ${%%PORTNAME%%_group="%%SPHINX_GRP%%"}
 : ${%%PORTNAME%%_logdir="%%SPHINX_LOG%%"}
+: ${%%PORTNAME%%_dir="%%SPHINX_DIR%%"}
 
 command=%%PREFIX%%/sbin/searchd
 pidfile=${%%PORTNAME%%_pidfile}
@@ -56,6 +60,11 @@
 	chown -R ${%%PORTNAME%%_user}:${%%PORTNAME%%_group} \
 	    ${%%PORTNAME%%_logdir}
     fi
+    if [ ! -d ${%%PORTNAME%%_dir} ]; then
+	mkdir -m 755 -p ${%%PORTNAME%%_dir} ${%%PORTNAME%%_dir}/data
+	chown -R ${%%PORTNAME%%_user}:${%%PORTNAME%%_group} \
+	    ${%%PORTNAME%%_dir}
+    fi
 }
 
 case "${%%PORTNAME%%_flags}" in
--- sphinxsearch.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909201518.n8KFIIhb034996>