diff options
author | Pavel Balaev <mail@void.so> | 2024-03-20 17:35:54 +0300 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-05-27 00:27:07 +0100 |
commit | d00ecdce359c8bc3d3520aef58d5808c7d15020b (patch) | |
tree | f884b1268a5dcb2af8f55f376de6a0aab39d6555 | |
parent | emerge.1: Fix /var/log/emerge.log description (diff) | |
download | portage-d00ecdce359c8bc3d3520aef58d5808c7d15020b.tar.gz portage-d00ecdce359c8bc3d3520aef58d5808c7d15020b.tar.bz2 portage-d00ecdce359c8bc3d3520aef58d5808c7d15020b.zip |
process: make has_ipv6 a public function
Signed-off-by: Pavel Balaev <mail@void.so>
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | lib/portage/process.py | 8 | ||||
-rw-r--r-- | lib/portage/tests/process/test_unshare_net.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/portage/process.py b/lib/portage/process.py index 1bc0c507c..6e4e0d716 100644 --- a/lib/portage/process.py +++ b/lib/portage/process.py @@ -631,8 +631,8 @@ def spawn( fd_pipes[1] = pw fd_pipes[2] = pw - # Cache _has_ipv6() result for use in child processes. - _has_ipv6() + # Cache has_ipv6() result for use in child processes. + has_ipv6() # This caches the libc library lookup and _unshare_validator results # in the current process, so that results are cached for use in @@ -751,7 +751,7 @@ def spawn( __has_ipv6 = None -def _has_ipv6(): +def has_ipv6(): """ Test that both userland and kernel support IPv6, by attempting to create a socket and listen on any unused port of the IPv6 @@ -812,7 +812,7 @@ def _configure_loopback_interface(): ifindex = rtnl.get_link_ifindex(b"lo") rtnl.set_link_up(ifindex) rtnl.add_address(ifindex, socket.AF_INET, "10.0.0.1", 8) - if _has_ipv6(): + if has_ipv6(): rtnl.add_address(ifindex, socket.AF_INET6, "fd::1", 8) except OSError as e: writemsg( diff --git a/lib/portage/tests/process/test_unshare_net.py b/lib/portage/tests/process/test_unshare_net.py index ad3b288ef..56d96da05 100644 --- a/lib/portage/tests/process/test_unshare_net.py +++ b/lib/portage/tests/process/test_unshare_net.py @@ -42,7 +42,7 @@ class UnshareNetTestCase(TestCase): f"Unable to unshare: {errno.errorcode.get(self.ABILITY_TO_UNSHARE, '?')}" ) env = os.environ.copy() - env["IPV6"] = "1" if portage.process._has_ipv6() else "" + env["IPV6"] = "1" if portage.process.has_ipv6() else "" self.assertEqual( portage.process.spawn( [BASH_BINARY, "-c", UNSHARE_NET_TEST_SCRIPT], unshare_net=True, env=env |