From 31687185638c8096a7cc4287850bf340a60883e2 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 5 Sep 2022 15:57:29 +0200 Subject: [PATCH] Update git commit command Signed-off-by: Evan Lezar --- Makefile | 3 ++- versions.mk | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e792beb3..a9fc1ffe 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ CLI_VERSION = $(LIB_VERSION)$(if $(LIB_TAG),-$(LIB_TAG)) else CLI_VERSION = $(VERSION) endif +CLI_VERSION_PACKAGE = github.com/NVIDIA/nvidia-container-toolkit/internal/info GOOS ?= linux @@ -60,7 +61,7 @@ cmd-%: COMMAND_BUILD_OPTIONS = -o $(PREFIX)/$(*) endif cmds: $(CMD_TARGETS) $(CMD_TARGETS): cmd-%: - GOOS=$(GOOS) go build -ldflags "-s -w -X github.com/NVIDIA/nvidia-container-toolkit/internal/info.gitCommit=$(GIT_COMMIT) -X github.com/NVIDIA/nvidia-container-toolkit/internal/info.version=$(CLI_VERSION)" $(COMMAND_BUILD_OPTIONS) $(MODULE)/cmd/$(*) + GOOS=$(GOOS) go build -ldflags "-s -w -X $(CLI_VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) -X $(CLI_VERSION_PACKAGE).version=$(CLI_VERSION)" $(COMMAND_BUILD_OPTIONS) $(MODULE)/cmd/$(*) build: GOOS=$(GOOS) go build ./... diff --git a/versions.mk b/versions.mk index b993813b..ca5753b5 100644 --- a/versions.mk +++ b/versions.mk @@ -27,4 +27,4 @@ LIBNVIDIA_CONTAINER0_VERSION := 0.10.0+jetpack CUDA_VERSION := 11.7.1 GOLANG_VERSION := 1.17.8 -GIT_COMMIT ?= $(shell git describe --dirty --long --always 2> /dev/null || echo "") +GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always 2> /dev/null || echo "")