commit:     a45e4d2c17e89cb348697c75ef4b9797a09e00d5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 16 14:36:42 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Oct 16 14:42:08 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a45e4d2c

dev-python/oslo-utils: Backport >=dev-python/netaddr-1 patch

Closes: https://bugs.gentoo.org/924373
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/oslo-utils-7.3.0-netaddr-1.patch         | 37 +++++++++++++
 dev-python/oslo-utils/oslo-utils-7.3.0-r1.ebuild   | 60 ++++++++++++++++++++++
 2 files changed, 97 insertions(+)

diff --git a/dev-python/oslo-utils/files/oslo-utils-7.3.0-netaddr-1.patch 
b/dev-python/oslo-utils/files/oslo-utils-7.3.0-netaddr-1.patch
new file mode 100644
index 000000000000..93c9a0bc015a
--- /dev/null
+++ b/dev-python/oslo-utils/files/oslo-utils-7.3.0-netaddr-1.patch
@@ -0,0 +1,37 @@
+From 20983093b42bf5a9c43f8fa5d23784d26ccbd7b7 Mon Sep 17 00:00:00 2001
+From: Takashi Kajinami <[email protected]>
+Date: Mon, 7 Oct 2024 11:06:26 +0900
+Subject: [PATCH] Fix compatibility with netaddr 1.1.0
+
+Fix a few different behaviors detected in unit tests.
+
+Closes-Bug: #2054134
+Change-Id: I34f29d983fccc10cc4994fb23527a6dd0eac2b83
+---
+ oslo_utils/netutils.py | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/oslo_utils/netutils.py b/oslo_utils/netutils.py
+index 6e4c54c1..405256ee 100644
+--- a/oslo_utils/netutils.py
++++ b/oslo_utils/netutils.py
+@@ -101,6 +101,9 @@ def is_valid_ipv4(address, strict=None):
+        (``a.b.c.d``) as opposed to address format
+        (``a.b.c.d``, ``a.b.c``, ``a.b``, ``a``).
+     """
++    if not address:
++        return False
++
+     if strict is not None:
+         flag = INET_PTON if strict else INET_ATON
+         try:
+@@ -228,6 +231,9 @@ def get_ipv6_addr_by_EUI64(prefix, mac):
+ 
+     .. versionadded:: 1.4
+     """
++    if not isinstance(prefix, str):
++        msg = _("Prefix must be a string")
++        raise TypeError(msg)
+     # Check if the prefix is an IPv4 address
+     if is_valid_ipv4(prefix):
+         msg = _("Unable to generate IP address by EUI64 for IPv4 prefix")

diff --git a/dev-python/oslo-utils/oslo-utils-7.3.0-r1.ebuild 
b/dev-python/oslo-utils/oslo-utils-7.3.0-r1.ebuild
new file mode 100644
index 000000000000..1bcc92b47ea4
--- /dev/null
+++ b/dev-python/oslo-utils/oslo-utils-7.3.0-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYPI_NO_NORMALIZE=1
+PYPI_PN=${PN/-/.}
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Oslo Utility library"
+HOMEPAGE="
+       https://opendev.org/openstack/oslo.utils/
+       https://github.com/openstack/oslo.utils/
+       https://pypi.org/project/oslo.utils/
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
+
+RDEPEND="
+       >=dev-python/iso8601-0.1.11[${PYTHON_USEDEP}]
+       >=dev-python/oslo-i18n-3.15.3[${PYTHON_USEDEP}]
+       >=dev-python/netaddr-0.10.0[${PYTHON_USEDEP}]
+       >=dev-python/netifaces-0.10.4[${PYTHON_USEDEP}]
+       >=dev-python/debtcollector-1.2.0[${PYTHON_USEDEP}]
+       >=dev-python/pyparsing-2.1.0[${PYTHON_USEDEP}]
+       >=dev-python/packaging-20.4[${PYTHON_USEDEP}]
+       >=dev-python/pyyaml-3.13[${PYTHON_USEDEP}]
+       dev-python/tzdata[${PYTHON_USEDEP}]
+"
+# qemu needed for qemu-img
+BDEPEND="
+       >=dev-python/pbr-2.2.0[${PYTHON_USEDEP}]
+       test? (
+               app-emulation/qemu
+               >=dev-python/fixtures-3.0.0[${PYTHON_USEDEP}]
+               >=dev-python/testscenarios-0.4[${PYTHON_USEDEP}]
+               >=dev-python/testtools-2.2.0[${PYTHON_USEDEP}]
+               >=dev-python/oslotest-3.2.0[${PYTHON_USEDEP}]
+               >=dev-python/ddt-1.0.1[${PYTHON_USEDEP}]
+       )
+"
+
+distutils_enable_tests unittest
+
+src_prepare() {
+       local PATCHES=(
+               # https://review.opendev.org/c/openstack/oslo.utils/+/931597
+               "${FILESDIR}/${P}-netaddr-1.patch"
+       )
+
+       distutils-r1_src_prepare
+
+       # require eventlet
+       rm oslo_utils/tests/test_eventletutils.py || die
+}

Reply via email to