# Maintainer: liloman <148582-liloman@users.noreply.gitlab.com>
#
# AUR package of Firemold (https://aur.archlinux.org/packages/firemold). The aur job of .gitlab-ci.yml
# writes pkgver and the checksum of the release tarball here on every vX.Y.Z tag, regenerates .SRCINFO
# and pushes both to the AUR. The tarball (from the release job, in the generic package registry of the
# project) already has the version written in firemold/__init__.py.
# The helper goes to /usr/libexec: the polkit policy names that path.

pkgname=firemold
pkgver=0.0.0
pkgrel=1
pkgdesc="Graphical wizard to create firejail profiles, test them and run commands in a throwaway sandbox"
arch=('any')
url="https://gitlab.com/new-horizonts/firemold"
license=('MIT')
depends=('firejail' 'bubblewrap' 'python' 'python-gobject' 'gtk4' 'libadwaita' 'gtksourceview5' 'polkit'
         'hicolor-icon-theme')
optdepends=('systemd: seccomp diagnosis when testing a profile'
            'strace: detailed log in the Sandbox tab')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=("https://gitlab.com/api/v4/projects/new-horizonts%2Ffiremold/packages/generic/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('SKIP')

build() {
    cd "$pkgname-$pkgver"
    python -m build --wheel --no-isolation
}

package() {
    cd "$pkgname-$pkgver"
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -Dm755 helper/firemold-helper "$pkgdir/usr/libexec/firemold-helper"
    install -Dm644 data/org.firemold.helper.policy "$pkgdir/usr/share/polkit-1/actions/org.firemold.helper.policy"
    install -Dm644 data/io.gitlab.firemold.Firemold.desktop "$pkgdir/usr/share/applications/io.gitlab.firemold.Firemold.desktop"
    install -Dm644 firemold/data/icons/io.gitlab.firemold.Firemold.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/io.gitlab.firemold.Firemold.svg"
    install -Dm644 data/firemold.1 "$pkgdir/usr/share/man/man1/firemold.1"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
