git: 574c5c9142f3 - main - net/gitup: Improve gitup.conf auto config

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Sat, 03 Jun 2023 12:06:50 UTC
The branch main has been updated by eduardo:

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

commit 574c5c9142f39aea9da2ffccce25bbd8401242f9
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2023-06-03 12:02:06 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2023-06-03 12:06:38 +0000

    net/gitup: Improve gitup.conf auto config
    
    - Find osrel on install time through pkg-post-install to get an updated
      match on gitup.conf.sample
    - Only install gitup.conf.sample
    - Add message on install with information about gitup.conf(5) and
      gitup.sample
    - Move pkg-plist to PLIST_FILES
    
    PR:             270911
---
 net/gitup/Makefile             | 12 ++++++------
 net/gitup/files/pkg-message.in | 12 ++++++++++++
 net/gitup/pkg-plist            |  4 ----
 net/gitup/pkg-post-install     |  5 +++++
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/net/gitup/Makefile b/net/gitup/Makefile
index 2bf7c85c099f..82a8f2096123 100644
--- a/net/gitup/Makefile
+++ b/net/gitup/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	gitup
 DISTVERSION=	0.98-3
 DISTVERSIONSUFFIX=	-g50f1e8c
+PORTREVISION=	1
 CATEGORIES=	net
 
 MAINTAINER=	eduardo@FreeBSD.org
@@ -11,21 +12,20 @@ LICENSE=	BSD2CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 USES=		ssl
-
 USE_GITHUB=	yes
 GH_ACCOUNT=	johnmehr
 
 MAKE_ENV+=	CONFIG_FILE_PATH=${LOCALBASE}/etc/gitup.conf
 
+SUB_FILES=	pkg-message
+PLIST_FILES=	bin/gitup \
+		etc/gitup.conf.sample \
+		share/man/man1/gitup.1.gz \
+		share/man/man5/gitup.conf.5.gz
 PORTDOCS=	README.md
 
 OPTIONS_DEFINE=	DOCS
 
-post-patch:
-	@${REINPLACE_CMD} -e 's|stable\/12|stable\/${OSREL:R}| ; \
-		s|releng\/11.4|releng\/${OSREL}|' \
-		${WRKSRC}/gitup.conf
-
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
 	${INSTALL_MAN} ${WRKSRC}/gitup.1 \
diff --git a/net/gitup/files/pkg-message.in b/net/gitup/files/pkg-message.in
new file mode 100644
index 000000000000..cab4b53267d1
--- /dev/null
+++ b/net/gitup/files/pkg-message.in
@@ -0,0 +1,12 @@
+[
+{ type: install
+  message: <<EOD
+To use gitup,
+
+%%PREFIX%%/etc/gitup.conf
+
+must be created. Refer to gitup.conf(5) for further details and/or follow
+%%PREFIX%%/etc/gitup.conf.sample as an example.
+EOD
+}
+]
diff --git a/net/gitup/pkg-plist b/net/gitup/pkg-plist
deleted file mode 100644
index 44526235ecd1..000000000000
--- a/net/gitup/pkg-plist
+++ /dev/null
@@ -1,4 +0,0 @@
-bin/gitup
-share/man/man1/gitup.1.gz
-share/man/man5/gitup.conf.5.gz
-@sample etc/gitup.conf.sample
diff --git a/net/gitup/pkg-post-install b/net/gitup/pkg-post-install
new file mode 100644
index 000000000000..ad57f46fb19b
--- /dev/null
+++ b/net/gitup/pkg-post-install
@@ -0,0 +1,5 @@
+osrel=$(${PKG_ROOTDIR}/bin/freebsd-version -u)
+releng=${osrel%%-*}
+stable=${osrel%%.*}
+
+sed -i '' -E -e "s,stable/[0-9]+,stable/${stable}," -e "s,releng/[0-9].+,releng/${releng}," ${PKG_PREFIX}/etc/gitup.conf.sample