# Contributor: Olivier Mauras # Contributor: Michał Polański # Maintainer: Jakub Jirutka pkgname=borgbackup _pkgname=borg pkgver=1.2.4 pkgrel=5 pkgdesc="Deduplicating backup program" url="https://www.borgbackup.org/" arch="all" license="BSD-3-Clause" depends=" py3-msgpack py3-packaging python3 " makedepends=" acl-dev attr-dev linux-headers lz4-dev openssl-dev>3 py3-setuptools py3-setuptools_scm python3-dev xxhash-dev zstd-dev " checkdepends=" cmd:fusermount3 py3-dateutil py3-pytest py3-pytest-benchmark py3-pytest-xdist " subpackages=" $pkgname-pyc $pkgname-doc $pkgname-bash-completion $pkgname-fish-completion $pkgname-zsh-completion " source="https://github.com/borgbackup/borg/releases/download/$pkgver/borgbackup-$pkgver.tar.gz test-fusermount3.patch " case "$CARCH" in armhf | armv7 | x86) ;; # blocked by py3-pyfuse3 *) makedepends="$makedepends py3-pyfuse3" subpackages="$subpackages $pkgname-fuse::noarch";; esac export BORG_LIBLZ4_PREFIX="/usr/include" export BORG_LIBXXHASH_PREFIX="/usr/include" export BORG_LIBZSTD_PREFIX="/usr/include" export BORG_OPENSSL_PREFIX="/usr/include/openssl" prepare() { default_prepare # Remove bundled libs to ensure these don't end up in our binaries. cd src/borg/algorithms/ rm -rf lz4 xxh64 zstd } build() { # CYTHON_FORCE_REGEN - don't use precompiled Cython code, always regenerate. CYTHON_FORCE_REGEN=1 \ python3 setup.py build } check() { [ -e /dev/fuse ] || export BORG_FUSE_IMPL='none' PYTHONPATH="$(echo "$builddir"/build/lib.linux-*)" pytest -v -n auto \ --benchmark-skip --pyargs borg.testsuite _delete_testsuite # Run selftest to ensure that we haven't deleted some testsuite module that # is needed for selftest. Note that borg runs selftest automatically before # every operation, so it's crucial. PYTHONPATH="$(echo build/lib.linux-*)" python3 -B <<-PYTHON from borg.selftest import selftest import logging logging.basicConfig(level=logging.DEBUG) selftest(logging) PYTHON } package() { # Run it again for the case we skipped check. _delete_testsuite python3 setup.py install --skip-build --root="$pkgdir" install -Dm644 -t "$pkgdir"/usr/share/man/man1 docs/man/*.1 install -Dm644 scripts/shell_completions/bash/$_pkgname \ "$pkgdir"/usr/share/bash-completion/completions/$_pkgname install -Dm644 scripts/shell_completions/fish/$_pkgname.fish \ "$pkgdir"/usr/share/fish/vendor_completions.d/$_pkgname.fish install -Dm644 scripts/shell_completions/zsh/_$_pkgname \ "$pkgdir"/usr/share/zsh/site-functions/_$_pkgname # clean some useless files cd "$pkgdir"/usr/lib/python*/site-packages/borg find . -name '*.h' -delete -o -name '*.c' -delete -o -name '*.pyx' -delete } fuse() { pkgdesc="$pkgdesc (FUSE support)" depends="$pkgname=$pkgver-r$pkgrel py3-pyfuse3" mkdir -p "$subpkgdir" } # Delete testsuite but keep modules required for selftest (see src/borg/selftest.py). _delete_testsuite() { cd build/lib.linux-* find borg/testsuite/ -type f ! \( \ -name '__init__.*' -or \ -name 'crypto.*' -or \ -name 'chunker.*' -or \ -name 'hashindex.*' \) -delete rm -f borg/testsuite/__pycache__/*-pytest-*.pyc cd - >/dev/null } sha512sums=" 9326a58605a085f521ba75a2eecfb4bdb790d3da18c77076bddaeae641678cc08171d997a758182a739ec6b145bb04d982f8314ae60f93c3ff093eca15515dfd borgbackup-1.2.4.tar.gz d5aea79b8ff663ca87b845680a31ba75235f734f95a5cfa444e49813916e530754b98269bfbccfda800fbf102652ee4ed47bdb71f6cda831e76f0fae3b5433d8 test-fusermount3.patch "