You are not logged in.
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
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.
Offline
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
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
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
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
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
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
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