[aur-general] Revise VCS packages versioning

Anatol Pomozov anatol.pomozov at gmail.com
Thu Oct 31 00:49:11 EDT 2013


On Wed, Oct 30, 2013 at 8:51 PM, Jerome Leclanche <adys.wh at gmail.com> wrote:
> As someone who maintains a lot of git packages, I wish, I really wish
> there was a *standardized* way of writing a pkgver that would output
> the appropriate format whether there are tags pushed upstream or not.

That is what I intended to propose next.

As the regexp become more complicated it is better if makepkg will
take care of generating the package version. I think makepkg should
have a shell function, something like 'generate_pkgver_vcs()' that
user can use in pkgver().


pkgver() {
  cd repo

This function will
1) Find what VCS is used
2) Generate appropriate VCS version

> I like this proposal a lot.
> J. Leclanche
> On Thu, Oct 31, 2013 at 3:37 AM, Anatol Pomozov
> <anatol.pomozov at gmail.com> wrote:
>> 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
>> With the new tag the generated version becomes
>> smaller ( < 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