# $Id: PKGBUILD 117968 2014-08-27 15:41:45Z bpiotrowski $
# Maintainer:  Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Chris <seitz.christoph@gmail.com>
# Contributor: m0ikz <ndelatorre@moikz.com.ar>
# Contributor: atweiden <archbaum@gmail.com>

pkgname=ansible
pkgver=1.7.1
pkgrel=2
pkgdesc='Radically simple IT automation platform'
arch=('any')
url='http://www.ansible.com'
license=('GPL3')
depends=('python2' 'python2-yaml' 'python2-paramiko' 'python2-jinja')
makedepends=('asciidoc' 'fakeroot')
optdepends=('python2-pyasn1: needed for accelerated mode'
            'python2-crypto: needed for accelerated mode'
            'python2-keyczar: needed for accelerated mode')
backup=('etc/ansible/ansible.cfg')
source=(http://releases.ansible.com/ansible/$pkgname-$pkgver.tar.gz)
sha256sums=('d1dedd0808a138a8a0945197d38ba56123503e2440f44fe3d67c0b4bbf719572')

prepare() {
  find $pkgname-$pkgver -type f -name \*.py -exec sed -i '1s:python$:&2:' {} +
}

build() {
  cd $pkgname-$pkgver
  python2 setup.py build
}

package() {
  cd $pkgname-$pkgver
  python2 setup.py install -O1 --root="$pkgdir"

  install -d "$pkgdir/usr/share/ansible"
  cp -dpr --no-preserve=ownership ./library/* "$pkgdir/usr/share/ansible/"
  cp -dpr --no-preserve=ownership ./examples "$pkgdir/usr/share/ansible"
  install -Dm644 examples/ansible.cfg "$pkgdir/etc/ansible/ansible.cfg"

  install -Dm644 README.md "$pkgdir/usr/share/doc/ansible/README.md"
  install -Dm644 COPYING "$pkgdir/usr/share/doc/ansible/COPYING"

  install -d "$pkgdir/usr/share/man/man1"
  cp -dpr --no-preserve=ownership docs/man/man1/*.1 "$pkgdir/usr/share/man/man1"
}

# vim:set ts=2 sw=2 et:
