diff --git a/Replace_deprecated_import_ABCs_from_collections.patch b/Replace_deprecated_import_ABCs_from_collections.patch new file mode 100644 index 0000000000000000000000000000000000000000..7bef5ad9b2ab0a5d1807f4916f8fa53fd79197dd --- /dev/null +++ b/Replace_deprecated_import_ABCs_from_collections.patch @@ -0,0 +1,84 @@ +diff --git a/neutron/agent/ovsdb/api.py b/neutron/agent/ovsdb/api.py +index 2c54cea..bafc569 100644 +--- a/neutron/agent/ovsdb/api.py ++++ b/neutron/agent/ovsdb/api.py +@@ -12,13 +12,13 @@ + # License for the specific language governing permissions and limitations + # under the License. + +-import collections ++from collections import abc + import uuid + + + def val_to_py(val): + """Convert a json ovsdb return value to native python object""" +- if isinstance(val, collections.Sequence) and len(val) == 2: ++ if isinstance(val, abc.Sequence) and len(val) == 2: + if val[0] == "uuid": + return uuid.UUID(val[1]) + elif val[0] == "set": +diff --git a/neutron/objects/base.py b/neutron-18.6.0/neutron/objects/base.py +index 41a24ee..8131b34 100644 +--- a/neutron/objects/base.py ++++ b/neutron/objects/base.py +@@ -12,6 +12,7 @@ + + import abc + import collections ++from collections import abc as collections_abc + import copy + import functools + import itertools +@@ -281,7 +282,7 @@ class NeutronObject(obj_base.VersionedObject, + + @classmethod + def _update_objects(cls, objects, values): +- if not isinstance(objects, collections.Sequence): ++ if not isinstance(objects, collections_abc.Sequence): + objects = (objects, ) + + for obj in objects: +diff --git a/neutron/policy.py b/neutron-18.6.0/neutron/policy.py +index 7793343..1e5b03f 100644 +--- a/neutron/policy.py ++++ b/neutron/policy.py +@@ -13,7 +13,7 @@ + # License for the specific language governing permissions and limitations + # under the License. + +-import collections ++from collections import abc + import itertools + import re + import sys +@@ -142,7 +142,7 @@ def _is_attribute_explicitly_set(attribute_name, resource, target, action): + def _should_validate_sub_attributes(attribute, sub_attr): + """Verify that sub-attributes are iterable and should be validated.""" + validate = attribute.get('validate') +- return (validate and isinstance(sub_attr, collections.Iterable) and ++ return (validate and isinstance(sub_attr, abc.Iterable) and + any([k.startswith('type:dict') and + v for (k, v) in validate.items()])) + +diff --git a/neutron/tests/unit/objects/test_base.py b/neutron-18.6.0/neutron/tests/unit/objects/test_base.py +index bdcc9d8..9ce3023 100644 +--- a/neutron/tests/unit/objects/test_base.py ++++ b/neutron/tests/unit/objects/test_base.py +@@ -11,6 +11,7 @@ + # under the License. + + import collections ++from collections import abc + import copy + import itertools + import random +@@ -672,7 +673,7 @@ class _BaseObjectTestCase(object): + objs or self.objs): + val = v() if callable(v) else v + db_obj_key = obj.fields_need_translation.get(k, k) +- if isinstance(val, collections.Mapping): ++ if isinstance(val, abc.Mapping): + self.update_obj_fields( + val, db_obj[db_obj_key], fields[k], obj[k]) + else: diff --git a/openstack-neutron.spec b/openstack-neutron.spec index 98502bc429c268b02ac2cc945813b02a291f9647..291217ed35e4a01c8cd2be91a5e38e533e47c600 100644 --- a/openstack-neutron.spec +++ b/openstack-neutron.spec @@ -18,7 +18,7 @@ capabilities (e.g., QoS, ACLs, network monitoring, etc.) Name: openstack-%{service} Version: 18.6.0 -Release: 1 +Release: 2 Summary: OpenStack Networking Service License: ASL 2.0 @@ -54,6 +54,7 @@ Source36: neutron-destroy-patch-ports.service Source37: neutron-ovn-metadata-agent.service # Required for tarball sources verification +Patch000: Replace_deprecated_import_ABCs_from_collections.patch BuildArch: noarch BuildRequires: git-core @@ -384,7 +385,7 @@ OpenStack to OVN based backend. %prep -%autosetup -n %{service}-%{upstream_version} -S git +%autosetup -n %{service}-%{upstream_version} -S git -p1 sed -i 's/\/usr\/bin\/python/\/usr\/bin\/python3/' %{SOURCE36} find %{service} -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} + @@ -847,6 +848,9 @@ fi %{_datadir}/ansible/neutron-ovn-migration/ %changelog +* Sat May 25 2024 tzing_t - 18.6.0-2 +- Replace deprecated import ABCs from collections + * Thu Apr 27 2023 songchchao - 18.6.0-1 - Update to 18.6.0