# Contributor: Chris Baker <baker.chris.3@gmail.com>
# Unfortunately it's not possible to get bzr to show version info of remote
# repos, to find pkgver manually use:
#   bzr version-info --custom --template="{revno}\n"

pkgname=bugseverywhere-bzr
pkgver=330
pkgrel=1
pkgdesc="Distributed bugtracker"
arch=('x86', 'x86_64')
url="http://bugseverywhere.org/"
license=('GPL2')
depends=('python-yaml')
makedepends=('bzr')
_bzrroot="http://bzr.bugseverywhere.org/be"
_bzrname="be"

build() {
  cd $srcdir
  msg "Connecting to Bazaar server..."

  if [ -d $_bzrname ] ; then
    msg "Updating local files..."
    cd $_bzrname
    bzr revert --no-backup
    bzr up
  else
    msg "Checking out repository..."
    bzr get $_bzrroot $_bzrname
    cd $_bzrname
  fi

  msg "Bazaar checkout done or server timeout"
  msg "Starting make..."

  # remove the man page, docbook-to-man doesn't seem to exist in ArchLinux
  sed -e "s,.*share/man.*,,g" -i setup.py

  # only do the relevant bits of the Makefile
  make libbe/_version.py
  python setup.py install --root=$pkgdir/ --optimize=1 || return 1
} 