diff --git a/SPECS-EXTENDED/pywbem/0001-use-unittest-mock.patch b/SPECS-EXTENDED/pywbem/0001-use-unittest-mock.patch new file mode 100644 index 00000000000..09457112107 --- /dev/null +++ b/SPECS-EXTENDED/pywbem/0001-use-unittest-mock.patch @@ -0,0 +1,78 @@ +diff --git a/minimum-constraints.txt b/minimum-constraints.txt +index 570295ab..e771637b 100644 +--- a/minimum-constraints.txt ++++ b/minimum-constraints.txt +@@ -92,7 +92,6 @@ wheel==0.33.5; python_version >= '3.8' + # Direct dependencies for install (must be consistent with requirements.txt) + + M2Crypto==0.31.0 +-mock==2.0.0 + ordereddict==1.1 + ply==3.10 + PyYAML==3.11; python_version == '2.6' +diff --git a/pywbem_mock/_wbemconnection_mock.py b/pywbem_mock/_wbemconnection_mock.py +index aa27b305..3eedb330 100644 +--- a/pywbem_mock/_wbemconnection_mock.py ++++ b/pywbem_mock/_wbemconnection_mock.py +@@ -40,7 +40,7 @@ try: + from collections import Counter + except ImportError: + from backport_collections import Counter +-from mock import Mock ++from unittest.mock import Mock + import six + + # pylint: disable=ungrouped-imports +diff --git a/requirements.txt b/requirements.txt +index 3ac782d5..1e5cd238 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -11,9 +11,6 @@ + + # On Windows, M2Crypto must be installed via pywbem_os_setup.bat + M2Crypto>=0.31.0; python_version < '3.0' and sys_platform != 'win32' +-mock>=2.0.0,<3.0.0; python_version == '2.6' +-mock>=2.0.0,<4.0.0; python_version >= '2.7' and python_version <= '3.5' +-mock>=2.0.0; python_version >= '3.6' + ordereddict>=1.1; python_version == '2.6' + ply>=3.10 + # PyYAML 5.3 has removed support for Python 3.4; fixes narrow build error +diff --git a/tests/unittest/pywbem/test_cim_obj.py b/tests/unittest/pywbem/test_cim_obj.py +index 2f6b89d2..d3f8a9aa 100755 +--- a/tests/unittest/pywbem/test_cim_obj.py ++++ b/tests/unittest/pywbem/test_cim_obj.py +@@ -9,7 +9,7 @@ from __future__ import absolute_import, print_function + import sys + import re + from datetime import timedelta, datetime +-from mock import patch ++from unittest.mock import patch + try: + from collections import OrderedDict + except ImportError: +diff --git a/tests/unittest/pywbem/test_itermethods.py b/tests/unittest/pywbem/test_itermethods.py +index f7d0f8da..c613c3df 100644 +--- a/tests/unittest/pywbem/test_itermethods.py ++++ b/tests/unittest/pywbem/test_itermethods.py +@@ -24,7 +24,7 @@ from __future__ import absolute_import, print_function + import pytest + import six + +-from mock import Mock ++from unittest.mock import Mock + + # pylint: disable=wrong-import-position, wrong-import-order, invalid-name + from ...utils import import_installed +diff --git a/tests/unittest/pywbem/test_valuemapping.py b/tests/unittest/pywbem/test_valuemapping.py +index bf93b87c..263294a5 100644 +--- a/tests/unittest/pywbem/test_valuemapping.py ++++ b/tests/unittest/pywbem/test_valuemapping.py +@@ -7,7 +7,7 @@ from __future__ import absolute_import + + import re + import pytest +-from mock import Mock ++from unittest.mock import Mock + + # pylint: disable=wrong-import-position, wrong-import-order, invalid-name + from ...utils import import_installed diff --git a/SPECS-EXTENDED/pywbem/0002-coverity-deadcode.patch b/SPECS-EXTENDED/pywbem/0002-coverity-deadcode.patch new file mode 100644 index 00000000000..c5df2c54bfe --- /dev/null +++ b/SPECS-EXTENDED/pywbem/0002-coverity-deadcode.patch @@ -0,0 +1,15 @@ +diff --git a/pywbem/_recorder.py b/pywbem/_recorder.py +index f5b2b7d6..70de34fe 100644 +--- a/pywbem/_recorder.py ++++ b/pywbem/_recorder.py +@@ -689,8 +689,8 @@ class LogOperationRecorder(BaseOperationRecorder): + # Format the 'summary' and 'paths' detail_levels + if self.api_detail_level == 'summary': # pylint: disable=R1705 + if isinstance(ret, list): +- if ret: +- ret_type = type(ret[0]).__name__ if ret else "" ++ if len(ret) > 0: ++ ret_type = type(ret[0]).__name__ + return _format("list of {0}; count={1}", + ret_type, len(ret)) + return "Empty" diff --git a/SPECS-EXTENDED/pywbem/0003-coverity-forward-null.patch b/SPECS-EXTENDED/pywbem/0003-coverity-forward-null.patch new file mode 100644 index 00000000000..acea02cc156 --- /dev/null +++ b/SPECS-EXTENDED/pywbem/0003-coverity-forward-null.patch @@ -0,0 +1,12 @@ +diff --git a/pywbem/_cim_obj.py b/pywbem/_cim_obj.py +index d91a2cb1..5c9a69a5 100644 +--- a/pywbem/_cim_obj.py ++++ b/pywbem/_cim_obj.py +@@ -1954,6 +1954,7 @@ class CIMInstanceName(_CIMComparisonMixin): + _format("WBEM URI has an invalid format for its keybindings: " + "{0!A}", keybindings_str)) + ++ kb_assigns = [] + if m.group(1): + kb_assigns = [m.group(1)] + diff --git a/SPECS-EXTENDED/pywbem/0004-coverity-identifier-typo.patch b/SPECS-EXTENDED/pywbem/0004-coverity-identifier-typo.patch new file mode 100644 index 00000000000..f394ea45f00 --- /dev/null +++ b/SPECS-EXTENDED/pywbem/0004-coverity-identifier-typo.patch @@ -0,0 +1,19 @@ +diff --git a/pywbem/_cim_xml.py b/pywbem/_cim_xml.py +index 133b070d..c0ad603e 100644 +--- a/pywbem/_cim_xml.py ++++ b/pywbem/_cim_xml.py +@@ -1829,12 +1829,12 @@ class RESPONSEDESTINATION(CIMElement): + + :: + +- ++ + """ + + def __init__(self, data): + # We use call by class name because it is an old-style class. +- CIMElement.__init__(self, 'RESPONSEDESTINATON') ++ CIMElement.__init__(self, 'RESPONSEDESTINATION') + self.appendChild(data) + + diff --git a/SPECS-EXTENDED/pywbem/0005-python3_12.patch b/SPECS-EXTENDED/pywbem/0005-python3_12.patch new file mode 100644 index 00000000000..0315f04f8b5 --- /dev/null +++ b/SPECS-EXTENDED/pywbem/0005-python3_12.patch @@ -0,0 +1,216 @@ +diff --git a/pywbem/_cim_http.py b/pywbem/_cim_http.py +index b6080058..2779d7aa 100644 +--- a/pywbem/_cim_http.py ++++ b/pywbem/_cim_http.py +@@ -57,22 +57,12 @@ from ._utils import _ensure_unicode, _ensure_bytes, _format + + _ON_RTD = os.environ.get('READTHEDOCS', None) == 'True' + +-if six.PY2 and not _ON_RTD: # RTD has no swig to install M2Crypto +- # pylint: disable=wrong-import-order,wrong-import-position +- from M2Crypto import SSL +- from M2Crypto.Err import SSLError +- from M2Crypto.m2 import OPENSSL_VERSION_TEXT as OPENSSL_VERSION +- _HAVE_M2CRYPTO = True +- # pylint: disable=invalid-name +- SocketErrors = (socket.error, socket.sslerror) +-else: +- # pylint: disable=wrong-import-order,wrong-import-position +- import ssl as SSL +- from ssl import SSLError, CertificateError +- from ssl import OPENSSL_VERSION +- _HAVE_M2CRYPTO = False +- # pylint: disable=invalid-name +- SocketErrors = (socket.error,) ++# pylint: disable=wrong-import-order ++import ssl as SSL ++from ssl import SSLError, CertificateError ++from ssl import OPENSSL_VERSION ++# pylint: disable=invalid-name ++SocketErrors = (socket.error,) + + __all__ = ['DEFAULT_CA_CERT_PATHS'] + +@@ -519,12 +509,25 @@ def wbem_request(url, data, creds, cimxml_headers=None, debug=False, x509=None, + # Note: We do not use strict=True in the following call, because it + # is not clear what side effects that would have, and if no status + # line comes back we'll certainly find out about that. ++ ssl_context = SSL.create_default_context(purpose=SSL.Purpose.SERVER_AUTH) ++ ssl_context.check_hostname = False ++ ++ if no_verification: ++ ssl_context.verify_mode = SSL.CERT_NONE ++ ++ if cert_file and key_file: ++ ssl_context.load_cert_chain(cert_file, key_file) ++ ++ if ca_certs: ++ ssl_context.load_verify_locations(ca_certs) ++ ++ # 3.12 removed key_file, cert_file, etc. + httplib.HTTPSConnection.__init__(self, host=host, port=port, +- key_file=key_file, +- cert_file=cert_file, ++ context=ssl_context, + timeout=timeout) + self.ca_certs = ca_certs + self.verify_callback = verify_callback ++ self.ctx = ssl_context + # issue 297: Verify_callback is not used in py 3 + if verify_callback is not None and six.PY3: + warnings.warn("The 'verify_callback' parameter was specified " +@@ -534,137 +537,25 @@ def wbem_request(url, data, creds, cimxml_headers=None, debug=False, x509=None, + def connect(self): + # pylint: disable=too-many-branches + """Connect to a host on a given (SSL) port.""" ++ # set up the socket ++ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ++ sock.settimeout(self.timeout) + +- # Connect for M2Crypto ssl package +- if _HAVE_M2CRYPTO: +- # Calling httplib.HTTPSConnection.connect(self) does not work +- # because of its ssl.wrap_socket() call. So we copy the code of +- # that connect() method modulo the ssl.wrap_socket() call. +- +- # Another change is that we do not pass the timeout value +- # on to the socket call, because that does not work with +- # M2Crypto. +- +- if sys.version_info[0:2] >= (2, 7): +- # the source_address parameter was added in Python 2.7 +- self.sock = socket.create_connection( +- (self.host, self.port), None, self.source_address) +- else: +- self.sock = socket.create_connection( +- (self.host, self.port), None) +- +- # Removed code for tunneling support. +- +- # End of code from httplib.HTTPSConnection.connect(self). +- +- ctx = SSL.Context('sslv23') +- +- if self.cert_file: +- ctx.load_cert(self.cert_file, keyfile=self.key_file) +- if self.ca_certs: +- ctx.set_verify( +- SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, +- depth=9, callback=verify_callback) +- # M2Crypto requires binary strings as path names and +- # otherwise raises TypeError. +- ca_certs = _ensure_bytes(self.ca_certs) +- if os.path.isdir(self.ca_certs): +- ctx.load_verify_locations(capath=ca_certs) +- else: +- ctx.load_verify_locations(cafile=ca_certs) +- try: +- self.sock = SSL.Connection(ctx, self.sock) +- +- # Below is a body of SSL.Connection.connect() method +- # except for the first line (socket connection). +- +- # Removed code for tunneling support. +- +- # Setting the timeout on the input socket does not work +- # with M2Crypto, with such a timeout set it calls a +- # different low level function (nbio instead of bio) +- # that does not work. The symptom is that reading the +- # response returns None. +- # Therefore, we set the timeout at the level of the outer +- # M2Crypto socket object. +- # pylint: disable=using-constant-test +- +- if self.timeout is not None: +- self.sock.set_socket_read_timeout( +- SSL.timeout(self.timeout)) +- self.sock.set_socket_write_timeout( +- SSL.timeout(self.timeout)) +- +- self.sock.addr = (self.host, self.port) +- self.sock.setup_ssl() +- self.sock.set_connect_state() +- ret = self.sock.connect_ssl() +- if self.ca_certs: +- check = getattr(self.sock, 'postConnectionCheck', +- self.sock.clientPostConnectionCheck) +- if check is not None: +- if not check(self.sock.get_peer_cert(), self.host): +- raise ConnectionError( +- 'SSL error: post connection check failed', +- conn_id=conn_id) +- return ret +- +- except (SSLError, SSL.SSLError, +- SSL.Checker.SSLVerificationError) as arg: +- raise ConnectionError( +- _format("SSL error {0}: {1}; OpenSSL version: {2}", +- arg.__class__, arg, OPENSSL_VERSION), +- conn_id=conn_id) +- +- # Connect using Python SSL module +- else: +- # Setup the socket context +- +- # Note: PROTOCOL_SSLv23 allows talking to servers with TLS but +- # not with SSL. For details, see the table in +- # https://docs.python.org/3/library/ssl.html#ssl.wrap_socket +- # Within the defined set of protocol versions, SSLv23 selects +- # the highest protocol version that both client and server +- # support. +- # Issue #893: Consider the use of default_context() +- ctx = SSL.SSLContext(SSL.PROTOCOL_SSLv23) +- +- if self.cert_file: +- ctx.load_cert_chain(self.cert_file, keyfile=self.key_file) +- if self.ca_certs: +- # We need to use CERT_REQUIRED to require that the server +- # certificate is being validated by the client (against the +- # certificates in ca_certs). +- ctx.verify_mode = SSL.CERT_REQUIRED +- if os.path.isdir(self.ca_certs): +- ctx.load_verify_locations(capath=self.ca_certs) +- else: +- ctx.load_verify_locations(cafile=self.ca_certs) +- ctx.check_hostname = True +- else: +- ctx.check_hostname = False +- ctx.verify_mode = SSL.CERT_NONE +- +- # setup the socket +- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +- sock.settimeout(self.timeout) +- +- try: +- self.sock = ctx.wrap_socket(sock, +- server_hostname=self.host) +- return self.sock.connect((self.host, self.port)) ++ try: ++ self.sock = self.ctx.wrap_socket(sock) ++ return self.sock.connect((self.host, self.port)) + +- except SSLError as arg: +- raise ConnectionError( +- _format("SSL error {0}: {1}; OpenSSL version: {2}", +- arg.__class__, arg, OPENSSL_VERSION), +- conn_id=conn_id) +- except CertificateError as arg: +- raise ConnectionError( +- _format("SSL certificate error {0}: {1}; " +- "OpenSSL version: {2}", +- arg.__class__, arg, OPENSSL_VERSION), +- conn_id=conn_id) ++ except SSLError as arg: ++ raise ConnectionError( ++ _format("SSL error {0}: {1}; OpenSSL version: {2}", ++ arg.__class__, arg, OPENSSL_VERSION), ++ conn_id=conn_id) ++ except CertificateError as arg: ++ raise ConnectionError( ++ _format("SSL certificate error {0}: {1}; " ++ "OpenSSL version: {2}", ++ arg.__class__, arg, OPENSSL_VERSION), ++ conn_id=conn_id) + + class FileHTTPConnection(HTTPBaseConnection, httplib.HTTPConnection): + """Execute client connection based on a unix domain socket. """ diff --git a/SPECS-EXTENDED/pywbem/pywbem.signatures.json b/SPECS-EXTENDED/pywbem/pywbem.signatures.json index 684443b3ed2..dc97127493e 100644 --- a/SPECS-EXTENDED/pywbem/pywbem.signatures.json +++ b/SPECS-EXTENDED/pywbem/pywbem.signatures.json @@ -1,5 +1,5 @@ { "Signatures": { - "pywbem-0.15.0.tar.gz": "6a08ae720bb6b3f6f4eaa69e6505037e8ca4031aee3ae5560be310591fe44a28" + "pywbem-0.17.6.tar.gz": "a36404f6f95f8c88bf996e183c7b6121e2046cb19df894f0ea2601b50006a70d" } -} +} \ No newline at end of file diff --git a/SPECS-EXTENDED/pywbem/pywbem.spec b/SPECS-EXTENDED/pywbem/pywbem.spec index 475351efce6..17aa7d6567a 100644 --- a/SPECS-EXTENDED/pywbem/pywbem.spec +++ b/SPECS-EXTENDED/pywbem/pywbem.spec @@ -1,17 +1,26 @@ -Vendor: Microsoft Corporation -Distribution: Azure Linux %{?python_enable_dependency_generator} Name: pywbem -Version: 0.15.0 -Release: 3%{?dist} +Version: 0.17.6 +Epoch: 1 +Release: 12%{?dist} Summary: Python WBEM client interface and related utilities -License: LGPLv2 +License: LGPL-2.1-or-later +Vendor: Microsoft Corporation +Distribution: Azure Linux URL: https://github.com/pywbem/pywbem Source0: https://github.com/pywbem/pywbem/archive/v%{version}/%{name}-%{version}.tar.gz -BuildRequires: python3-pip python3-PyYAML python3-ply python3-rpm-macros -BuildRequires: python3-pbr +Patch1: 0001-use-unittest-mock.patch +Patch2: 0002-coverity-deadcode.patch +Patch3: 0003-coverity-forward-null.patch +Patch4: 0004-coverity-identifier-typo.patch +Patch5: 0005-python3_12.patch +BuildRequires: python3-pip +BuildRequires: python3-PyYAML +BuildRequires: python3-ply +BuildRequires: python3-rpm-macros BuildRequires: python3-devel +BuildRequires: python3-setuptools BuildArch: noarch %description @@ -41,15 +50,15 @@ for more information about WBEM. %prep %setup -q -n %{name}-%{version} +%autosetup -p1 %build -PBR_VERSION="%{version}" CFLAGS="%{optflags}" %{__python3} setup.py build +CFLAGS="%{optflags}" %{__python3} setup.py build %install rm -rf %{buildroot} env PYTHONPATH=%{buildroot}/%{python3_sitelib} \ - PBR_VERSION="%{version}" \ %{__python3} setup.py install -O1 --skip-build --root %{buildroot} rm -rf %{buildroot}/usr/bin/*.bat # wbemcli are conflicting with sblim-wbemcli @@ -68,11 +77,62 @@ mv -v %{buildroot}/%{_bindir}/wbemcli.py %{buildroot}/%{_bindir}/pywbemcli.py %doc README.rst %changelog -* Fri Oct 29 2021 Muhammad Falak - 0.15.0-3 -- Remove epoch +* Fri Dec 20 2024 Akhila Guruju - 1:0.17.6-12 +- Initial Azure Linux import from Fedora 41 (license: MIT). +- License verified. + +* Fri Jul 19 2024 Fedora Release Engineering - 1:0.17.6-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Python Maint - 1:0.17.6-10 +- Rebuilt for Python 3.13 + +* Wed Mar 13 2024 Tony Asleson - 1:0.17.6-9 +- Changes to support python 3.12 + +* Fri Jan 26 2024 Fedora Release Engineering - 1:0.17.6-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 1:0.17.6-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jul 21 2023 Tony Asleson - 1:0.17.6-6 +- migrated to SPDX license + +* Tue Jun 13 2023 Python Maint - 1:0.17.6-5 +- Rebuilt for Python 3.12 + +* Fri Jan 20 2023 Fedora Release Engineering - 1:0.17.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Fri Jul 22 2022 Fedora Release Engineering - 1:0.17.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 1:0.17.6-2 +- Rebuilt for Python 3.11 + +* Tue Apr 12 2022 Tony Asleson - 1:0.17.6-1 +- Update to 0.17.6 which is the latest release that doesn't introduce + dependencies which we don't have available. + +* Fri Jan 21 2022 Fedora Release Engineering - 1:0.15.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Tue Jul 27 2021 Fedora Release Engineering - 1:0.15.0-6 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jun 23 2021 Tony Asleson - 1:0.15.0-5 +- Remove python pbr build dependency + +* Fri Jun 04 2021 Python Maint - 1:0.15.0-4 +- Rebuilt for Python 3.10 + +* Tue Feb 9 2021 Tony Asleson 1:0.15.0-3 +- https://bugzilla.redhat.com/show_bug.cgi?id=1922368 -* Fri Oct 15 2021 Pawel Winogrodzki - 1:0.15.0-2 -- Initial CBL-Mariner import from Fedora 33 (license: MIT). +* Wed Jan 27 2021 Fedora Release Engineering - 1:0.15.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Fri Oct 23 2020 Tony Asleson - 0.15.0-1 - Update to 0.15.0 for python 3.8 fixes diff --git a/cgmanifest.json b/cgmanifest.json index c54233b7c2e..d291e19f2c9 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -25413,8 +25413,8 @@ "type": "other", "other": { "name": "pywbem", - "version": "0.15.0", - "downloadUrl": "https://github.com/pywbem/pywbem/archive/v0.15.0/pywbem-0.15.0.tar.gz" + "version": "0.17.6", + "downloadUrl": "https://github.com/pywbem/pywbem/archive/refs/tags/0.17.6.tar.gz" } } },