summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9225fc3c7cc178cf5f13e62b3f666785e538c628 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Maintainer: Dominik Fischer <d dot f dot fischer at web dot de>
pkgname=pkgrepotools-git
pkgver=r0
pkgrel=1
# Do not try to track version changes with git. The version generated by the pkgver
# function in the git template will in turn reference the commit hash, so commiting
# a version change will change the version, which is an unbreakable race condition.
pkgdesc="builds and distributes packages expanding templates off-file"
arch=('any')
url="https://github.com/dffischer/pkgrepotools"
license=('GPL')
depends=('bash' 'sed')
makedepends=('ruby-ronn')
optdepends=("pacman>=5: to use aurbranch without a .SRCINFO argument, $(
            )makepkg-expanded and graph-templates"
            'git: for offbranch, aurbranch and aurremote')
replaces=('makepkg-expanded')
_gvdir='usr/share/graphviz/gvpr'

makedepends+=('git')
source+=("${_gitname:=${pkgname%-git}}::${_giturl:-git+$url}")
for integ in $(get_integlist)
do
  typeset -n array="${integ}sums"
  array+=('SKIP')
done
provides+=("$_gitname=$pkgver")
conflicts+=("$_gitname")
pkgver() {
  cd ${_gitname:-$pkgname}
  git describe --long --tags 2>/dev/null | sed 's/[^[:digit:]]*\(.\+\)-\([[:digit:]]\+\)-g\([[:xdigit:]]\{7\}\)/\1.r\2.g\3/;t;q1'
  [ ${PIPESTATUS[0]} -ne 0 ] && \
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

find_executables() {
  cd $_gitname
  executables=($(find -mindepth 1 -maxdepth 1 \
    -executable -type f \! -iname '*.gvpr'))
  executables=("${executables[@]#./}")
}

build() {
  find_executables
  sed -i "s|\\([[:alpha:]]\\+\\)\\.gvpr|/$_gvdir/\\1|" *.md
  ronn --roff ${executables[@]/%/.md}
}

package() {
  find_executables

  install -Dt "$pkgdir/usr/bin" ${executables[@]}
  install -Dm644 -t "$pkgdir/usr/share/man/man1" *.1

  install -d "$pkgdir/$_gvdir"
  for gvpr in *.gvpr
  do
    install "$gvpr" "$pkgdir/$_gvdir/${gvpr%.gvpr}"
  done

  IFS=: eval 'GLOBIGNORE="${executables[*]/%/.md}:*.gvpr"'
  install -Dm655 -t "$pkgdir/usr/share/doc/${pkgname%-git}" *.md
}