diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a8e3e81a..6f63efefb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,6 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Cache permissions run: | sudo chown $(id -un) /var/cache/apt/archives @@ -69,8 +67,6 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Cache permissions run: | sudo chown $(id -un) /var/cache/apt/archives @@ -99,8 +95,6 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Cache permissions run: | sudo chown $(id -un) /var/cache/apt/archives diff --git a/src/Makefile b/src/Makefile index f9d782f97..b93c08f9d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -210,23 +210,27 @@ install : # # Version number calculations # -ifneq ($(wildcard ../.git),) -VERSIONS := $(shell git describe --tags --always --long --abbrev=1 --match "v*") -VERSION_TUPLE := $(subst ., ,$(subst -, ,$(patsubst v%,%,$(VERSIONS)))) -VERSION_MAJOR := $(word 1,$(VERSION_TUPLE)) -VERSION_MINOR := $(word 2,$(VERSION_TUPLE)) -VERSION_PATCH := $(word 3,$(VERSION_TUPLE)) -ifeq ($(word 4,$(VERSION_TUPLE)),0) -EXTRAVERSION := -else +VERSION_MAJOR := 1 +VERSION_MINOR := 21 +VERSION_PATCH := 1 EXTRAVERSION := + -endif -GITVERSION = $(word 5,$(VERSION_TUPLE)) +ifneq ($(wildcard ../.git/HEAD),) +GITHEAD := $(shell cat ../.git/HEAD) +ifneq ($(firstword $(GITHEAD)),ref:) +GITCOMMIT := $(GITHEAD) else -VERSION_MAJOR = 1 -VERSION_MINOR = 0 -VERSION_PATCH = 0 -EXTRAVERSION = + +GITREF := $(word 2,$(GITHEAD)) +ifneq ($(wildcard ../.git/$(GITREF)),) +GITCOMMIT := $(shell cat ../.git/$(GITREF)) +else +GITCOMMIT := $(shell awk -v ref="$(GITREF)" '$$2 == ref { print $1 }' \ + ../.git/packed-refs) +endif +endif +ifeq ($(GITCOMMIT),) +$(error Unable to determine git commit ID) +endif +GITVERSION := g$(shell echo "$(GITCOMMIT)" | cut -c1-5) endif MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR) VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)