summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a3babed54b11b214653578ee81b2cc0b6970d808 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Maintainer: James Knight <james.d.knight@live.com>

pkgbase=releng-tool
pkgname=(releng-tool python2-releng-tool)
pkgver=0.9.0
_pkgtarget=tag=v0.9
pkgrel=1
pkgdesc='Tool to assist in the release engineering of a project'
url=https://releng.io/
arch=(any)
license=(BSD)
makedepends=(
  git
  python-setuptools
  python2-setuptools
  sed
)
optdepends=(
  'autoconf: support for autotools package management'
  'bash-completion: shell completion for bash'
  'bzr: supporting for Bazaar cloning'
  'cmake: support for CMake package management'
  'cvs: supporting for CVS checkouts'
  'fish: shell completion for fish'
  'git: support for Git cloning'
  'gnupg: support for GPG verification of downloaded packages'
  'make: support for building make-dependent packages'
  'mercurial: support for Mercurial cloning'
  'openssh: support for secure-copy fetching of sources'
  'patch: support for patching package sources'
  'subversion: supporting for Subversion checkouts'
  'zsh-completions: shell completion for zsh'
)
source=($pkgname-$pkgver::git+https://github.com/releng-tool/releng-tool.git#$_pkgtarget)
sha512sums=(SKIP)

prepare() {
  cp -a $pkgbase-$pkgver{,-py2}

  cd $pkgbase-$pkgver-py2/releng
  sed 's_#!/usr/bin/env python_#!/usr/bin/env python2_' \
      -i $(find . -name '*.py')
}

build() {
  cd "$srcdir/$pkgbase-$pkgver"
  python setup.py build

  cd "$srcdir/$pkgbase-$pkgver-py2"
  python2 setup.py build
}

check() {
  cd "$srcdir/$pkgbase-$pkgver"
  PYTHONDONTWRITEBYTECODE=1 python -m tests || warning "python tests failed"

  cd "$srcdir/$pkgbase-$pkgver-py2"
  PYTHONDONTWRITEBYTECODE=1 python2 -m tests || warning "python2 tests failed"
}

package_releng-tool() {
  depends=(python)
  cd $pkgbase-$pkgver

  export PYTHONHASHSEED=0
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build --verbose

  install -vDm644 scripts/completion/bash \
    "$pkgdir/usr/share/bash-completion/completions/$pkgname"
  install -vDm644 scripts/completion/fish \
    "$pkgdir/usr/share/fish/completions/$pkgname.fish"
  install -vDm644 scripts/completion/zsh \
    "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
  install -vDm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_python2-releng-tool() {
  depends=(python2)
  cd $pkgbase-$pkgver-py2

  export PYTHONHASHSEED=0
  python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build --verbose

  mv "$pkgdir/usr/bin/releng-tool" "$pkgdir/usr/bin/$pkgname"

  install -vDm644 scripts/completion/bash \
    "$pkgdir/usr/share/bash-completion/completions/$pkgname"
  install -vDm644 scripts/completion/fish \
    "$pkgdir/usr/share/fish/completions/$pkgname.fish"
  install -vDm644 scripts/completion/zsh \
    "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
  install -vDm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  local _completion_script
  local _completion_scripts=(
    "$pkgdir/usr/share/bash-completion/completions/$pkgname"
    "$pkgdir/usr/share/fish/completions/$pkgname.fish"
    "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
  )
  for _completion_script in ${_completion_scripts[*]}; do
      sed -i s/releng-tool/$pkgname/ "$_completion_script"
      sed -i s/_releng_tool/_releng_tool_py2/ "$_completion_script"
  done
}