Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade m2crypto version to support Python 3.12 #12589

Draft
wants to merge 2 commits into
base: 3.0-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From f8e27f3c8a983dd6ddc57833b4b56914d7bb2f59 Mon Sep 17 00:00:00 2001
From: Adam Williamson <[email protected]>
Date: Fri, 21 Jun 2024 14:43:26 -0700
Subject: [PATCH] Don't expect test_mkcert to fail on 32-bit (Fedora-specific?)

This test passes just fine on Fedora i686 builds, so don't expect
it to fail.

Signed-off-by: Adam Williamson <[email protected]>
---
tests/test_x509.py | 1 -
1 file changed, 1 deletion(-)

diff --git a/tests/test_x509.py b/tests/test_x509.py
index 882958e..7ab9333 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -246,7 +246,6 @@ class X509TestCase(unittest.TestCase):
self.assertEqual(req.get_version(), 0)

@unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows. TODO')
- @expectedFailureIf(is_32bit())
def test_mkcert(self):
for utc in (True, False):
req, pk = self.mkreq(1024)
--
2.45.2

This file was deleted.

28 changes: 0 additions & 28 deletions SPECS/m2crypto/CVE-2019-11358.patch

This file was deleted.

175 changes: 0 additions & 175 deletions SPECS/m2crypto/CVE-2020-25657.patch

This file was deleted.

2 changes: 1 addition & 1 deletion SPECS/m2crypto/m2crypto.signatures.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Signatures": {
"M2Crypto-0.38.0.tar.gz": "99f2260a30901c949a8dc6d5f82cd5312ffb8abc92e76633baf231bbbcb2decb"
"m2crypto-3156614a94a4767ee563530983cba87cf2aad193.tar.gz": "b28426133baa960052a80cfcf3070ee1f048a9fc806a46fc2063578aba349a39"
}
}
46 changes: 35 additions & 11 deletions SPECS/m2crypto/m2crypto.spec
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@

%global snapdate 20240613
%global commit 3156614a94a4767ee563530983cba87cf2aad193
%global shortcommit %(c=%{commit}; echo ${c:0:7})


Summary: Crypto and SSL toolkit for Python
Name: m2crypto
Version: 0.38.0
Release: 4%{?dist}
Version: 0.41.0%{?snapdate:^git%{snapdate}.%{shortcommit}}
Release: 1%{?dist}
License: MIT
Vendor: Microsoft Corporation
Distribution: Azure Linux
Group: Development/Languages/Python
URL: https://pypi.python.org/pypi/M2Crypto
Source0: https://files.pythonhosted.org/packages/2c/52/c35ec79dd97a8ecf6b2bbd651df528abb47705def774a4a15b99977274e8/M2Crypto-%{version}.tar.gz
Patch0: 0001-skip-test_tls1_nok-which-cant-be-run-in-FIPS.patch
Patch1: CVE-2020-25657.patch
Patch2: CVE-2019-11358.patch
URL: https://gitlab.com/m2crypto/m2crypto
Source: %{url}/-/archive/%{commit}/%{name}-%{commit}.tar.gz
Patch0: 0001-Don-t-expect-test_mkcert-to-fail-on-32-bit-Fedora-sp.patch

%description
M2Crypto is a crypto and SSL toolkit for Python
Expand All @@ -22,6 +26,7 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-xml
BuildRequires: swig
BuildRequires: pkgconfig
Requires: openssl >= 1.1.1g-6
Requires: python3
%if 0%{?with_check}
Expand All @@ -39,25 +44,44 @@ server. S/MIME. ZServerSSL: A HTTPS server for Zope. ZSmime: An S/MIME
messenger for Zope.

%prep
%autosetup -n M2Crypto-%{version} -p1
%autosetup -n %{?snapdate:%{name}-%{commit}}%{!?snapdate:M2Crypto-%{version}} -p1

# remove outdated generated files
rm -f src/M2Crypto/m2crypto.py src/SWIG/_m2crypto_wrap.c

%build
%set_build_flags
if pkg-config openssl ; then
CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS
LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS
fi

%py3_build

%install
%set_build_flags
if pkg-config openssl ; then
CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS
LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS
fi

%py3_install

%check
pip3 install parameterized
#Testing: MiscSSLClientTestCase failing with SSLError not raised
%python3 setup.py test
# FIXME: Make the tests pass on RHEL 9 again...
PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -munittest discover -v tests/ %{?rhel: || :}

%files -n python3-m2crypto
%defattr(-,root,root)
%doc CHANGES README.rst
%license LICENCE
%{python3_sitelib}/*

%changelog
* Mon Feb 24 2025 Suresh Babu Chalamalasetty <[email protected]> - 0.41.0^git20240613.3156614-1
- Upgrade version to 0.41.0 post-release snapshot to support with Python 3.12
- Updated Source URL path and removed patches which are not applicable with 0.41.0 version

* Wed Jan 29 2025 Jyoti Kanase <[email protected]> - 0.38.0-4
- Fix CVE-2019-11358

Expand Down
4 changes: 2 additions & 2 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12641,8 +12641,8 @@
"type": "other",
"other": {
"name": "m2crypto",
"version": "0.38.0",
"downloadUrl": "https://files.pythonhosted.org/packages/2c/52/c35ec79dd97a8ecf6b2bbd651df528abb47705def774a4a15b99977274e8/M2Crypto-0.38.0.tar.gz"
"version": "0.41.0^git20240613.3156614",
"downloadUrl": "https://gitlab.com/m2crypto/m2crypto/-/archive/3156614a94a4767ee563530983cba87cf2aad193/m2crypto-3156614a94a4767ee563530983cba87cf2aad193.tar.gz"
}
}
},
Expand Down
Loading