Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2024 09:20:16 GMT
From:      Matthias Fechner <mfechner@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: a164dd24d276 - main - textproc/apache-solr: use sockstat instead of lsof
Message-ID:  <202412130920.4BD9KGnR090038@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mfechner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a164dd24d276862af02b1a02f1dfd728ca4de71d

commit a164dd24d276862af02b1a02f1dfd728ca4de71d
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2024-12-13 09:17:37 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2024-12-13 09:20:09 +0000

    textproc/apache-solr: use sockstat instead of lsof
    
    While starting solr it is using now sockstat and can detect now if the start
    was successful.
    
    The patch is also provided upstream here:
    https://github.com/apache/solr/pull/2906
    
    Thanks a lot freebsd@koenigbj.8bx.de to provide with the required sockstat
    parameters to make this PR possible.
    
    PR:             283270
---
 textproc/apache-solr/Makefile             |  1 +
 textproc/apache-solr/files/patch-bin_solr | 33 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/textproc/apache-solr/Makefile b/textproc/apache-solr/Makefile
index 4193227435e8..41035b83c920 100644
--- a/textproc/apache-solr/Makefile
+++ b/textproc/apache-solr/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	apache-solr
 PORTVERSION=	9.7.0
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	textproc java
 MASTER_SITES=	https://archive.apache.org/dist/solr/solr/${PORTVERSION}/
diff --git a/textproc/apache-solr/files/patch-bin_solr b/textproc/apache-solr/files/patch-bin_solr
new file mode 100644
index 000000000000..9184b2f8ba45
--- /dev/null
+++ b/textproc/apache-solr/files/patch-bin_solr
@@ -0,0 +1,33 @@
+--- bin/solr.orig	2024-08-06 17:02:34 UTC
++++ bin/solr
+@@ -2027,13 +2027,20 @@ function start_solr() {
+     fi
+ 
+     # no lsof on cygwin though
++    check_command=""
+     if lsof -v 2>&1 | grep -q revision; then
++      check_command="lsof -t -PniTCP:$SOLR_PORT -sTCP:LISTEN"
++    elif which -s sockstat; then
++      check_command="sockstat -q46lp$SOLR_PORT"
++    fi
++    
++    if [[ "${check_command}" != "" ]]; then
+       echo -n "Waiting up to $SOLR_START_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 -t -PniTCP:$SOLR_PORT -sTCP:LISTEN || :)
++        running=$(${check_command} || :)
+         if [ -z "${running:-}" ]; then
+           slept=$((loops * 2))
+           if [ $slept -lt $SOLR_START_WAIT ]; then
+@@ -2052,7 +2059,7 @@ function start_solr() {
+       done) &
+       spinner $!
+     else
+-      echo -e "NOTE: Please install lsof as this script needs it to determine if Solr is listening on port $SOLR_PORT."
++      echo -e "NOTE: Please install lsof or sockstat as this script needs it to determine if Solr is listening on port $SOLR_PORT."
+       sleep 10
+       SOLR_PID=$(ps auxww | grep start\.jar | awk "/\-Djetty\.port=$SOLR_PORT/"' {print $2}' | sort -r)
+       echo -e "\nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID). Happy searching!\n"



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