ensure version string is what we expect
This commit is contained in:
parent
27b40c63a1
commit
73fbb59377
3 changed files with 14 additions and 5 deletions
|
@ -101,8 +101,12 @@ mv "${TMP}/usr" "${PKG_ROOT}"
|
||||||
|
|
||||||
VERSION=$(jq -r '.version' "${MANIFEST}")
|
VERSION=$(jq -r '.version' "${MANIFEST}")
|
||||||
# if we've a tagged version (1.5.0), append the number of commits and a dummy hash
|
# if we've a tagged version (1.5.0), append the number of commits and a dummy hash
|
||||||
HAS_COMMIT=$(echo $VERSION | grep -c '[0-9a-fA-F][0-9a-fA-f][0-9a-fA-F][0-9a-fA-F][0-9a-fA-f][0-9a-fA-F]')
|
VERSION_GOOD=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+$')
|
||||||
if [ $HAS_COMMIT -eq 0 ]; then
|
VERSION_WITH_COMMIT=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\.g[0-9a-fA-f]\+$')
|
||||||
|
if [ $VERSION_GOOD -eq 0 -a $VERSION_WITH_COMMIT -eq 0 ]; then
|
||||||
|
die "version does not conform to (MAJOR.MINOR.PATCH[.#NUM_COMMITS.g<HASH>])"
|
||||||
|
fi
|
||||||
|
if [ $VERSION_WITH_COMMIT -eq 0 ]; then
|
||||||
VERSION="${VERSION}.0.g0000000"
|
VERSION="${VERSION}.0.g0000000"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,13 @@
|
||||||
freebsd_sanitize_version () {
|
freebsd_sanitize_version () {
|
||||||
post=$(echo $1 | rev | cut -d '-' -f 1-2 | rev | sed -e 's/-/./g')
|
post=$(echo $1 | rev | cut -d '-' -f 1-2 | rev | sed -e 's/-/./g')
|
||||||
v=$(echo $1 | rev | cut -d '-' -f 3- | rev | sed -e 's/-/./g')
|
v=$(echo $1 | rev | cut -d '-' -f 3- | rev | sed -e 's/-/./g')
|
||||||
has_commit=$(echo $v | grep -c '[0-9a-fA-F][0-9a-fA-f][0-9a-fA-F][0-9a-fA-F][0-9a-fA-f][0-9a-fA-F]')
|
version_good=$(echo $v | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+$')
|
||||||
if [ $has_commit -eq 0 ]; then
|
version_with_commit=$(echo $v | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\.g[0-9a-fA-f]\+$')
|
||||||
|
if [ $version_good -eq 0 -a $version_with_commit -eq 0 ]; then
|
||||||
|
echo "invalid version $v";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
if [ $version_with_commit -eq 0 ]; then
|
||||||
v="${v}.0.g0000000"
|
v="${v}.0.g0000000"
|
||||||
fi
|
fi
|
||||||
echo $v
|
echo $v
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
2.0.0-10-gabcdef-20220202-hahh 2.0.0-11-g123456-20220201-abcd
|
2.0.0-10-gabcdef-20220202-hahh 2.0.0-11-g123456-20220201-abcd
|
||||||
2.0.0-10-gabcdef-20220202-hahh 2.0.0-110-g123456-20220201-abcd
|
2.0.0-10-gabcdef-20220202-hahh 2.0.0-110-g123456-20220201-abcd
|
||||||
2.0.0-11-g123456-20220201-abcd 2.0.1-20220120-abcd
|
2.0.0-11-g123456-20220201-abcd 2.0.1-20220120-abcd
|
||||||
3.0-20230101-abcd 3.0.1-20230204-bdbd
|
3.0.0-20230101-abcd 3.0.1-20230204-bdbd
|
||||||
1.5.0-20220516-a0d5a2 1.5.0-3-g26b5a59-20220527-0bc180
|
1.5.0-20220516-a0d5a2 1.5.0-3-g26b5a59-20220527-0bc180
|
||||||
1.5.0-3-g26b5a59-20220527-0bc180 1.5.1-20220527-0bc180
|
1.5.0-3-g26b5a59-20220527-0bc180 1.5.1-20220527-0bc180
|
||||||
|
|
Loading…
Reference in a new issue