Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Apr 2017 01:37:21 +0000 (UTC)
From:      Larry Rosenman <ler@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r438757 - in head/textproc/apache-solr: . files
Message-ID:  <201704180137.v3I1bL6m020131@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ler
Date: Tue Apr 18 01:37:21 2017
New Revision: 438757
URL: https://svnweb.freebsd.org/changeset/ports/438757

Log:
  Stock apache-solr scripts use lsof during startup to check if Solr started properly.
  
  When deploying Apache Solr in Jail lsof needs access to /dev/mem which is not allowed by default. Lack of the access makes the startup script run in the loop for 3 minutes and then it assumes that it might have succeed.
  
  Allowing access to /dev/mem makes running Solr in Jail a bit pointless.
  
  Following patch changes the behaviour of Solr startup script to use sockstat instead of lsof to check if Solr has already started. This also makes the dependency on lsof obsolete.
  
  While here, pet portlint.
  
  PR:	218654
  Submitted by:	Wiktor Niesiobedzki <bsd@vink.pl>
  Approved by:	 idefix@fechner.net (maintainer), adamw (mentor)
  Differential Revision:	https://reviews.freebsd.org/D10416

Added:
  head/textproc/apache-solr/files/patch-bin_solr   (contents, props changed)
Modified:
  head/textproc/apache-solr/Makefile
  head/textproc/apache-solr/files/solr.in

Modified: head/textproc/apache-solr/Makefile
==============================================================================
--- head/textproc/apache-solr/Makefile	Tue Apr 18 01:15:29 2017	(r438756)
+++ head/textproc/apache-solr/Makefile	Tue Apr 18 01:37:21 2017	(r438757)
@@ -3,6 +3,7 @@
 
 PORTNAME=	apache-solr
 PORTVERSION=	6.5.0
+PORTREVISION=	1
 CATEGORIES=	textproc java
 MASTER_SITES=	APACHE/lucene/solr/${PORTVERSION}
 DISTNAME=	solr-${PORTVERSION}
@@ -12,10 +13,9 @@ COMMENT=	High performance search server 
 
 LICENSE=	APACHE20
 
-CONFLICTS_INSTALL=	apache-solr3-* apache-solr-4* apache-solr-5*
+RUN_DEPENDS=	bash:shells/bash
 
-RUN_DEPENDS=	bash:shells/bash \
-		lsof:sysutils/lsof
+CONFLICTS_INSTALL=	apache-solr3-* apache-solr-4* apache-solr-5*
 
 USES=		cpe tar:tgz
 USE_JAVA=	yes

Added: head/textproc/apache-solr/files/patch-bin_solr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/apache-solr/files/patch-bin_solr	Tue Apr 18 01:37:21 2017	(r438757)
@@ -0,0 +1,31 @@
+--- bin/solr.orig	2017-04-15 09:06:51 UTC
++++ bin/solr
+@@ -1757,13 +1757,12 @@ function launch_solr() {
+ 	1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $! > "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
+ 
+     # no lsof on cygwin though
+-    if hash lsof 2>/dev/null ; then  # hash returns true if lsof is on the path
+       echo -n "Waiting up to $SOLR_STOP_WAIT seconds to see Solr running on port $SOLR_PORT"
+       # Launch in a subshell to show the spinner
+       (loops=0
+       while true
+       do
+-        running=`lsof -PniTCP:$SOLR_PORT -sTCP:LISTEN`
++        running=`sockstat -ls -P tcp -p $SOLR_PORT | grep LISTEN`
+         if [ -z "$running" ]; then
+ 	  slept=$((loops * 2))
+           if [ $slept -lt $SOLR_STOP_WAIT ]; then
+@@ -1781,13 +1780,6 @@ function launch_solr() {
+         fi
+       done) &
+       spinner $!
+-    else
+-      echo -e "NOTE: Please install lsof as this script needs it to determine if Solr is listening on port $SOLR_PORT."
+-      sleep 10
+-      SOLR_PID=`ps auxww | grep start\.jar | grep -w "\-Djetty\.port=$SOLR_PORT" | grep -v grep | awk '{print $2}' | sort -r`
+-      echo -e "\nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID). Happy searching!\n"
+-      return;
+-    fi
+   fi
+ }
+ 

Modified: head/textproc/apache-solr/files/solr.in
==============================================================================
--- head/textproc/apache-solr/files/solr.in	Tue Apr 18 01:15:29 2017	(r438756)
+++ head/textproc/apache-solr/files/solr.in	Tue Apr 18 01:37:21 2017	(r438757)
@@ -54,8 +54,8 @@ solr_status ()
 	su -m solr -c "${command} status"
 }
 
-# add %%LOCALBASE%%/[bin|sbin] to path
-export PATH=$PATH:%%LOCALBASE%%/bin:%%LOCALBASE%%/sbin
+# add %%LOCALBASE%%/bin to path
+export PATH=$PATH:%%LOCALBASE%%/bin
 # let the start script read some custom settings
 export SOLR_INCLUDE=/usr/local/etc/solr.in.sh
 



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