From 8b019782cd388127702d3a24779ba7129c0c06d8 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 5 Jan 2024 18:55:33 -0500 Subject: [PATCH] user/py3-xmlsec: use latest xmlsec --- user/py3-xmlsec/264_xmlsec3-support.patch | 105 ++++++++++++++++++++++ user/py3-xmlsec/APKBUILD | 26 ++++-- 2 files changed, 126 insertions(+), 5 deletions(-) create mode 100644 user/py3-xmlsec/264_xmlsec3-support.patch diff --git a/user/py3-xmlsec/264_xmlsec3-support.patch b/user/py3-xmlsec/264_xmlsec3-support.patch new file mode 100644 index 0000000..12096a7 --- /dev/null +++ b/user/py3-xmlsec/264_xmlsec3-support.patch @@ -0,0 +1,105 @@ +From 5f57f2eac756df213e83a2fdb452057909e2dd21 Mon Sep 17 00:00:00 2001 +From: David Adamec +Date: Fri, 15 Sep 2023 17:49:15 -0700 +Subject: [PATCH 1/3] Add compatibility for xmlsec 1.3 + +--- + doc/source/modules/constants.rst | 6 ------ + src/constants.c | 2 -- + src/enc.c | 7 +++++++ + src/xmlsec/constants.pyi | 2 -- + 4 files changed, 7 insertions(+), 10 deletions(-) + +diff --git a/src/constants.c b/src/constants.c +index 34c81b2..72ae217 100644 +--- a/src/constants.c ++++ b/src/constants.c +@@ -316,8 +316,6 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) { + PYXMLSEC_ADD_NS_CONSTANT(XPathNs, "XPATH"); + PYXMLSEC_ADD_NS_CONSTANT(XPath2Ns, "XPATH2"); + PYXMLSEC_ADD_NS_CONSTANT(XPointerNs, "XPOINTER"); +- PYXMLSEC_ADD_NS_CONSTANT(Soap11Ns, "SOAP11"); +- PYXMLSEC_ADD_NS_CONSTANT(Soap12Ns, "SOAP12"); + PYXMLSEC_ADD_NS_CONSTANT(NsExcC14N, "EXC_C14N"); + PYXMLSEC_ADD_NS_CONSTANT(NsExcC14NWithComments, "EXC_C14N_WITH_COMMENT"); + +diff --git a/src/enc.c b/src/enc.c +index aaf35ae..475cd2d 100644 +--- a/src/enc.c ++++ b/src/enc.c +@@ -50,6 +50,13 @@ static int PyXmlSec_EncryptionContext__init__(PyObject* self, PyObject* args, Py + } + ctx->manager = manager; + PYXMLSEC_DEBUGF("%p: init enc context - ok, manager - %p", self, manager); ++ ++ // xmlsec 1.3 changed the key search to strict mode, causing various examples ++ // in the docs to fail. For backwards compatibility, this changes it back to ++ // lax mode for now. ++ ctx->handle->keyInfoReadCtx.flags = XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH; ++ ctx->handle->keyInfoWriteCtx.flags = XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH; ++ + return 0; + ON_FAIL: + PYXMLSEC_DEBUGF("%p: init enc context - failed", self); +diff --git a/src/xmlsec/constants.pyi b/src/xmlsec/constants.pyi +index 3430a02..9fd24e5 100644 +--- a/src/xmlsec/constants.pyi ++++ b/src/xmlsec/constants.pyi +@@ -85,8 +85,6 @@ NodeX509Data: Final[str] + Ns: Final[str] + NsExcC14N: Final[str] + NsExcC14NWithComments: Final[str] +-Soap11Ns: Final[str] +-Soap12Ns: Final[str] + TransformAes128Cbc: Final[__Transform] + TransformAes128Gcm: Final[__Transform] + TransformAes192Cbc: Final[__Transform] + +From 0e7c5e718e8d221331b0a5f851094a5b4181eeae Mon Sep 17 00:00:00 2001 +From: David Adamec +Date: Fri, 15 Sep 2023 18:07:07 -0700 +Subject: [PATCH 2/3] fix 1.2 compatibility + +--- + src/enc.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/enc.c b/src/enc.c +index 475cd2d..5453ef9 100644 +--- a/src/enc.c ++++ b/src/enc.c +@@ -17,6 +17,11 @@ + #include + #include + ++// Backwards compatibility with xmlsec 1.2 ++#ifndef XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH ++#define XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH 0x00008000 ++#endif ++ + typedef struct { + PyObject_HEAD + xmlSecEncCtxPtr handle; + +From 40c14c45a352f2812e796a071ef7d12f5a70be58 Mon Sep 17 00:00:00 2001 +From: David Adamec +Date: Fri, 15 Sep 2023 19:40:04 -0700 +Subject: [PATCH 3/3] update isort to fix poetry error in pre-commit + +--- + .pre-commit-config.yaml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml +index 0545b12..bf877f3 100644 +--- a/.pre-commit-config.yaml ++++ b/.pre-commit-config.yaml +@@ -31,7 +31,7 @@ repos: + exclude: ^setup.py$ + additional_dependencies: [flake8-docstrings, flake8-bugbear, flake8-logging-format, flake8-builtins, flake8-eradicate, flake8-fixme, pep8-naming, flake8-pep3101, flake8-annotations-complexity,flake8-pyi] + - repo: https://github.com/PyCQA/isort +- rev: 5.10.1 ++ rev: 5.12.0 + hooks: + - id: isort + - repo: https://github.com/pre-commit/mirrors-mypy diff --git a/user/py3-xmlsec/APKBUILD b/user/py3-xmlsec/APKBUILD index bc23db8..5237258 100644 --- a/user/py3-xmlsec/APKBUILD +++ b/user/py3-xmlsec/APKBUILD @@ -4,23 +4,38 @@ _pyname=xmlsec pkgname="py3-$_pyname" pkgver=1.3.13 -pkgrel=3 -# does not support libxml2 1.3.0 +pkgrel=4 arch="all" pkgdesc="Python bindings for the XML Security Library" url="https://pypi.python.org/project/$_pyname" license="MIT" -depends="py3-lxml xmlsec<1.3" -makedepends="py3-setuptools libxml2-dev xmlsec-dev<1.3 py3-wheel py3-pip python3-dev" +depends=" + py3-lxml + xmlsec + " +makedepends=" + py3-gpep517 + py3-setuptools + py3-setuptools_scm + py3-pkgconfig + py3-wheel + python3-dev + libxml2-dev + xmlsec-dev + " checkdepends="py3-pytest" source=" $pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/${_pyname:0:1}/$_pyname/$_pyname-$pkgver.tar.gz 253_pkcs11-support.patch + 264_xmlsec3-support.patch " builddir="$srcdir"/$_pyname-$pkgver build() { - python3 setup.py build + gpep517 build-wheel \ + --wheel-dir dist \ + --output-fd 3 3>&1 >&2 + } check() { @@ -36,4 +51,5 @@ package() { sha512sums=" 2aa080fbc918d5d360dcb086a8c529545514dd429649d99833425f92fa06a3a094cf3139f8ed00827fed358f0fa463b74c267e593ac14e5aadc299d64206ac8e py3-xmlsec-1.3.13.tar.gz 9155a2435d832b4dcd0260616f52eec148dca1dade76a89c23e10f017e4140024ef042b6b10c5b9435fcbf52e7dc4f7e5764dc7f5bdd7595c27b3106fab942cf 253_pkcs11-support.patch +d901c09a49145250dd9325476c1356f820519b9248195240584f6de62b8084205f698501a1f48e42b63fe4c7b169dcb65540edc03724ef7e9297b45216c5b481 264_xmlsec3-support.patch "