On 2/7/19 5:38 PM, Levente Polyak via aur-general wrote: > Hey ho, > > > On February 7, 2019 11:13:34 PM GMT+01:00, Josef Miegl <[email protected]> wrote: >> I've been trying to improve my AUR packages for the last few days. I'm >> still a beginner in package maintaining so I would like to have some >> feedback on some of my PKGBUILDs. I would love to hear everything that >> is wrong about them. Thanks! >> >> pkgver() { >> cd "${srcdir}/${pkgname%-git}" >> echo $(git describe --always | sed 's/-/./g') >> } >> > > Please do not use pkgver functions like that, they > don't work in vercmp as you would assume. > If upstream releases with a fix up version release > you gonna end up with a epoch bump. > > You could do something like described in the wiki > > sed 's/\([^-]*-g\)/r\1/;s/-/./g' } > > This prefixes the revision count like: > 2.0.r6.ga17a017 > > Which behaves properly. > > https://wiki.archlinux.org/index.php/VCS_package_guidelines#The_pkgver()_function
I would like to add to this, that in addition, there is no need to use: echo $(git describe ... | sed ...) since it is literally the same thing as not using the echo and simply using: git describe ... | sed ... Except not using the echo is a) faster b) as a general scripting practice, advisable due to not reparsing the string, thus introducing modification of whitespace. If you're going to use echo $() then at least quote the "$()". Failure to quote the $() means that echo treats each whitespace-separated string as a separate argument to echo, even if they are separated by multiple spaces, or tabs. Of course, for PKGBUILDs, whitespace is forbidden in pkgver() output. -- Eli Schwartz Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
