From 97a9a1b93b8d2b333de87b4cb2ec2bce4c415ffe Mon Sep 17 00:00:00 2001 From: Haixiao Yan Date: Thu, 16 Oct 2025 15:27:58 +0800 Subject: python3-m2crypto: upgrade 0.45.1 -> 0.46.2 python3-m2crypto/0001-setup.py-Make-the-cmd-available.patch refreshed for 0.46.2 python3-m2crypto/0001-timeout.py-use-qq-format-when-time_t-is-64bit-on-32b.patch removed, this patch doesn't work for 0.45.1 and 0.46.2. Fix the following test hang: test_IP_call (tests.test_ssl.HttpslibSSLSNIClientTestCase.test_IP_call) ... Changelog: =========== 0.46.2 - 2025-10-02 ------------------- - fix[m2xmlrpclib]: make the module compatible with Python 3.6 0.46.1 - 2025-10-02 ------------------- - Correct license to BSD-2-Clause and update references - Specify in setup.cfg that we require Python >= 3.6 0.46.0 - 2025-10-01 ------------------- (Tested on Pythons between 3.6 and 3.14.0~rc3) - M2Crypto closes SSL connection on closing HTTPS Connection, and some other related issues (#203, #278) - Modernize C API by eliminating use of deprecated PyBytes_AsStringAndSize and related functions with Python Buffer Protocol (#375) - Whole project is completely covered with type hints and is checked by mypy (also while doing that, the whole project was blackened) (#344) - Add logging support to C extension code sending messages to the Python logging - Introducing first efforts to support Engine object (#229) - Reworked and fixed M2Crypto.m2xmlrpclib module (#163) - Reverted removal of demo/ subdirectory - Improve SMIME documentation (#377) - Some other minor bugs, improvements, and removal of dead code Signed-off-by: Haixiao Yan Signed-off-by: Khem Raj --- .../0001-setup.py-Make-the-cmd-available.patch | 25 ++++--- ...use-qq-format-when-time_t-is-64bit-on-32b.patch | 80 ---------------------- .../python/python3-m2crypto_0.45.1.bb | 53 -------------- .../python/python3-m2crypto_0.46.2.bb | 52 ++++++++++++++ 4 files changed, 68 insertions(+), 142 deletions(-) delete mode 100644 meta-python/recipes-devtools/python/python3-m2crypto/0001-timeout.py-use-qq-format-when-time_t-is-64bit-on-32b.patch delete mode 100644 meta-python/recipes-devtools/python/python3-m2crypto_0.45.1.bb create mode 100644 meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb diff --git a/meta-python/recipes-devtools/python/python3-m2crypto/0001-setup.py-Make-the-cmd-available.patch b/meta-python/recipes-devtools/python/python3-m2crypto/0001-setup.py-Make-the-cmd-available.patch index c4262985ba..12216ce46a 100644 --- a/meta-python/recipes-devtools/python/python3-m2crypto/0001-setup.py-Make-the-cmd-available.patch +++ b/meta-python/recipes-devtools/python/python3-m2crypto/0001-setup.py-Make-the-cmd-available.patch @@ -1,4 +1,4 @@ -From eaeb95ec64762a58dde7cf368fc17188382e7df6 Mon Sep 17 00:00:00 2001 +From 6262f49de177a79bc17f8d583aa5a7acaf48bf9c Mon Sep 17 00:00:00 2001 From: Mingli Yu Date: Fri, 28 Mar 2025 12:13:26 +0800 Subject: [PATCH] setup.py: Make the cmd available @@ -19,19 +19,26 @@ Upstream-Status: Inappropriate [oe specific] Signed-off-by: Mingli Yu --- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + setup.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py -index 9938e67..21e2346 100644 +index 792d7365b6ed..5b8a5d791793 100644 --- a/setup.py +++ b/setup.py -@@ -230,7 +230,7 @@ class _M2CryptoBuildExt(build_ext.build_ext): - with open( - "src/SWIG/x509_v_flag.h", "w", encoding="utf-8" - ) as x509_v_h: -- cmd = [shutil.which(os.environ.get('CC', 'gcc'))] +@@ -208,8 +208,10 @@ class _M2CryptoBuildExt(build_ext.build_ext): + if sys.platform != "win32": + # generate src/SWIG/x509_v_flag.h to overcome weaknesses of swig + # https://todo.sr.ht/~mcepl/m2crypto/298 +- with open("src/SWIG/x509_v_flag.h", "w", encoding="utf-8") as x509_v_h: +- cmd = [shutil.which(os.environ.get("CC", "gcc"))] ++ with open( ++ "src/SWIG/x509_v_flag.h", "w", encoding="utf-8" ++ ) as x509_v_h: + cmd = os.environ.get('CC', 'gcc').split() cflags = os.environ.get("CFLAGS") if cflags is not None: cmd += cflags.split() +-- +2.34.1 + diff --git a/meta-python/recipes-devtools/python/python3-m2crypto/0001-timeout.py-use-qq-format-when-time_t-is-64bit-on-32b.patch b/meta-python/recipes-devtools/python/python3-m2crypto/0001-timeout.py-use-qq-format-when-time_t-is-64bit-on-32b.patch deleted file mode 100644 index 120a67b6a2..0000000000 --- a/meta-python/recipes-devtools/python/python3-m2crypto/0001-timeout.py-use-qq-format-when-time_t-is-64bit-on-32b.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 7fa4f17cc183e04b10684b28219cf15780910206 Mon Sep 17 00:00:00 2001 -From: Mingli Yu -Date: Mon, 30 Jun 2025 16:11:16 +0800 -Subject: [PATCH] timeout.py: use qq format when time_t is 64bit on 32bit - platform - -Fixes: - # python3 - Python 3.13.2 (main, Feb 4 2025, 14:51:09) [GCC 14.2.0] on linux - Type "help", "copyright", "credits" or "license" for more information. - >>> import socket - >>> import struct - >>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - >>> seconds = 5 - >>> microseconds = 0 - >>> timeval_packed = struct.pack('ll', seconds, microseconds) - >>> s.setsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO, timeval_packed) -Traceback (most recent call last): - File "", line 1, in - s.setsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO, timeval_packed) - ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -OSError: [Errno 22] Invalid argument - -Upstream-Status: Submitted [https://lists.sr.ht/~mcepl/m2crypto/patches/60463] - -Signed-off-by: Mingli Yu ---- - src/M2Crypto/SSL/timeout.py | 18 ++++++++++++++---- - 1 file changed, 14 insertions(+), 4 deletions(-) - -diff --git a/src/M2Crypto/SSL/timeout.py b/src/M2Crypto/SSL/timeout.py -index 298a9ca..0b38329 100644 ---- a/src/M2Crypto/SSL/timeout.py -+++ b/src/M2Crypto/SSL/timeout.py -@@ -15,7 +15,7 @@ __all__ = [ - import sys - import struct - --from M2Crypto import m2 -+from M2Crypto import m2, util - - DEFAULT_TIMEOUT: int = 600 - -@@ -40,7 +40,10 @@ class timeout(object): - if m2.time_t_bits() == 32: - binstr = struct.pack('ii', self.sec, self.microsec) - else: -- binstr = struct.pack('ll', self.sec, self.microsec) -+ if util.is_32bit(): -+ binstr = struct.pack('qq', self.sec, self.microsec) -+ else: -+ binstr = struct.pack('ll', self.sec, self.microsec) - return binstr - - -@@ -52,7 +55,10 @@ def struct_to_timeout(binstr: bytes) -> timeout: - sec = int(millisec / 1000) - microsec = (millisec % 1000) * 1000 - else: -- (sec, microsec) = struct.unpack('ll', binstr) -+ if sys.platform == 'linux' and util.is_32bit() and m2.time_t_bits() == 64: -+ (sec, microsec) = struct.unpack('qq', binstr) -+ else: -+ (sec, microsec) = struct.unpack('ll', binstr) - return timeout(sec, microsec) - - -@@ -60,4 +66,8 @@ def struct_size() -> int: - if sys.platform == 'win32': - return struct.calcsize('l') - else: -- return struct.calcsize('ll') -+ if sys.platform == 'linux' and util.is_32bit() and m2.time_t_bits() == 64: -+ return struct.calcsize('qq') -+ else: -+ return struct.calcsize('ll') -+ --- -2.34.1 - diff --git a/meta-python/recipes-devtools/python/python3-m2crypto_0.45.1.bb b/meta-python/recipes-devtools/python/python3-m2crypto_0.45.1.bb deleted file mode 100644 index e0e9fdb2bb..0000000000 --- a/meta-python/recipes-devtools/python/python3-m2crypto_0.45.1.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "A Python crypto and SSL toolkit" -HOMEPAGE = "https://gitlab.com/m2crypto/m2crypto" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENCE;md5=b0e1f0b7d0ce8a62c18b1287b991800e" - -SRC_URI[sha256sum] = "d0fc81a8828edbf4308432b3040bf06bb26bad95abb9e7d4690b6118551e76ec" - -SRC_URI += " \ - file://0001-setup.py-Make-the-cmd-available.patch \ - file://0001-timeout.py-use-qq-format-when-time_t-is-64bit-on-32b.patch \ -" - -inherit pypi siteinfo python_setuptools_build_meta - -DEPENDS += "openssl swig-native" -RDEPENDS:${PN} += "\ - python3-datetime \ - python3-setuptools \ - python3-logging \ - python3-netclient \ - python3-netserver \ - python3-numbers \ - python3-xmlrpc \ -" - -DISTUTILS_BUILD_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR} -I${STAGING_INCDIR}" -DISTUTILS_INSTALL_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR}" - -SWIG_FEATURES ?= "-D__${HOST_ARCH}__ ${@['-D__ILP32__','-D__LP64__'][d.getVar('SITEINFO_BITS') != '32']} -DOPENSSL_NO_FILENAMES" - -SWIG_FEATURES:append:riscv64 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" -SWIG_FEATURES:append:riscv32 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" -SWIG_FEATURES:append:mipsarch = " -D_MIPS_SZPTR=${SITEINFO_BITS}" -SWIG_FEATURES:append:powerpc64le = " -D__powerpc64__" -SWIG_FEATURES:append:x86 = " -D__i386__" -SWIG_FEATURES:append:x32 = " -D__ILP32__" - -export SWIG_FEATURES - -export STAGING_DIR - -do_configure:prepend() { - # workaround for https://github.com/swiftlang/swift/issues/69311 - sed -i "/sys\/types.h/d" ${RECIPE_SYSROOT}${includedir}/openssl/e_os2.h -} - -do_install:append() { - rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/SSL/__pycache__/*.cpython-*.pyc - rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/__pycache__/*.cpython-*.pyc -} - -BBCLASSEXTEND = "native" diff --git a/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb b/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb new file mode 100644 index 0000000000..0a631c7a07 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb @@ -0,0 +1,52 @@ +SUMMARY = "A Python crypto and SSL toolkit" +HOMEPAGE = "https://gitlab.com/m2crypto/m2crypto" + +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSES/BSD-2-Clause.txt;md5=8099b0e569f862ece05740aef06c82a2" + +SRC_URI[sha256sum] = "13c2fa89562f7b8af40cc74b55f490be5e2ab8ccfb739f11c16d3ce6221a61ba" + +SRC_URI += " \ + file://0001-setup.py-Make-the-cmd-available.patch \ +" + +inherit pypi siteinfo python_setuptools_build_meta + +DEPENDS += "openssl swig-native" +RDEPENDS:${PN} += "\ + python3-datetime \ + python3-setuptools \ + python3-logging \ + python3-netclient \ + python3-netserver \ + python3-numbers \ + python3-xmlrpc \ +" + +DISTUTILS_BUILD_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR} -I${STAGING_INCDIR}" +DISTUTILS_INSTALL_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR}" + +SWIG_FEATURES ?= "-D__${HOST_ARCH}__ ${@['-D__ILP32__','-D__LP64__'][d.getVar('SITEINFO_BITS') != '32']} -DOPENSSL_NO_FILENAMES" + +SWIG_FEATURES:append:riscv64 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" +SWIG_FEATURES:append:riscv32 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" +SWIG_FEATURES:append:mipsarch = " -D_MIPS_SZPTR=${SITEINFO_BITS}" +SWIG_FEATURES:append:powerpc64le = " -D__powerpc64__" +SWIG_FEATURES:append:x86 = " -D__i386__" +SWIG_FEATURES:append:x32 = " -D__ILP32__" + +export SWIG_FEATURES + +export STAGING_DIR + +do_configure:prepend() { + # workaround for https://github.com/swiftlang/swift/issues/69311 + sed -i "/sys\/types.h/d" ${RECIPE_SYSROOT}${includedir}/openssl/e_os2.h +} + +do_install:append() { + rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/SSL/__pycache__/*.cpython-*.pyc + rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/__pycache__/*.cpython-*.pyc +} + +BBCLASSEXTEND = "native" -- cgit v1.2.3-54-g00ecf