summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4a6283bef30c1d101a346fbbbe433f1bca756c84 (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
# Maintainer: Marcus Hoffmann <bubu@bubu1.eu>

pkgname=matrix-registration-git
_pkgbase=matrix-registration
pkgver=r302.cd89ec8
pkgrel=1

pkgdesc="Webapp for token based matrix registration"
url="https://github.com/ZerataX/matrix-registration"
arch=('any')
license=('MIT')

depends=('python-appdirs' 'python-flask' 'python-flask-sqlalchemy' 'python-flask-cors'
         'python-flask-httpauth' 'python-flask-limiter' 'python-waitress' 'python-alembic'
         'python-dateutil' 'python-yaml' 'python-requests' 'python-wtforms' 'systemd')
checkdepends=('python-parameterized')
conflicts=('matrix-registration')
provides=('matrix-registration')
source=("matrix-registration::git+https://github.com/ZerataX/matrix-registration.git"
	"matrix-registration.service")
sha256sums=('SKIP'
            '36b204dea08c49e2f02f82cd469a828c1f99742339a9f4b8dd4bf59dbe2f9c45')
install=matrix-registration.install

pkgver() {
  cd "$srcdir/${_pkgbase}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd $srcdir/matrix-registration
    local src
    for src in "${source[@]}"; do
        src="${src%%::*}"
        src="${src##*/}"
        [[ $src = *.patch ]] || continue
        msg2 "Applying patch $src..."
        patch -Np1 < "../$src"
    done
    sed -i -e 's/~=/>=/g' setup.py
}

build() {
	cd $srcdir/$_pkgbase
	sed -i 's|"config"|"/etc/matrix-registration"|' setup.py
	sed -i -e '/psycopg2-binary/d' setup.py
	python setup.py build
}

check() {
	cd $srcdir/$_pkgbase
	PYTHONWARNINGS=ignore PYTHONPATH=build/lib python -m tests.test_registration -v
}

package() {
	install -Dm644 ${_pkgbase}.service "$pkgdir"/usr/lib/systemd/system/${_pkgbase}.service
	cd $srcdir/$_pkgbase

	python setup.py install --root "$pkgdir" --optimize=1 --skip-build

	install -dm755 "$pkgdir"/etc/${_pkgbase}
	mv ${pkgdir}/usr/{alembic,alembic.ini} ${pkgdir}/etc/${_pkgbase}
	sed -i -e "s|script_location = alembic|script_location = /etc/${_pkgbase}/alembic/|" ${pkgdir}/etc/${_pkgbase}/alembic.ini
}