You are not logged in.

#1 2020-10-20 23:43:09

kevr
Member
From: CA, USA
Registered: 2010-05-01
Posts: 24
Website

[SOLVED] -git package pkgver standards?

Recently, I uploaded two `-git` packages, `sprunge-git` and `hastebin-git`. Both have an internal `./scripts/get_version.sh` script that fetches a <major>.<minor>.<patch> version based on the current tag and revision count since that tag. This script is executed in pkgver() to produce the package version for the package.

I received comments on both package by a user speaking about how I should change the pkgver function(s) in accordance with https://wiki.archlinux.org/index.php/VC … )_function. Thing is, it basically is in accordance, but it's not using exactly the same sed replacements that are on that wiki page -- it uses a different regex replace, that seems to work fine, from where i'm sitting. Am I missing something special about pkgver()?

Reference to a package with the said comment: https://aur.archlinux.org/packages/hastebin-git/

Thanks for your time, and sorry for the inconvenience!

Last edited by kevr (2020-10-21 04:19:53)


Kevin Morris <kevr@0cost.org>

Hangs out in #archlinux-aurweb. Loves the AUR.

Offline

#2 2020-10-20 23:45:05

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,645

Re: [SOLVED] -git package pkgver standards?

You're missing that '1.2.0' will cover a whole range of commits, it's nowhere near specific enough. You can use the script if you want, but you need to add more info to it.

Online

#3 2020-10-20 23:54:18

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] -git package pkgver standards?

There's also no need to pipe sed to sed, and including the 'g' flag with an EOL regex in a sed script doesn't really make much sense as by-definition there can only be one end of the line per line (it's harmless, but pointless).

Last edited by Trilby (2020-10-20 23:54:52)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2020-10-20 23:54:23

kevr
Member
From: CA, USA
Registered: 2010-05-01
Posts: 24
Website

Re: [SOLVED] -git package pkgver standards?

After some more review.. looks like the only thing my version script output is missing is the `r` before the patch revision.

Would that be correct, that the standard would be: `<tag>.r<patch>`?


Kevin Morris <kevr@0cost.org>

Hangs out in #archlinux-aurweb. Loves the AUR.

Offline

#5 2020-10-20 23:55:51

kevr
Member
From: CA, USA
Registered: 2010-05-01
Posts: 24
Website

Re: [SOLVED] -git package pkgver standards?

Scimmia wrote:

You're missing that '1.2.0' will cover a whole range of commits, it's nowhere near specific enough. You can use the script if you want, but you need to add more info to it.

1.2.0 shouldn't cover a whole range of commits. The script only produces a `.0` when there are no revisions since the tag. `1.2.0` covers tag `1.2`, and that's it. `1.2.1` would cover tag 1.2 + 1 commit ahead.

EDIT: Nah, I didn't think far enough ahead here.

Last edited by kevr (2020-10-21 04:33:47)


Kevin Morris <kevr@0cost.org>

Hangs out in #archlinux-aurweb. Loves the AUR.

Offline

#6 2020-10-20 23:56:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] -git package pkgver standards?

No, that is not the only thing your script is missing.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2020-10-20 23:58:58

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] -git package pkgver standards?

git describe --long would usually enforce printing the commit count even if it is 0, but on second thought it does seem that your second sed pass does an overcomplicated recreation of the same effect.



Also, given the tag 1.2 and 4 commits, it will produce the version "1.2.4" which is often indistinguishable from tag 1.2.4 and 0 commits, and sorts as more recent than tag 1.2.3  no matter how many commits (e.g. 55 commits, pkgver=1.2.3.55 is less than 1.2.4).

The officially recommended pkgver() function replaces the commit count with r\1 rather than \1

e.g

# yours
's/-([0-9]+)-.*$/.\1/g'
# wiki
's/\([^-]*-g\)/r\1/'

EDIT: ninjaed

Last edited by eschwartz (2020-10-21 00:04:56)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2020-10-21 00:03:15

kevr
Member
From: CA, USA
Registered: 2010-05-01
Posts: 24
Website

Re: [SOLVED] -git package pkgver standards?

Gotcha. Yeah, I completely missed that the `r`. Thank you for the time & answers, folks. Sorry for the inconvenience!

Last edited by kevr (2020-10-21 00:05:32)


Kevin Morris <kevr@0cost.org>

Hangs out in #archlinux-aurweb. Loves the AUR.

Offline

#9 2020-10-21 00:07:55

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] -git package pkgver standards?

You also strip the commit hash, which is generally considered pretty useful for git packages, since it makes it easy to tell which version of the source code the build came from.

However, this admittedly isn't the bare minimum requirement of the pkgver= variable to include it. The "r" is, in order to ensure vercmp sorting is correct.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB