build: Restrict tag names when discovering version 75/35575/2
authorRenato Botelho do Couto <renato@netgate.com>
Tue, 8 Mar 2022 18:40:49 +0000 (15:40 -0300)
committerMatthew Smith <mgsmith@netgate.com>
Fri, 11 Mar 2022 19:13:04 +0000 (19:13 +0000)
Type: improvement

When `make install-ext-deps` is called, it creates a debian changelog
file and use `git describe` to fill project version.  On downstream
consumers it's possible to have different tags that makes it to end up
using an invalid version on changelog and breaking the installation
process.

Restrict tags to be considered by git-describe to match 'v[0-9]*'
pattern to get it fixed.

Signed-off-by: Renato Botelho do Couto <renato@netgate.com>
Change-Id: Ieabd7b42ac33735ec4d484bed9039ff20c9872f2

build/external/Makefile

index 55443b0..50d3ed3 100644 (file)
@@ -19,7 +19,7 @@ MAKE ?= make
 MAKE_ARGS ?= -j
 BUILD_DIR        ?= $(CURDIR)/_build
 INSTALL_DIR      ?= $(CURDIR)/_install
-PKG_VERSION ?= $(shell git describe --abbrev=0 | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2)
+PKG_VERSION ?= $(shell git describe --abbrev=0 --match 'v[0-9]*' | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2)
 PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. . | wc -l)
 JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
        $(shell grep -c ^processor /proc/cpuinfo), 2)