Skip to content

Commit

Permalink
Fix version number evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Feb 4, 2025
1 parent 86e3a9f commit 41349a4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ PYTHON ?= /usr/bin/python3
OS_CODENAME ?= $(shell grep VERSION_CODENAME= /etc/os-release | cut -f2 -d=)

ifneq ("$(wildcard .git)","")
COMMIT ?= $(or $(shell git rev-parse HEAD), local)
VERSION ?= $(or $(shell $(PYTHON) ./version.py $(shell git show -s --format="%ct" $(shell git rev-parse HEAD)) $(shell git rev-parse --abbrev-ref HEAD)), 0.0.0)
SOURCE_DATE_EPOCH ?= $(or $(shell git show -s --format="%ct" $(shell git rev-parse HEAD)), $(shell date "+%s"))
RELEASE ?= $(shell git describe --all --match master --match 'release-*' --abbrev=0 HEAD | sed 's#heads/##g')
COMMIT ?= $(shell git rev-parse HEAD)
SOURCE_DATE_EPOCH ?= $(or $(shell git show -s --format="%ct" $(COMMIT)), $(shell date "+%s"))
VERSION ?= $(shell $(PYTHON) ./version.py $(SOURCE_DATE_EPOCH) $(RELEASE))
else
COMMIT ?= local
VERSION ?= 0.0.0
COMMIT ?= release
SOURCE_DATE_EPOCH ?= $(shell date "+%s")
VERSION ?= $(or $(shell basename $(PWD) | grep -E -o '[0-9]+.[0-9]+(.[0-9]+)?$$'), 0.0.0)
endif

ENV ?= $(PWD)/env
Expand All @@ -26,6 +27,9 @@ _CFLAGS := $(CFLAGS) -Wall -O2 -fno-strict-aliasing -DWFB_VERSION='"$(VERSION)-$

all: all_bin gs.key test

version:
@echo -e "RELEASE=$(RELEASE)\nCOMMIT=$(COMMIT)\nVERSION=$(VERSION)\nSOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH)"

$(ENV):
$(PYTHON) -m virtualenv --download $(ENV)
$$(PATH=$(ENV)/bin:$(ENV)/local/bin:$(PATH) which python3) -m pip install --upgrade pip setuptools $(STDEB)
Expand Down

0 comments on commit 41349a4

Please sign in to comment.