Update git commit command

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-09-05 15:57:29 +02:00
parent 503ed96275
commit 3168718563
2 changed files with 3 additions and 2 deletions

View File

@ -51,6 +51,7 @@ CLI_VERSION = $(LIB_VERSION)$(if $(LIB_TAG),-$(LIB_TAG))
else else
CLI_VERSION = $(VERSION) CLI_VERSION = $(VERSION)
endif endif
CLI_VERSION_PACKAGE = github.com/NVIDIA/nvidia-container-toolkit/internal/info
GOOS ?= linux GOOS ?= linux
@ -60,7 +61,7 @@ cmd-%: COMMAND_BUILD_OPTIONS = -o $(PREFIX)/$(*)
endif endif
cmds: $(CMD_TARGETS) cmds: $(CMD_TARGETS)
$(CMD_TARGETS): cmd-%: $(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: build:
GOOS=$(GOOS) go build ./... GOOS=$(GOOS) go build ./...

View File

@ -27,4 +27,4 @@ LIBNVIDIA_CONTAINER0_VERSION := 0.10.0+jetpack
CUDA_VERSION := 11.7.1 CUDA_VERSION := 11.7.1
GOLANG_VERSION := 1.17.8 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 "")