Fix mercurial package versioning

Use `hg id -r .` to remove the working dir from the distance, and
compare this distance with 1 instead of 0 because we always get
a tagging commit in addition to the tagged commit.

This now matches the logic inside hg.sr.ht/.builds/alpine.yml
This commit is contained in:
Ludovic Chabant 2024-03-30 21:56:23 +00:00 committed by Drew DeVault
parent b2f30e72f7
commit 5b554a38f0
1 changed files with 3 additions and 3 deletions

6
pkgkit
View File

@ -182,10 +182,10 @@ print_pkgver() {
fi
elif [ -d .hg ]
then
pkgver=$(hg id -T '{latesttag}')
if [ "$(hg id -T '{latesttagdistance}')" -ne 0 ]
pkgver=$(hg id -r . -T '{latesttag}')
if [ "$(hg id -r . -T '{latesttagdistance}')" -ne 1 ]
then
pkgver="$(hg id -T '{latesttag}_hg{sub("-", "", date|shortdate)}')"
pkgver="$(hg id -r . -T '{latesttag}_hg{sub("-", "", date|shortdate)}')"
fi
else
pkgver=unknown_0000