app-backup/borgmatic: new package
[gentoo.git] / app-backup / borgmatic / borgmatic-1.5.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7} )
7
8 DISTUTILS_USE_SETUPTOOLS="rdepend"
9 inherit distutils-r1
10
11 DESCRIPTION="Automatically create, prune and verify backups with borgbackup"
12 HOMEPAGE="https://torsion.org/borgmatic/"
13 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
14
15 LICENSE="GPL-3"
16 SLOT="0"
17 KEYWORDS="~amd64"
18
19 DEPEND="${PYTHON_DEPS}
20         dev-python/colorama[${PYTHON_USEDEP}]
21         >=dev-python/pykwalify-1.6.0[${PYTHON_USEDEP}]
22         dev-python/requests[${PYTHON_USEDEP}]
23         <dev-python/ruamel-yaml-0.17.0"[${PYTHON_USEDEP}]
24 RDEPEND="${DEPEND}
25         app-backup/borgbackup"
26 BDEPEND="test? (
27                 ${DEPEND}
28                 dev-python/flexmock[${PYTHON_USEDEP}]
29         )"
30
31 PATCHES=(
32         "${FILESDIR}"/${PN}-1.5.1-no_test_coverage.patch
33 )
34
35 distutils_enable_tests pytest
36
37 src_prepare() {
38         distutils-r1_src_prepare
39
40         # Unlike the other two test files in integration/commands, which use the
41         # relevant modules' respective APIs, test_borgmatic.py tries to call the
42         # 'borgmatic' executable - which has not even been created by now.
43         # Seeing as the only test run from this file as of 2020-03-25 is the
44         # parsing of contents of 'borgmatic --version', just skip it for now.
45         rm -f "${S}"/tests/integration/commands/test_borgmatic.py
46 }
47
48 src_install() {
49         distutils-r1_src_install
50         keepdir /etc/borgmatic
51         # TODO: install systemd units (and explain them in postinst); need patching
52 }
53
54 pkg_postinst() {
55         if [[ -z "${REPLACING_VERSIONS}" ]]; then
56                 elog "To generate a sample configuration file, run:"
57                 elog "    generate-borgmatic-config"
58         else
59                 elog "To upgrade your configuration file to the current version, run:"
60                 elog "    upgrade-borgmatic-config"
61         fi
62 }