diff options
author | Patrick McLean <chutzpah@gentoo.org> | 2022-03-30 17:53:06 -0700 |
---|---|---|
committer | Patrick McLean <chutzpah@gentoo.org> | 2022-03-30 18:28:07 -0700 |
commit | f799fa96b2c8dcf29ea8fadb860ca8df51d17192 (patch) | |
tree | ef5337ed7f4a0d51ff7305039c7c87d769e30397 /app-admin | |
parent | dev-python/ioflo: update EAPI 7 -> 8, add py3.10 (diff) | |
download | gentoo-f799fa96b2c8dcf29ea8fadb860ca8df51d17192.tar.gz gentoo-f799fa96b2c8dcf29ea8fadb860ca8df51d17192.tar.bz2 gentoo-f799fa96b2c8dcf29ea8fadb860ca8df51d17192.zip |
app-admin/salt: add 3004.1
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
Diffstat (limited to 'app-admin')
-rw-r--r-- | app-admin/salt/Manifest | 1 | ||||
-rw-r--r-- | app-admin/salt/files/salt-3004.1-jinja-3.patch | 40 | ||||
-rw-r--r-- | app-admin/salt/files/salt-3004.1-tests.patch | 291 | ||||
-rw-r--r-- | app-admin/salt/salt-3004.1.ebuild | 204 |
4 files changed, 536 insertions, 0 deletions
diff --git a/app-admin/salt/Manifest b/app-admin/salt/Manifest index 74cedfb26638..3ee27efecc4d 100644 --- a/app-admin/salt/Manifest +++ b/app-admin/salt/Manifest @@ -5,3 +5,4 @@ DIST salt-3001.8.tar.gz 15740488 BLAKE2B 77875a670b81438280becd1f29b64fbc7663791 DIST salt-3002.7.tar.gz 15792124 BLAKE2B b4cb4a6d73c45f3c2183a7adfe8196bbc5788dce1995bd5c640cd9957bdfdba2e96deebaba927d6103fc50f4eaab86d51f4dd4594d25b7357db79ed67b39258e SHA512 c1e7bbcd39b5c2bef351bd74026346bf729839c4161f6eff8162620e9cb08a63073abeeb8af6bab635070386a883df494ef08cc07a84efa9aa7f2160b357a938 DIST salt-3003.3.tar.gz 16017984 BLAKE2B 9cd1e33a7b6dff4d3c6c5a87e1204f7f113b6190da8301061e26fcec178aba597a9e17ab60a54a67b52a895a9a8aef58bec70e9fdd8d8edc5a42945f6de21a58 SHA512 4fe50922833fce48fcc679adb16a0e1fe893531b2feb08b235a1461c58b8d9a72af2acd89fc0f712207fb0cd215d6b446e31a40001b46c43d0cc4ac827ce29e3 DIST salt-3003.tar.gz 15830910 BLAKE2B ea4f02eece951c3fb4fcc480d00f7b531ac549b2e23ff9a210b73f749f9ba83e0402e02a59028f41f94958d17512e417b7c1b7015e8ee3aeac55be9b1374fe6f SHA512 7f631466372f303c03f2852a5cfba1ee5c6ba1636a6fe1e1622e90d0b1376ef9f670aa1b4754f3d9c8c7fe1b99fe1b4c49e140dc86d90d157a1ec1e73ba43c38 +DIST salt-3004.1.tar.gz 17685649 BLAKE2B 64950cdc8420228f935d4a21fc20872da9ecf7c51b866ec3c59b46486b84a739b002acc44fa909eed93ce3dc6bedc9804df05d3d9ee5a9a13cd9d041ba70f876 SHA512 9353a8dc2a1c6e272318c6f35059236c5d78b6c8930f715275b701c12fca3be1fe930eb533f3f0c22933ba60967b0980300b922fe486cee9a62e6cdb568bdf91 diff --git a/app-admin/salt/files/salt-3004.1-jinja-3.patch b/app-admin/salt/files/salt-3004.1-jinja-3.patch new file mode 100644 index 000000000000..98f21bc35129 --- /dev/null +++ b/app-admin/salt/files/salt-3004.1-jinja-3.patch @@ -0,0 +1,40 @@ +diff --git a/salt/utils/jinja.py b/salt/utils/jinja.py +index 0cb70bf64a..322c2f7f46 100644 +--- a/salt/utils/jinja.py ++++ b/salt/utils/jinja.py +@@ -25,10 +25,11 @@ import salt.utils.json + import salt.utils.stringutils + import salt.utils.url + import salt.utils.yaml +-from jinja2 import BaseLoader, Markup, TemplateNotFound, nodes ++from jinja2 import BaseLoader, TemplateNotFound, nodes + from jinja2.environment import TemplateModule + from jinja2.exceptions import TemplateRuntimeError + from jinja2.ext import Extension ++from markupsafe import Markup + from salt.exceptions import TemplateError + from salt.utils.decorators.jinja import jinja_filter, jinja_global, jinja_test + from salt.utils.odict import OrderedDict +@@ -706,7 +707,7 @@ def method_call(obj, f_name, *f_args, **f_kwargs): + return getattr(obj, f_name, lambda *args, **kwargs: None)(*f_args, **f_kwargs) + + +-@jinja2.contextfunction ++@jinja2.pass_context + def show_full_context(ctx): + return salt.utils.data.simple_types_filter( + {key: value for key, value in ctx.items()} +diff --git a/tests/unit/utils/test_jinja.py b/tests/unit/utils/test_jinja.py +index 6502831aff..dec847364a 100644 +--- a/tests/unit/utils/test_jinja.py ++++ b/tests/unit/utils/test_jinja.py +@@ -22,7 +22,8 @@ import salt.utils.files + import salt.utils.json + import salt.utils.stringutils + import salt.utils.yaml +-from jinja2 import DictLoader, Environment, Markup, exceptions ++from jinja2 import DictLoader, Environment, exceptions ++from markupsafe import Markup + from salt.exceptions import SaltRenderError + from salt.utils.decorators.jinja import JinjaFilter + from salt.utils.jinja import ( diff --git a/app-admin/salt/files/salt-3004.1-tests.patch b/app-admin/salt/files/salt-3004.1-tests.patch new file mode 100644 index 000000000000..3a36977246f2 --- /dev/null +++ b/app-admin/salt/files/salt-3004.1-tests.patch @@ -0,0 +1,291 @@ +diff --git a/tests/pytests/functional/fileserver/test_roots.py b/tests/pytests/functional/fileserver/test_roots.py +index c65efc8d52..9060fb61e2 100644 +--- a/tests/pytests/functional/fileserver/test_roots.py ++++ b/tests/pytests/functional/fileserver/test_roots.py +@@ -15,6 +15,7 @@ def configure_loader_modules(base_env_state_tree_root_dir): + return {roots: {"__opts__": opts}} + + ++@pytest.mark.skip("needs network access") + # nox -e pytest-zeromq-3.8(coverage=False) -- -vvv --run-slow --run-destructive tests\pytests\functional\fileserver\test_roots.py + def test_symlink_list(base_env_state_tree_root_dir): + with pytest.helpers.temp_file( +diff --git a/tests/pytests/functional/pillar/test_gpg.py b/tests/pytests/functional/pillar/test_gpg.py +index aaa4733f1d..b55cc9b4cf 100644 +--- a/tests/pytests/functional/pillar/test_gpg.py ++++ b/tests/pytests/functional/pillar/test_gpg.py +@@ -203,7 +203,7 @@ def gpg_homedir(salt_master, pillar_state_tree): + universal_newlines=True, + ) + ret = ProcessResult( +- exitcode=proc.returncode, ++ returncode=proc.returncode, + stdout=proc.stdout, + stderr=proc.stderr, + cmdline=proc.args, +@@ -220,7 +220,7 @@ def gpg_homedir(salt_master, pillar_state_tree): + input=TEST_KEY, + ) + ret = ProcessResult( +- exitcode=proc.returncode, ++ returncode=proc.returncode, + stdout=proc.stdout, + stderr=proc.stderr, + cmdline=proc.args, +@@ -250,7 +250,7 @@ def gpg_homedir(salt_master, pillar_state_tree): + input="KILLAGENT", + ) + ret = ProcessResult( +- exitcode=proc.returncode, ++ returncode=proc.returncode, + stdout=proc.stdout, + stderr=proc.stderr, + cmdline=proc.args, +diff --git a/tests/pytests/integration/cli/test_salt_proxy.py b/tests/pytests/integration/cli/test_salt_proxy.py +index c32c7e11e2..a9ee9fbd8d 100644 +--- a/tests/pytests/integration/cli/test_salt_proxy.py ++++ b/tests/pytests/integration/cli/test_salt_proxy.py +@@ -40,6 +40,7 @@ def test_exit_status_no_proxyid(salt_master, proxy_minion_id): + assert "error: salt-proxy requires --proxyid" in exc.value.stderr, exc.value + + ++@pytest.mark.skip("Currently broken") + @pytest.mark.skip_on_windows(reason="Windows does not do user checks") + def test_exit_status_unknown_user(salt_master, proxy_minion_id): + """ +@@ -66,7 +67,7 @@ def test_exit_status_unknown_argument(salt_master, proxy_minion_id): + factory = salt_master.salt_proxy_minion_daemon(proxy_minion_id) + factory.start("--unknown-argument", start_timeout=10, max_start_attempts=1) + +- assert exc.value.exitcode == salt.defaults.exitcodes.EX_USAGE, exc.value ++ assert exc.value.returncode == salt.defaults.exitcodes.EX_USAGE, exc.value + assert "Usage" in exc.value.stderr, exc.value + assert "no such option: --unknown-argument" in exc.value.stderr, exc.value + +@@ -89,8 +90,8 @@ def test_exit_status_correct_usage(salt_master, proxy_minion_id, salt_cli): + assert factory.is_running() + # Let's issue a ping before terminating + ret = salt_cli.run("test.ping", minion_tgt=proxy_minion_id) +- assert ret.exitcode == 0 ++ assert ret.returncode == 0 + assert ret.json is True + # Terminate the proxy minion + ret = factory.terminate() +- assert ret.exitcode == salt.defaults.exitcodes.EX_OK, ret ++ assert ret.returncode == salt.defaults.exitcodes.EX_OK, ret +diff --git a/tests/pytests/integration/sdb/test_vault.py b/tests/pytests/integration/sdb/test_vault.py +index 7dc4c55417..6c48296a0c 100644 +--- a/tests/pytests/integration/sdb/test_vault.py ++++ b/tests/pytests/integration/sdb/test_vault.py +@@ -107,7 +107,7 @@ def vault_container_version(request, salt_call_cli, vault_port): + if proc.returncode == 0: + break + ret = ProcessResult( +- exitcode=proc.returncode, ++ returncode=proc.returncode, + stdout=proc.stdout, + stderr=proc.stderr, + cmdline=proc.args, +@@ -133,7 +133,7 @@ def vault_container_version(request, salt_call_cli, vault_port): + ) + if proc.returncode != 0: + ret = ProcessResult( +- exitcode=proc.returncode, ++ returncode=proc.returncode, + stdout=proc.stdout, + stderr=proc.stderr, + cmdline=proc.args, +@@ -150,7 +150,7 @@ def vault_container_version(request, salt_call_cli, vault_port): + universal_newlines=True, + ) + ret = ProcessResult( +- exitcode=proc.returncode, ++ returncode=proc.returncode, + stdout=proc.stdout, + stderr=proc.stderr, + cmdline=proc.args, +diff --git a/tests/pytests/unit/modules/test_cmdmod.py b/tests/pytests/unit/modules/test_cmdmod.py +index bc1d2818aa..3bd93862b7 100644 +--- a/tests/pytests/unit/modules/test_cmdmod.py ++++ b/tests/pytests/unit/modules/test_cmdmod.py +@@ -440,6 +440,7 @@ def test_run_cwd_doesnt_exist_issue_7154(): + cmdmod.run_all(cmd, cwd=cwd) + + ++@pytest.mark.skip("needs root access") + @pytest.mark.skip_on_darwin + @pytest.mark.skip_on_windows + def test_run_cwd_in_combination_with_runas(): +diff --git a/tests/pytests/unit/modules/test_portage_config.py b/tests/pytests/unit/modules/test_portage_config.py +index 5cc6b90596..db37d2c4f1 100644 +--- a/tests/pytests/unit/modules/test_portage_config.py ++++ b/tests/pytests/unit/modules/test_portage_config.py +@@ -29,6 +29,7 @@ def test_get_config_file_wildcards(): + assert portage_config._get_config_file("mask", atom) == expected + + ++@pytest.mark.skip("test needs root access") + def test_enforce_nice_config(tmp_path): + atoms = [ + ("*/*::repo", "repo"), +diff --git a/tests/pytests/unit/state/test_state_compiler.py b/tests/pytests/unit/state/test_state_compiler.py +index fc43cf154d..7aa511c9f7 100644 +--- a/tests/pytests/unit/state/test_state_compiler.py ++++ b/tests/pytests/unit/state/test_state_compiler.py +@@ -679,6 +679,7 @@ def test_verify_retry_parsing(): + assert set(expected_result).issubset(set(state_obj.call(low_data))) + + ++@pytest.mark.skip("test requires root access") + def test_render_requisite_require_disabled(): + """ + Test that the state compiler correctly deliver a rendering +@@ -719,6 +720,7 @@ def test_render_requisite_require_disabled(): + assert run_num == 0 + + ++@pytest.mark.skip("test requires root access") + def test_render_requisite_require_in_disabled(): + """ + Test that the state compiler correctly deliver a rendering +diff --git a/tests/pytests/unit/state/test_state_format_slots.py b/tests/pytests/unit/state/test_state_format_slots.py +index 57b7bb2b87..7d2abce8d0 100644 +--- a/tests/pytests/unit/state/test_state_format_slots.py ++++ b/tests/pytests/unit/state/test_state_format_slots.py +@@ -218,6 +218,7 @@ def test_slot_append(state_obj): + assert cdata == {"args": ["arg"], "kwargs": {"key": "value1thing~"}} + + ++@pytest.mark.skip("test needs root") + # Skip on windows like integration.modules.test_state.StateModuleTest.test_parallel_state_with_long_tag + @skipIf( + salt.utils.platform.is_windows(), +diff --git a/tests/pytests/unit/test_minion.py b/tests/pytests/unit/test_minion.py +index 985ec99276..eb8a476e30 100644 +--- a/tests/pytests/unit/test_minion.py ++++ b/tests/pytests/unit/test_minion.py +@@ -493,6 +493,7 @@ def test_scheduler_before_connect(): + minion.destroy() + + ++@pytest.mark.skip("test needs root access") + def test_minion_module_refresh(): + """ + Tests that the 'module_refresh' just return in case there is no 'schedule' +@@ -520,6 +521,7 @@ def test_minion_module_refresh(): + minion.destroy() + + ++@pytest.mark.skip("test needs root access") + def test_minion_module_refresh_beacons_refresh(): + """ + Tests that 'module_refresh' calls beacons_refresh and that the +diff --git a/tests/pytests/unit/test_version.py b/tests/pytests/unit/test_version.py +index bc6bbfeadd..2653b558b0 100644 +--- a/tests/pytests/unit/test_version.py ++++ b/tests/pytests/unit/test_version.py +@@ -140,6 +140,7 @@ def test_sha(commit, match): + assert ret is None + + ++@pytest.mark.skip("test is broken if some optional deps aren't installed") + def test_version_report_lines(): + """ + Validate padding in versions report is correct +diff --git a/tests/support/helpers.py b/tests/support/helpers.py +index d82b14cb90..751018162c 100644 +--- a/tests/support/helpers.py ++++ b/tests/support/helpers.py +@@ -40,7 +40,7 @@ import salt.utils.platform + import salt.utils.pycrypto + import salt.utils.stringutils + import salt.utils.versions +-from saltfactories.exceptions import FactoryFailure as ProcessFailed ++from pytestshellutils.exceptions import FactoryFailure as ProcessFailed + from saltfactories.utils.ports import get_unused_localhost_port + from saltfactories.utils.processes import ProcessResult + from tests.support.mock import patch +@@ -1720,7 +1720,7 @@ class VirtualEnv: + kwargs.setdefault("env", self.environ) + proc = subprocess.run(args, check=False, **kwargs) + ret = ProcessResult( +- exitcode=proc.returncode, ++ returncode=proc.returncode, + stdout=proc.stdout, + stderr=proc.stderr, + cmdline=proc.args, +@@ -1735,7 +1735,7 @@ class VirtualEnv: + cmdline=proc.args, + stdout=proc.stdout, + stderr=proc.stderr, +- exitcode=proc.returncode, ++ returncode=proc.returncode, + ) + return ret + +diff --git a/tests/unit/modules/test_boto_route53.py b/tests/unit/modules/test_boto_route53.py +index 1d3d1393a9..df331761e2 100644 +--- a/tests/unit/modules/test_boto_route53.py ++++ b/tests/unit/modules/test_boto_route53.py +@@ -4,6 +4,8 @@ from collections import namedtuple + + import pkg_resources # pylint: disable=3rd-party-module-not-gated + ++import pytest ++ + import salt.config + import salt.loader + import salt.utils.versions +@@ -99,6 +101,7 @@ class BotoRoute53TestCase(TestCase, LoaderModuleMockMixin): + def tearDown(self): + del self.opts + ++ @pytest.mark.skip("test currently broken") + @mock_route53_deprecated + def test_create_healthcheck(self): + """ +diff --git a/tests/unit/utils/test_parsers.py b/tests/unit/utils/test_parsers.py +index 907c67f477..3f68cfe8f3 100644 +--- a/tests/unit/utils/test_parsers.py ++++ b/tests/unit/utils/test_parsers.py +@@ -6,6 +6,8 @@ import os + import shutil + import tempfile + ++import pytest ++ + import salt.config + import salt.log.setup as log + import salt.syspaths +@@ -983,6 +985,7 @@ class SaltRunOptionParserTestCase(ParserBase, TestCase): + if os.path.exists(self.log_file): + os.unlink(self.log_file) + ++ @pytest.mark.skip("needs root access") + def test_jid_option(self): + jid = salt.utils.jid.gen_jid({}) + args = ["--jid", jid] +@@ -991,6 +994,7 @@ class SaltRunOptionParserTestCase(ParserBase, TestCase): + parser.parse_args(args) + assert parser.options.jid == jid + ++ @pytest.mark.skip("needs root access") + def test_jid_option_invalid(self): + jid = salt.utils.jid.gen_jid({}) + "A" + args = ["--jid", jid] +@@ -1041,6 +1045,7 @@ class SaltSSHOptionParserTestCase(ParserBase, TestCase): + if os.path.exists(self.ssh_log_file): + os.unlink(self.ssh_log_file) + ++ @pytest.mark.skip("needs root access") + def test_jid_option(self): + jid = salt.utils.jid.gen_jid({}) + args = ["--jid", jid] + self.args +@@ -1049,6 +1054,7 @@ class SaltSSHOptionParserTestCase(ParserBase, TestCase): + parser.parse_args(args) + assert parser.options.jid == jid + ++ @pytest.mark.skip("needs root access") + def test_jid_option_invalid(self): + jid = salt.utils.jid.gen_jid({}) + "A" + args = ["--jid", jid] + self.args diff --git a/app-admin/salt/salt-3004.1.ebuild b/app-admin/salt/salt-3004.1.ebuild new file mode 100644 index 000000000000..6f097cc01663 --- /dev/null +++ b/app-admin/salt/salt-3004.1.ebuild @@ -0,0 +1,204 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +PYTHON_COMPAT=( python3_{8..10} ) + +inherit systemd distutils-r1 + +DESCRIPTION="Salt is a remote execution and configuration manager" +HOMEPAGE="https://www.saltstack.com/resources/community/ + https://github.com/saltstack" + +if [[ ${PV} == 9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/${PN}stack/${PN}.git" + EGIT_BRANCH="develop" + SRC_URI="" +else + SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + KEYWORDS="~amd64" +fi + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="cheetah cherrypy ldap libcloud libvirt genshi gnupg keyring mako + mongodb neutron nova openssl portage profile redis selinux test raet + +zeromq vim-syntax" + +RDEPEND=" + sys-apps/pciutils + >=dev-python/distro-1.5[${PYTHON_USEDEP}] + >=dev-python/jinja-3.0[${PYTHON_USEDEP}] + dev-python/libnacl[${PYTHON_USEDEP}] + >=dev-python/msgpack-1.0.0[${PYTHON_USEDEP}] + >=dev-python/pycryptodome-3.9.8[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-python/markupsafe[${PYTHON_USEDEP}] + >=dev-python/requests-1.0.0[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}] + >=dev-python/toml-0.10.2[${PYTHON_USEDEP}] + dev-python/watchdog[${PYTHON_USEDEP}] + libcloud? ( >=dev-python/libcloud-2.5.0[${PYTHON_USEDEP}] ) + mako? ( dev-python/mako[${PYTHON_USEDEP}] ) + ldap? ( dev-python/python-ldap[${PYTHON_USEDEP}] ) + libvirt? ( + $(python_gen_cond_dep 'dev-python/libvirt-python[${PYTHON_USEDEP}]' python3_8) + ) + openssl? ( + dev-libs/openssl:0=[-bindist(-)] + dev-python/pyopenssl[${PYTHON_USEDEP}] + ) + raet? ( + >=dev-python/libnacl-1.0.0[${PYTHON_USEDEP}] + >=dev-python/ioflo-1.1.7[${PYTHON_USEDEP}] + >=dev-python/raet-0.6.0[${PYTHON_USEDEP}] + ) + cherrypy? ( >=dev-python/cherrypy-3.2.2[${PYTHON_USEDEP}] ) + cheetah? ( >=dev-python/cheetah3-3.2.2[${PYTHON_USEDEP}] ) + genshi? ( dev-python/genshi[${PYTHON_USEDEP}] ) + mongodb? ( dev-python/pymongo[${PYTHON_USEDEP}] ) + portage? ( sys-apps/portage[${PYTHON_USEDEP}] ) + keyring? ( dev-python/keyring[${PYTHON_USEDEP}] ) + redis? ( dev-python/redis-py[${PYTHON_USEDEP}] ) + selinux? ( sec-policy/selinux-salt ) + nova? ( + $(python_gen_cond_dep '>=dev-python/python-novaclient-2.17.0[${PYTHON_USEDEP}]' python3_8) + ) + neutron? ( + $(python_gen_cond_dep '>=dev-python/python-neutronclient-2.3.6[${PYTHON_USEDEP}]' python3_8) + ) + gnupg? ( dev-python/python-gnupg[${PYTHON_USEDEP}] ) + profile? ( dev-python/yappi[${PYTHON_USEDEP}] ) + vim-syntax? ( app-vim/salt-vim ) + zeromq? ( >=dev-python/pyzmq-2.2.0[${PYTHON_USEDEP}] ) +" +BDEPEND=" + test? ( + ${RDEPEND} + >=dev-python/boto-2.32.1[${PYTHON_USEDEP}] + >=dev-python/jsonschema-3.0[${PYTHON_USEDEP}] + dev-python/mako[${PYTHON_USEDEP}] + >=dev-python/mock-2.0.0[${PYTHON_USEDEP}] + >=dev-python/moto-0.3.6[${PYTHON_USEDEP}] + dev-python/pip[${PYTHON_USEDEP}] + >=dev-python/psutil-5.0.0[${PYTHON_USEDEP}] + dev-python/pyopenssl[${PYTHON_USEDEP}] + dev-python/pytest[${PYTHON_USEDEP}] + >=dev-python/pytest-salt-factories-1.0.0_rc13[${PYTHON_USEDEP}] + dev-python/pytest-tempdir[${PYTHON_USEDEP}] + dev-python/pytest-helpers-namespace[${PYTHON_USEDEP}] + dev-python/pytest-subtests[${PYTHON_USEDEP}] + dev-python/flaky[${PYTHON_USEDEP}] + dev-python/libcloud[${PYTHON_USEDEP}] + net-dns/bind-tools + >=dev-python/virtualenv-20.3.0[${PYTHON_USEDEP}] + !x86? ( >=dev-python/boto3-1.17.67[${PYTHON_USEDEP}] ) + )" + +DOCS=( README.rst AUTHORS ) + +REQUIRED_USE="|| ( raet zeromq ) + test? ( cheetah genshi )" +RESTRICT="!test? ( test ) x86? ( test )" + +PATCHES=( + "${FILESDIR}/salt-3003-skip-tests-that-oom-machine.patch" + "${FILESDIR}/salt-3003-gentoolkit-revdep.patch" + "${FILESDIR}/salt-3002-tests.patch" + "${FILESDIR}/salt-3003.1-tests.patch" + "${FILESDIR}/salt-3004.1-jinja-3.patch" + "${FILESDIR}/salt-3004.1-tests.patch" +) + +python_prepare_all() { + # remove tests with external dependencies that may not be available, and + # tests that don't work in sandbox + rm tests/unit/{test_{zypp_plugins,module_names},utils/test_extend}.py || die + rm tests/unit/modules/test_{file,boto_{vpc,secgroup,elb}}.py || die + rm tests/unit/states/test_boto_vpc.py || die + rm tests/support/gitfs.py tests/unit/runners/test_git_pillar.py || die + rm tests/pytests/functional/transport/server/test_req_channel.py || die + + # tests that require network access + rm tests/unit/{states,modules}/test_zcbuildout.py || die + rm -r tests/integration/cloud || die + rm -r tests/kitchen/tests/wordpress/tests || die + rm tests/kitchen/test_kitchen.py || die + rm tests/unit/modules/test_network.py || die + rm tests/pytests/functional/modules/test_pip.py || die + rm tests/pytests/unit/client/ssh/test_ssh.py || die + + # tests require root access + rm tests/integration/pillar/test_git_pillar.py || die + rm tests/integration/states/test_supervisord.py || die + + # make sure pkg_resources doesn't bomb because pycrypto isn't installed + find "${S}" -name '*.txt' -print0 | xargs -0 sed -e '/pycrypto>/ d ; /pycryptodomex/ d' -i || die + # pycryptodome rather than pycryptodomex + find "${S}" -name '*.py' -print0 | xargs -0 -- sed -i -e 's:Cryptodome:Crypto:g' -- || die + + distutils-r1_python_prepare_all +} + +python_prepare() { + einfo "Fixing collections.abc warnings for ${EPYTHON}" + local abc + abc="$("${EPYTHON}" -c 'import collections.abc; print("|".join((c for c in dir(collections.abc) if not c.startswith("_"))))')" || die + find -name '*.py' -type f -print0 | xargs -0 sed -r -e "s:collections\\.(${abc}):collections.abc.\\1:g" -i || die + + # removes contextvars, see bug: https://bugs.gentoo.org/799431 + sed -i '/^contextvars/d' requirements/base.txt || die +} + +python_install_all() { + local svc + USE_SETUPTOOLS=1 distutils-r1_python_install_all + + for svc in minion master syndic api; do + newinitd "${FILESDIR}"/${svc}-initd-5 salt-${svc} + newconfd "${FILESDIR}"/${svc}-confd-1 salt-${svc} + systemd_dounit "${FILESDIR}"/salt-${svc}.service + done + + insinto /etc/${PN} + doins -r conf/* +} + +python_test() { + # testsuite likes lots of files + ulimit -n 4096 || die + + # ${T} is too long a path for the tests to work + local TMPDIR + TMPDIR="$(mktemp --directory --tmpdir=/tmp ${PN}-XXXX)" + ( + export TMPDIR + cleanup() { rm -rf "${TMPDIR}" || die; } + + trap cleanup EXIT + + addwrite "${TMPDIR}" + + USE_SETUPTOOLS=1 NO_INTERNET=1 SHELL="/bin/bash" \ + "${EPYTHON}" -m pytest -vv \ + || die "testing failed with ${EPYTHON}" + ) +} + +pkg_postinst() { + if use python_targets_python3_8; then + if use nova; then + ewarn "Salt's nova functionality will not work with python3.8 since" + ewarn "dev-python/python-novaclient does not support it yet" + fi + if use neutron; then + ewarn "Salt's neutron functionality will not work with python3.8 since" + ewarn "dev-python/python-neutronclient does not support it yet" + fi + if use libvirt; then + ewarn "Salt's libvirt functionality will not work with python3.8 since" + ewarn "dev-python/libvirt-python does not support it yet" + fi + fi +} |