File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,14 @@ MANDIR ?= $(DATADIR)/man
3030TEST_IMAGE_LIST ?=
3131
3232# Used to populate variables in version package.
33- VERSION ?= $(shell git describe --match 'v[0-9]* ' --dirty='.m' --always)
33+ # Derive a short `DIST` label from the branch when appropriate and
34+ # safely insert it as build metadata into `VERSION` when present.
35+ # - branch `release/v1.7-labring` -> DIST=labring
36+ # - branch `v1.7` or `release/v1.7` -> DIST empty
37+ # Use compact single-line shell expressions (awk) to avoid quoting issues.
38+ DIST := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null | awk -F- '/^release\//{print $$NF; next} /^v[0-9]/ && NF>1{print $$NF}' || true)
39+
40+ VERSION ?= $(shell ver=$$(git describe --match 'v[0-9]*' --dirty='.m' --always 2>/dev/null || echo v0.0.0 ) ; if [ -n "$(DIST ) " ]; then echo "$$ver" | awk -v d="$(DIST ) " '{sub(/^v[0-9]+(\.[0-9]+) */, "&+"d); print}'; else echo "$$ver"; fi)
3441REVISION =$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
3542PACKAGE =github.com/labring/containerd
3643SHIM_CGO_ENABLED ?= 0
You can’t perform that action at this time.
0 commit comments