29 lines
1.2 KiB
Plaintext
29 lines
1.2 KiB
Plaintext
|
{% if pkg['vcstype'] == 'bzr' %}pkgver() {
|
||
|
cd "${_pkgname}"
|
||
|
printf "r%s" "$(bzr revno)"
|
||
|
}{% endif %}{% if pkg['vcstype'] == 'git' %}pkgver() {
|
||
|
cd "${srcdir}/${_pkgname}"
|
||
|
# no tags, so number of revisions e.g. r1142.a17a017
|
||
|
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||
|
## most recent annotated tag e.g. 2.0.r6.ga17a017
|
||
|
#git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
|
||
|
## most recent un-annotated tag e.g. 0.71.r115.gd95ee07
|
||
|
#git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
|
||
|
## or:
|
||
|
##git describe --long --tags | sed 's/-/.r/;s/-/./'
|
||
|
## project uses tags with prefix. e.g. v...
|
||
|
#git describe --long | sed 's/^foo-//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||
|
## both with fallback, e.g. 0.9.9.r27.g2b039da with tags, else r1581.2b039da
|
||
|
#( set -o pipefail
|
||
|
# git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
|
||
|
# printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||
|
#)
|
||
|
}{% endif %}{% if pkg['vcstype'] == 'hg' %}pkgver() {
|
||
|
cd "${_pkgname}"
|
||
|
printf "r%s.%s" "$(hg identify -n)" "$(hg identify -i)"
|
||
|
}{% endif %}{% if pkg['vcstype'] == 'svn' %}pkgver() {
|
||
|
cd "${_pkgname}"
|
||
|
local ver="$(svnversion)"
|
||
|
printf "r%s" "${ver//[[:alpha:]]}"
|
||
|
}{% endif %}
|