[aur-general] Revise VCS packages versioning

Anatol Pomozov anatol.pomozov at gmail.com
Wed Oct 30 23:37:56 EDT 2013


Hi

I would like to discuss VCS package versioning that is described here
https://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines

I am looking at the -git packages but it also applicable to other VCS.
Here is the suggested way to create the version

local ver="$(git describe --tags)"
echo "${ver//-/.}"

so
0.7-19-ge4e6e20
will turn into
0.7.19.ge4e6e20

The problem is that the revision number (19 in this case) looks like
3rd component in the version. Now imagine upstream project releases
version 0.7.1. The generated version becomes 0.7.1 (and then
0.7.1.1.gfoobar). With the new tag the generated version becomes
smaller (0.7.1.1 < 0.7.19). That is the real problem that I had with
tup-git package - upstream uses both 2 and 3 component versions.

We should recommend a way that works this case. There is a discussion
in the comments and the best recommendation is to use following
recipe:

git describe | sed -E 's/([^-]*-g)/r\1/;s/-/./g'

The idea is to find the commit number and start it with "r"
(revision). "r" is smaller than a number so it will help in our case.

0.7-19-ge4e6e20 => 0.7.r19.ge4e6e20

Another issue is a repo that has no tags. Here is a recommendation
from the wiki page:

printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

that will use number of commits (a large number e.g. 3000). The
problem arises when the project creates first tag e.g. 0.1. I suggest
to fix this problem by using "0" as a tag version (and add prefix 'r'
like in the previous item). This makes sure that non-tagged version is
always less that a tagged version.

So pkgver() will look like:

printf "0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

Let me know if you have any objections. If not then I'll update the wiki page.


More information about the aur-general mailing list