1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python3_{7,8} )
6 DISTUTILS_USE_SETUPTOOLS=bdepend
7 inherit systemd distutils-r1
9 DESCRIPTION="Salt is a remote execution and configuration manager"
10 HOMEPAGE="https://www.saltstack.com/resources/community/
11 https://github.com/saltstack"
13 if [[ ${PV} == 9999* ]]; then
15 EGIT_REPO_URI="git://github.com/${PN}stack/${PN}.git"
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"
26 IUSE="cheetah cherrypy ldap libcloud libvirt genshi gnupg keyring mako
27 mongodb neutron nova openssl portage profile redis selinux test raet
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}] )
46 $(python_gen_cond_dep 'dev-python/libvirt-python[${PYTHON_USEDEP}]' python3_7)
49 dev-libs/openssl:0=[-bindist]
50 dev-python/pyopenssl[${PYTHON_USEDEP}]
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}]
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 )
65 $(python_gen_cond_dep '>=dev-python/python-novaclient-2.17.0[${PYTHON_USEDEP}]' python3_7)
68 $(python_gen_cond_dep '>=dev-python/python-neutronclient-2.3.6[${PYTHON_USEDEP}]' python3_7)
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}] )
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}] )
95 DOCS=( README.rst AUTHORS )
97 REQUIRED_USE="|| ( raet zeromq )
98 test? ( cheetah genshi )"
99 RESTRICT="!test? ( test ) x86? ( test )"
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"
107 # https://github.com/saltstack/salt/pull/55410
108 "${FILESDIR}/salt-3000.2-py38.patch"
110 # https://github.com/saltstack/salt/pull/55900
111 "${FILESDIR}/salt-3000.2-py38-abc.patch"
114 "${WORKDIR}/salt-3000.2-py38-misc.patch"
115 "${FILESDIR}/salt-3000.2-py38-logwarn.patch"
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
124 # tests that require network access
125 rm tests/unit/{states,modules}/test_zcbuildout.py || die
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
130 einfo "Fixing collections.abc warnings for ${EPYTHON}"
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
135 # allow the use of the renamed msgpack
136 sed -i '/^msgpack/d' requirements/base.txt || die
139 python_install_all() {
141 USE_SETUPTOOLS=1 distutils-r1_python_install_all
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
155 # testsuite likes lots of files
156 ulimit -n 3072 || die
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}")"
163 cleanup() { rm -f "${tempdir}" || die; }
167 addwrite "${tempdir}"
168 ln -s "$(realpath --relative-to=/tmp "${T}/$(basename "${tempdir}")")" "${tempdir}" || die
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}"
179 if use python_targets_python3_8; 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"
185 ewarn "Salt's neutron functionality will not work with python3.8 since"
186 ewarn "dev-python/python-neutronclient does not support it yet"
189 ewarn "Salt's libvirt functionality will not work with python3.8 since"
190 ewarn "dev-python/libvirt-python does not support it yet"