git: 93b244dc10ce - main - net/kafka: fix regression in non-Kraft mode after update to 3.3.1

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Sun, 18 Dec 2022 19:25:59 UTC
The branch main has been updated by ronald:

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

commit 93b244dc10ce303f458a8e73683c18033de44fc0
Author:     Pavel Timofeev <timp87@gmail.com>
AuthorDate: 2022-12-18 09:31:11 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2022-12-18 19:21:55 +0000

    net/kafka: fix regression in non-Kraft mode after update to 3.3.1
    
    "There's a regression after update to 3.3.1 in non-Kraft mode
    The port always creates /var/db/kafka/kraft dir. But it brokes the Kafka environment."
    
    PR:     267309
    Approved by: rene
    Differential Revision: https://reviews.freebsd.org/D37731
---
 net/kafka/Makefile  | 18 +++++++++++-------
 net/kafka/pkg-plist |  2 +-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/net/kafka/Makefile b/net/kafka/Makefile
index 071168c1bfd0..7ad71de43f4e 100644
--- a/net/kafka/Makefile
+++ b/net/kafka/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	kafka
 DISTVERSION=	3.3.1
+PORTREVISION=	1
 CATEGORIES=	net java
 MASTER_SITES=	APACHE/${PORTNAME}/${PORTVERSION}/
 DISTNAME=	${PORTNAME}_2.13-${PORTVERSION}
@@ -27,6 +28,7 @@ SHEBANG_FILES=	bin/*.sh
 KAFKA_USER?=	kafka
 KAFKA_GROUP?=	kafka
 KAFKA_DBDIR?=	/var/db/${PORTNAME}
+KAFKA_DBDIR_KRAFT?=	${KAFKA_DBDIR}-kraft
 KAFKA_LOGDIR?=	/var/log/${PORTNAME}
 
 DATADIR=	${JAVASHAREDIR}/${PORTNAME}
@@ -39,7 +41,8 @@ SUB_LIST=	JAVA=${JAVA} \
 		KAFKA_USER=${KAFKA_USER} \
 		KAFKA_GROUP=${KAFKA_GROUP} \
 		KAFKA_LOGDIR=${KAFKA_LOGDIR} \
-		KAFKA_DBDIR=${KAFKA_DBDIR}
+		KAFKA_DBDIR=${KAFKA_DBDIR} \
+		KAFKA_DBDIR_KRAFT=${KAFKA_DBDIR_KRAFT}
 USERS=		${KAFKA_USER}
 GROUPS=		${KAFKA_GROUP}
 
@@ -66,13 +69,14 @@ KAFKA_CONFIGS=	connect-console-sink.properties \
 		connect-mirror-maker.properties connect-standalone.properties \
 		consumer.properties log4j.properties producer.properties \
 		server.properties tools-log4j.properties trogdor.conf
-KAFKA_KRAFT=	broker.properties controller.properties server.properties
+KAFKA_CONFIGS_KRAFT=	broker.properties controller.properties server.properties
 
 PLIST_SUB=	PORTVERSION=${PORTVERSION} \
 		KAFKA_USER=${KAFKA_USER} \
 		KAFKA_GROUP=${KAFKA_GROUP} \
 		KAFKA_LOGDIR=${KAFKA_LOGDIR} \
-		KAFKA_DBDIR=${KAFKA_DBDIR}
+		KAFKA_DBDIR=${KAFKA_DBDIR} \
+		KAFKA_DBDIR_KRAFT=${KAFKA_DBDIR_KRAFT}
 
 OPTIONS_DEFINE=	DOCS
 
@@ -82,15 +86,15 @@ post-patch:
 	@${REINPLACE_CMD} "s|\$$base_dir.*/config|${ETCDIR}|" ${WRKSRC}/bin/*.sh
 	@${REINPLACE_CMD} "s|ps ax|ps axww|" ${WRKSRC}/bin/kafka-server-stop.sh
 	@${REINPLACE_CMD} "/log.dirs/s|=.*|=${KAFKA_DBDIR}|" ${WRKSRC}/config/server.properties
-.for f in ${KAFKA_KRAFT}
-	@${REINPLACE_CMD} "/log.dirs/s|=.*|=${KAFKA_DBDIR}/kraft/|" ${WRKSRC}/config/kraft/${f}
+.for f in ${KAFKA_CONFIGS_KRAFT}
+	@${REINPLACE_CMD} "/log.dirs/s|=.*|=${KAFKA_DBDIR_KRAFT}|" ${WRKSRC}/config/kraft/${f}
 .endfor
 
 do-install:
 	${MKDIR} ${STAGEDIR}${ETCDIR}
 	${MKDIR} ${STAGEDIR}${ETCDIR}/kraft
 	${MKDIR} ${STAGEDIR}${KAFKA_DBDIR}
-	${MKDIR} ${STAGEDIR}${KAFKA_DBDIR}/kraft
+	${MKDIR} ${STAGEDIR}${KAFKA_DBDIR_KRAFT}
 	${MKDIR} ${STAGEDIR}${KAFKA_LOGDIR}
 	${MKDIR} ${STAGEDIR}${DATADIR}/bin
 .for f in ${KAFKA_BINS}
@@ -104,7 +108,7 @@ do-install:
 .for f in ${KAFKA_CONFIGS}
 	${INSTALL_DATA} ${WRKSRC}/config/${f} ${STAGEDIR}${ETCDIR}/${f}.sample
 .endfor
-.for f in ${KAFKA_KRAFT}
+.for f in ${KAFKA_CONFIGS_KRAFT}
 	${INSTALL_DATA} ${WRKSRC}/config/kraft/${f} ${STAGEDIR}${ETCDIR}/kraft/${f}.sample
 .endfor
 
diff --git a/net/kafka/pkg-plist b/net/kafka/pkg-plist
index 206622d584de..6abe22d3b24d 100644
--- a/net/kafka/pkg-plist
+++ b/net/kafka/pkg-plist
@@ -285,5 +285,5 @@
 @sample %%ETCDIR%%/kraft/controller.properties.sample
 @sample %%ETCDIR%%/kraft/server.properties.sample
 @dir(%%KAFKA_USER%%,%%KAFKA_GROUP%%,755) %%KAFKA_DBDIR%%
-@dir(%%KAFKA_USER%%,%%KAFKA_GROUP%%,755) %%KAFKA_DBDIR%%/kraft
+@dir(%%KAFKA_USER%%,%%KAFKA_GROUP%%,755) %%KAFKA_DBDIR_KRAFT%%
 @dir(%%KAFKA_USER%%,%%KAFKA_GROUP%%,755) %%KAFKA_LOGDIR%%