I want to create and upload an AUR package. For context, I did that years ago for specific releases, but now I want to create a new package that focuses on upstream Git without specific releases.
What do I write to the pkgver= value? Do I just take the latest version there? Because it is downloading with git clone the version number will not change and the PKGBUILD script will compare pkgver() instead. So what is the purpose of pkgver= for when downloading and building from Git directly? Looking at examples from other existing packages, they all have a number there. But its mostly outdated, so I don't get it.
pkgname=thename-git
_pkgname="$(pkgname%-git}"
pkgver=???
pkgver() {
cd "${_pkgname}"
git describe --long | sed 's/\([^-]*-g\)/r\1/'
}
I am reading and researching, but need some assistance for this question. Currently reading the Archwiki:
Yes, it took a little digging to find it! Not sure why it's necessary if it's unused. Maybe for error checking? Is it tricky for shell scripts to detect whether a function (i.e. pkgver()) has been defined?
Some discussions say the variable was still needed in old versions of either the application that dealt with it or the web backend, its not clear. Some sort of software that depended on the variable. In later versions they finally made the variable optional, but most people seem to just add it out of good habit. It could also be used as a fallback, in case the function resolves to nothing or so, not sure. Someone else suggested the last version found in the variable could be documentation itself as a rough guideline to see from when this install script was.
I find like the documentation is missing this information and should clear it up. For newcomers this would help.