iop: genconfig: Use new version format

Use a new version format:

* More strict regex for filtering tags for determining version which
  prevents OpenWrt and hopefully other tags from becoming the IOWRT
  version
* version follows standard git-describe format with -dirty
* customerconfigs are appended to the version

Example-versions:
 * 7.1.0BETA1
 * 7.1.0BETA1-29-g1292f9102e-dirty
 * 7.1.0BETA1-29-g1292f9102e-secureboot
 * 7.1.0BETA1-29-g1292f9102e-securebooteval
Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu>
This commit is contained in:
Andreas Gnau 2022-09-19 18:50:59 +02:00
parent 6091b22937
commit 89264fa175
2 changed files with 18 additions and 12 deletions

View file

@ -388,12 +388,15 @@ function genconfig {
fi
# Set target version
local GIT_TAG=$(git describe --abbrev=0 --tags)
local GIT_REV=$(git rev-parse --short HEAD)
local GIT_VER="$GIT_TAG"
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
local git_version
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
echo "ERROR: Failed getting version via git describe, exiting." >&2
return 1
fi
local customers_lower="${CUSTOMERS,,}"
local version="${git_version}${customers_lower:+-${customers_lower// /}}"
echo "CONFIG_TARGET_VERSION=\"${version}\"" >> .config
echo "CONFIG_VERSION_CODE=\"${version}\"" >> .config
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
# Enable Package source tree override if selected

View file

@ -379,12 +379,15 @@ function genconfig_min {
fi
# Set target version
local GIT_TAG=$(git describe --abbrev=0 --tags)
local GIT_REV=$(git rev-parse --short HEAD)
local GIT_VER="$GIT_TAG"
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
local git_version
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
echo "ERROR: Failed getting version via git describe, exiting." >&2
return 1
fi
local customers_lower="${CUSTOMERS,,}"
local version="${git_version}${customers_lower:+-${customers_lower// /}}"
echo "CONFIG_TARGET_VERSION=\"${version}\"" >> .config
echo "CONFIG_VERSION_CODE=\"${version}\"" >> .config
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
# Enable Package source tree override if selected