From 5af6252b14b37a1d281e1154f85b209921ca5a2d Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 19 Sep 2023 11:42:07 +0530 Subject: [PATCH] Fix make not picking up semver from git archive builds. Fixes #1380. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e966a4121..a1fed22c5 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # Try to get the commit hash from 1) git 2) the VERSION file 3) fallback. -LAST_COMMIT := $(or $(shell git rev-parse --short HEAD 2> /dev/null),$(shell head -n 1 VERSION | grep -oP -m 1 "^[a-z0-9]+$$"),"UNKNOWN") +LAST_COMMIT := $(or $(shell git rev-parse --short HEAD 2> /dev/null),$(shell head -n 1 VERSION | grep -oP -m 1 "^[a-z0-9]+$$"),"") # Try to get the semver from 1) git 2) the VERSION file 3) fallback. -VERSION := $(or $(shell git describe --tags --abbrev=0 2> /dev/null),$(shell grep -oP "tag: \K(.*)(?=,)" VERSION),"v0.0.0") +VERSION := $(or $(shell git describe --tags --abbrev=0 2> /dev/null),$(shell grep -oP 'tag: \Kv\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?' VERSION),"v0.0.0") BUILDSTR := ${VERSION} (\#${LAST_COMMIT} $(shell date -u +"%Y-%m-%dT%H:%M:%S%z"))