fix version numbering for FreeBSD repository, see #114

To allow mixing of tags with git revisions, append a dummy ".0.g0000000" to
FreeBSD packages that originate from a tag.
This commit is contained in:
Hannes Mehnert 2022-05-29 00:04:18 +02:00 committed by Reynir Björnsson
parent 15baa605a0
commit 27b40c63a1
3 changed files with 27 additions and 3 deletions

View file

@ -100,6 +100,12 @@ mkdir "${PKG_ROOT}"
mv "${TMP}/usr" "${PKG_ROOT}" 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
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]')
if [ $HAS_COMMIT -eq 0 ]; then
VERSION="${VERSION}.0.g0000000"
fi
NAME=$(jq -r '.name' "${MANIFEST}") NAME=$(jq -r '.name' "${MANIFEST}")
FULL_VERSION="${VERSION}.${BUILD_TIME}.${SHA}" FULL_VERSION="${VERSION}.${BUILD_TIME}.${SHA}"

View file

@ -1,9 +1,25 @@
#!/bin/sh #!/bin/sh
# input in versions.txt is <v1> <v2> with v1 < v2.
# v1 and v2 are of the form <version>-<date>-<hash>, where <version> includes:
# - 2.0.0
# - 2.0.0-10-gabcdef
freebsd_sanitize_version () {
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')
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]')
if [ $has_commit -eq 0 ]; then
v="${v}.0.g0000000"
fi
echo $v
}
while read version_a version_b; do while read version_a version_b; do
version_a=$(echo $version_a | sed -e 's/-/./g') version_a=$(freebsd_sanitize_version $version_a)
version_b=$(echo $version_b | sed -e 's/-/./g') version_b=$(freebsd_sanitize_version $version_b)
printf "%s %s %s\n" "$version_a" $(pkg version -t "$version_a" "$version_b") "$version_b" result=$(pkg version -t "$version_a" "$version_b")
printf "%s %s %s\n" "$version_a" "$result" "$version_b"
done < versions.txt done < versions.txt
while read version_a version_b; do while read version_a version_b; do

View file

@ -4,3 +4,5 @@
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-20230101-abcd 3.0.1-20230204-bdbd
1.5.0-20220516-a0d5a2 1.5.0-3-g26b5a59-20220527-0bc180
1.5.0-3-g26b5a59-20220527-0bc180 1.5.1-20220527-0bc180