Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2024 13:49:56 GMT
From:      Michael Gmelin <grembo@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: d5c8853a4766 - main - sysutils/loki: Add version information to build
Message-ID:  <202409261349.48QDnuCm034716@gitrepo.freebsd.org>

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

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

commit d5c8853a4766cee2f6c45ea0e5ee296685ee76c4
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2024-09-26 12:22:09 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2024-09-26 13:48:10 +0000

    sysutils/loki: Add version information to build
    
    This way, `loki --version` actually shows the version that
    is installed.
    
    PR:             281716
    Approved by:    freebsd@funzi.org (maintainer)
---
 sysutils/loki/Makefile | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/sysutils/loki/Makefile b/sysutils/loki/Makefile
index 3aa370a171fa..6a286f78f2d7 100644
--- a/sysutils/loki/Makefile
+++ b/sysutils/loki/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	loki
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2.9.2
-PORTREVISION=	8
+PORTREVISION=	9
 CATEGORIES=	sysutils
 PKGNAMEPREFIX=	grafana-
 
@@ -329,6 +329,16 @@ GH_TUPLE=	\
 USE_RC_SUBR=	loki promtail
 
 GO_TARGET=	./cmd/loki ./cmd/loki-canary ./cmd/logcli ./clients/cmd/promtail
+GO_BUILDFLAGS=	-v -ldflags "${LD_FLAG_STRING}"
+
+LD_FLAG_STRING=	-s \
+		${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
+		${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
+		${LD_FLAG_X_PREFIX}.Branch=HEAD \
+		${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER} \
+		${LD_FLAG_X_PREFIX}.BuildDate=$$(date -u +"%Y-%m-%dT%H:%M:%SZ")
+LD_FLAG_X_PREFIX=	-X github.com/grafana/loki/pkg/util/build
+BUILD_USER?=	${USER}
 
 LOKI_USER?=	loki
 LOKI_GROUP?=	loki
@@ -338,9 +348,6 @@ PROMTAIL_USER?=	promtail
 PROMTAIL_GROUP?=	promtail
 PROMTAIL_DATADIR?=	/var/db/promtail
 
-USERS=		${LOKI_USER} ${PROMTAIL_USER}
-GROUPS=		${LOKI_GROUP} ${PROMTAIL_GROUP}
-
 SUB_LIST=	LOKI_USER=${LOKI_USER} \
 		LOKI_GROUP=${LOKI_GROUP} \
 		LOKI_DATADIR=${LOKI_DATADIR} \
@@ -348,6 +355,9 @@ SUB_LIST=	LOKI_USER=${LOKI_USER} \
 		PROMTAIL_GROUP=${PROMTAIL_GROUP} \
 		PROMTAIL_DATADIR=${PROMTAIL_DATADIR}
 
+USERS=		${LOKI_USER} ${PROMTAIL_USER}
+GROUPS=		${LOKI_GROUP} ${PROMTAIL_GROUP}
+
 PLIST_SUB=	${SUB_LIST}
 
 post-extract:



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