dev-qt/qtsql: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / app-admin / salt / salt-3000.2-r4.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python3_{7,8} )
6 DISTUTILS_USE_SETUPTOOLS=bdepend
7 inherit systemd distutils-r1
8
9 DESCRIPTION="Salt is a remote execution and configuration manager"
10 HOMEPAGE="https://www.saltstack.com/resources/community/
11         https://github.com/saltstack"
12
13 if [[ ${PV} == 9999* ]]; then
14         inherit git-r3
15         EGIT_REPO_URI="git://github.com/${PN}stack/${PN}.git"
16         EGIT_BRANCH="develop"
17         SRC_URI=""
18 else
19         SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
20                 https://dev.gentoo.org/~chutzpah/dist/salt/salt-3000.2-py38-misc.patch.gz"
21         KEYWORDS="amd64 ~x86"
22 fi
23
24 LICENSE="Apache-2.0"
25 SLOT="0"
26 IUSE="cheetah cherrypy ldap libcloud libvirt genshi gnupg keyring mako
27         mongodb neutron nova openssl portage profile redis selinux test raet
28         +zeromq vim-syntax"
29
30 RDEPEND="
31         sys-apps/pciutils
32         dev-python/distro[${PYTHON_USEDEP}]
33         dev-python/jinja[${PYTHON_USEDEP}]
34         dev-python/libnacl[${PYTHON_USEDEP}]
35         >=dev-python/msgpack-0.5[${PYTHON_USEDEP}]
36         <dev-python/msgpack-1.0[${PYTHON_USEDEP}]
37         dev-python/pycryptodome[${PYTHON_USEDEP}]
38         dev-python/pyyaml[${PYTHON_USEDEP}]
39         dev-python/markupsafe[${PYTHON_USEDEP}]
40         >=dev-python/requests-1.0.0[${PYTHON_USEDEP}]
41         dev-python/setuptools[${PYTHON_USEDEP}]
42         libcloud? ( >=dev-python/libcloud-0.14.0[${PYTHON_USEDEP}] )
43         mako? ( dev-python/mako[${PYTHON_USEDEP}] )
44         ldap? ( dev-python/python-ldap[${PYTHON_USEDEP}] )
45         libvirt? (
46                 $(python_gen_cond_dep 'dev-python/libvirt-python[${PYTHON_USEDEP}]' python3_7)
47         )
48         openssl? (
49                 dev-libs/openssl:0=[-bindist]
50                 dev-python/pyopenssl[${PYTHON_USEDEP}]
51         )
52         raet? (
53                 >=dev-python/libnacl-1.0.0[${PYTHON_USEDEP}]
54                 >=dev-python/ioflo-1.1.7[${PYTHON_USEDEP}]
55                 >=dev-python/raet-0.6.0[${PYTHON_USEDEP}]
56         )
57         cherrypy? ( >=dev-python/cherrypy-3.2.2[${PYTHON_USEDEP}] )
58         cheetah? ( dev-python/cheetah3[${PYTHON_USEDEP}] )
59         mongodb? ( dev-python/pymongo[${PYTHON_USEDEP}] )
60         portage? ( sys-apps/portage[${PYTHON_USEDEP}] )
61         keyring? ( dev-python/keyring[${PYTHON_USEDEP}] )
62         redis? ( dev-python/redis-py[${PYTHON_USEDEP}] )
63         selinux? ( sec-policy/selinux-salt )
64         nova? (
65                 $(python_gen_cond_dep '>=dev-python/python-novaclient-2.17.0[${PYTHON_USEDEP}]' python3_7)
66         )
67         neutron? (
68                 $(python_gen_cond_dep '>=dev-python/python-neutronclient-2.3.6[${PYTHON_USEDEP}]' python3_7)
69         )
70         gnupg? ( dev-python/python-gnupg[${PYTHON_USEDEP}] )
71         profile? ( dev-python/yappi[${PYTHON_USEDEP}] )
72         vim-syntax? ( app-vim/salt-vim )
73         zeromq? ( >=dev-python/pyzmq-2.2.0[${PYTHON_USEDEP}] )
74 "
75 BDEPEND="
76         test? (
77                 ${RDEPEND}
78                 >=dev-python/boto-2.32.1[${PYTHON_USEDEP}]
79                 >=dev-python/jsonschema-3.0[${PYTHON_USEDEP}]
80                 >=dev-python/libcloud-0.14.0[${PYTHON_USEDEP}]
81                 >=dev-python/mock-2.0.0[${PYTHON_USEDEP}]
82                 >=dev-python/moto-0.3.6[${PYTHON_USEDEP}]
83                 dev-python/pip[${PYTHON_USEDEP}]
84                 dev-python/psutil[${PYTHON_USEDEP}]
85                 dev-python/pytest[${PYTHON_USEDEP}]
86                 dev-python/pytest-helpers-namespace[${PYTHON_USEDEP}]
87                 dev-python/pytest-helpers-namespace[${PYTHON_USEDEP}]
88                 >=dev-python/pytest-salt-2018.12.8[${PYTHON_USEDEP}]
89                 dev-python/pytest-tempdir[${PYTHON_USEDEP}]
90                 >=dev-python/SaltTesting-2016.5.11[${PYTHON_USEDEP}]
91                 dev-python/virtualenv[${PYTHON_USEDEP}]
92                 !x86? ( >=dev-python/boto3-1.2.1[${PYTHON_USEDEP}] )
93         )"
94
95 DOCS=( README.rst AUTHORS )
96
97 REQUIRED_USE="|| ( raet zeromq )
98         test? ( cheetah genshi )"
99 RESTRICT="!test? ( test ) x86? ( test )"
100
101 PATCHES=(
102         "${FILESDIR}/salt-2017.7.0-dont-realpath-tmpdir.patch"
103         "${FILESDIR}/salt-2019.2.0-skip-tests-that-oom-machine.patch"
104         "${FILESDIR}/salt-3000.1-tests.patch"
105         "${FILESDIR}/salt-3000.2-tests.patch"
106
107         # https://github.com/saltstack/salt/pull/55410
108         "${FILESDIR}/salt-3000.2-py38.patch"
109
110         # https://github.com/saltstack/salt/pull/55900
111         "${FILESDIR}/salt-3000.2-py38-abc.patch"
112
113         # misc py38 fixups
114         "${WORKDIR}/salt-3000.2-py38-misc.patch"
115         "${FILESDIR}/salt-3000.2-py38-logwarn.patch"
116 )
117
118 python_prepare() {
119         # remove tests with external dependencies that may not be available
120         rm tests/unit/{test_zypp_plugins.py,utils/test_extend.py} || die
121         rm tests/unit/modules/test_{file,boto_{vpc,secgroup,elb}}.py || die
122         rm tests/unit/states/test_boto_vpc.py || die
123
124         # tests that require network access
125         rm tests/unit/{states,modules}/test_zcbuildout.py || die
126
127         # make sure pkg_resources doesn't bomb because pycrypto isn't installed
128         find . -name '*.txt' -print0 | xargs -0 sed -e '/pycrypto>/ d' -i || die
129
130         einfo "Fixing collections.abc warnings for ${EPYTHON}"
131         local abc
132         abc="$("${EPYTHON}" -c 'import collections.abc; print("|".join((c for c in dir(collections.abc) if not c.startswith("_"))))')" || die
133         find -name '*.py' -type f -print0 | xargs -0 sed -r -e "s:collections\\.(${abc}):collections.abc.\\1:g" -i || die
134
135         # allow the use of the renamed msgpack
136         sed -i '/^msgpack/d' requirements/base.txt || die
137 }
138
139 python_install_all() {
140         local svc
141         USE_SETUPTOOLS=1 distutils-r1_python_install_all
142
143         for svc in minion master syndic api; do
144                 newinitd "${FILESDIR}"/${svc}-initd-4 salt-${svc}
145                 newconfd "${FILESDIR}"/${svc}-confd-1 salt-${svc}
146                 systemd_dounit "${FILESDIR}"/salt-${svc}.service
147         done
148
149         insinto /etc/${PN}
150         doins -r conf/*
151 }
152
153 python_test() {
154         local tempdir
155         # testsuite likes lots of files
156         ulimit -n 3072 || die
157
158         # ${T} is too long a path for the tests to work
159         tempdir="$(mktemp -du --tmpdir=/tmp salt-XXX)"
160         mkdir "${T}/$(basename "${tempdir}")"
161
162         (
163                 cleanup() { rm -f "${tempdir}" || die; }
164
165                 trap cleanup EXIT
166
167                 addwrite "${tempdir}"
168                 ln -s "$(realpath --relative-to=/tmp "${T}/$(basename "${tempdir}")")" "${tempdir}" || die
169
170                 USE_SETUPTOOLS=1 SHELL="/bin/bash" \
171                         TMPDIR="${tempdir}" \
172                         ${EPYTHON} tests/runtests.py \
173                         --unit-tests --no-report --verbose \
174                         || die "testing failed with ${EPYTHON}"
175         )
176 }
177
178 pkg_postinst() {
179         if use python_targets_python3_8; then
180                 if use nova; then
181                         ewarn "Salt's nova functionality will not work with python3.8 since"
182                         ewarn "dev-python/python-novaclient does not support it yet"
183                 fi
184                 if use neutron; then
185                         ewarn "Salt's neutron functionality will not work with python3.8 since"
186                         ewarn "dev-python/python-neutronclient does not support it yet"
187                 fi
188                 if use libvirt; then
189                         ewarn "Salt's libvirt functionality will not work with python3.8 since"
190                         ewarn "dev-python/libvirt-python does not support it yet"
191                 fi
192         fi
193 }