The versioning method needs to be changed. I've come up with a proper one, read on for the explanation and one-liner:
The current method gives the incorrect version (21.0.99). The xserver repo's meson.build always contains the correct version (currently 21.1.99.1).
Still use git describe
to append the current commit hash to the end of the pkgver, but not use it for the pkgver number. Because right now, you end up with xorg-server-git 21.0.99.1.r127.gda9d012a9-1
, but it's really 21.1.99. 21.1.1 was released a few weeks ago.
Since meson.build
always has the proper version, I actually have tweaked your command into a one-liner that will always get the correct version:
git describe --long --tags | sed "s/$(git describe --long --tags | cut -d- -f3)/$(grep -m 1 version meson.build | awk '{print $2}' | sed "s/'//g;s/,//g")/g" | sed 's/^xorg.server.//;s/\([^-]*-g\)/r\1/;s/-/./g'
gives us:
21.1.99.1.r127.gda9d012a9
and the package named:
xorg-server-git-21.1.99.1.r127.gda9d012a9-1-x86_64.pkg.tar.zst
So literally all you have to do is replace the one line in the PKGBUILD, and xorg-server-git will always be the true accurate version. This will avoid situations like the current one where xorg-server is on 21.1.1 but xorg-server-git is on 20.0.99 despite being actually built on 21.1.99.
You could also take a slightly different versioning approach like other -git packages do (for example libva-vdpau-driver-vp9-git) and use git rev-parse and rev-list, and use this:
printf ".r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" | sed "s/^/$(grep -m 1 version meson.build | awk '{print $2}' | cut -d"'" -f2)/g"
which gives:
xorg-server-git-21.1.99.1.r17753.gda9d012a9-1-x86_64.pkg.tar.zst
Either one will always make sure the version is correct while appending the commit hash, the way it should be.
Pinned Comments
yurikoles commented on 2022-03-18 01:04 (UTC)
check()
function was added, if unit tests fail, you may ignore them by appending--nocheck
tomakepkg
.yurikoles commented on 2019-05-29 15:00 (UTC)
PRs are welcome: https://github.com/yurikoles-aur/xorg-server-git