Browse Source

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.
pull/115/head
Hannes Mehnert 3 months ago
committed by Reynir Björnsson
parent
commit
27b40c63a1
  1. 6
      packaging/FreeBSD-repo.sh
  2. 22
      packaging/check_versions.sh
  3. 2
      packaging/versions.txt

6
packaging/FreeBSD-repo.sh

@ -100,6 +100,12 @@ mkdir "${PKG_ROOT}"
mv "${TMP}/usr" "${PKG_ROOT}"
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}")
FULL_VERSION="${VERSION}.${BUILD_TIME}.${SHA}"

22
packaging/check_versions.sh

@ -1,9 +1,25 @@
#!/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
version_a=$(echo $version_a | sed -e 's/-/./g')
version_b=$(echo $version_b | sed -e 's/-/./g')
printf "%s %s %s\n" "$version_a" $(pkg version -t "$version_a" "$version_b") "$version_b"
version_a=$(freebsd_sanitize_version $version_a)
version_b=$(freebsd_sanitize_version $version_b)
result=$(pkg version -t "$version_a" "$version_b")
printf "%s %s %s\n" "$version_a" "$result" "$version_b"
done < versions.txt
while read version_a version_b; do

2
packaging/versions.txt

@ -4,3 +4,5 @@
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
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

Loading…
Cancel
Save