X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/ca89775db49fd0376f920e77487e0485e98e787f..148295024c93e47f90ac850bf068e592b16b1c7c:/vim/ultisnips/PKGBUILD.snippets diff --git a/vim/ultisnips/PKGBUILD.snippets b/vim/ultisnips/PKGBUILD.snippets index ef52592..b18ae81 100644 --- a/vim/ultisnips/PKGBUILD.snippets +++ b/vim/ultisnips/PKGBUILD.snippets @@ -1,23 +1,33 @@ +snippet pkgver "pkgver() function" b +pkgver() { + cd ${1:$pkgname-$pkgver} + ( set -o pipefail + git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + ) +} +endsnippet + snippet prep "prepare() function" b prepare() { - cd ${1:$pkgname-$pkgver} - $0 + cd ${1:$pkgname-$pkgver} + $0 } endsnippet snippet build "build() function" b build() { - cd ${1:$pkgname-$pkgver} - ./configure \ - --prefix=/usr $2 - $0 + cd ${1:$pkgname-$pkgver} + ./configure \ + --prefix=/usr $2 + $0 } endsnippet snippet pack "package() function" b package() { - cd ${1:$pkgname-$pkgver} - make DESTDIR="$pkgdir" install - $0 + cd ${1:$pkgname-$pkgver} + make DESTDIR="$pkgdir" install + $0 } endsnippet