* [gentoo-commits] repo/gentoo:master commit in: dev-python/tpm2-pytss/, dev-python/tpm2-pytss/files/
@ 2022-06-12 8:04 Joonas Niilola
0 siblings, 0 replies; 4+ messages in thread
From: Joonas Niilola @ 2022-06-12 8:04 UTC (permalink / raw
To: gentoo-commits
commit: 7f7ac9f94985048173097027ef3d9d1c745fe4d5
Author: Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Mon May 30 00:04:48 2022 +0000
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Jun 12 08:03:57 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f7ac9f9
dev-python/tpm2-pytss: Avoid dance in python_test via upsteam patch
Also update HOMEPAGE and SRC_URI. Build changes only, no functional
changes
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/25682
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
....1.0-src-move-package-under-src-directory.patch | 239 +++++++++++++++++++++
dev-python/tpm2-pytss/tpm2-pytss-1.1.0.ebuild | 17 +-
2 files changed, 248 insertions(+), 8 deletions(-)
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-1.1.0-src-move-package-under-src-directory.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-1.1.0-src-move-package-under-src-directory.patch
new file mode 100644
index 000000000000..6e6342cac5b6
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-1.1.0-src-move-package-under-src-directory.patch
@@ -0,0 +1,239 @@
+From a03b66dd73a2ff58ebf847864102585aa3d11af7 Mon Sep 17 00:00:00 2001
+From: William Roberts <william.c.roberts@intel.com>
+Date: Wed, 11 May 2022 17:07:53 -0500
+Subject: [PATCH] src: move package under src directory
+
+Issue #341 reports that building a wheel and running the tests fails. I
+was able to reproduce this behavior with the following commands:
+
+python3 -Bm build -w --no-isolation
+python3 -m installer --destdir=installation dist/*.whl
+export PYTHONPATH="/home/wcrobert/tmp/installation/usr/lib/python3.8/site-packages"
+pytest test/test_types.py
+
+Note:
+ - Current Working Directory is the repo clone, so tpm2-pytss
+ - The export command may need to be updated for your specific version
+ of python.
+
+It fails with:
+ImportError while importing test module '/home/wcrobert/workspace/tpm2-pytss/test/test_types.py'.
+<snip>
+E ModuleNotFoundError: No module named 'tpm2_pytss._libtpm2_pytss'
+
+However, this issue is a red herring. This really has to do with the
+fact that the relative import in the test code tries to resolve to
+non-built package in that directory rather then the built one on
+PYTHONPATH.
+
+Proposed solutions to use full package names also don't work, becuase it
+has to resolve to the built package and it will still attempt to resolve
+the non-built package. The least finicky solution to fix this, was to
+match what bcrypt was doing and move it under a src directory so it
+forces the resolution to not occur on that directory and inplace (pip
+install -e .) installations still work as well.
+
+Fixes: #341
+
+Signed-off-by: William Roberts <william.c.roberts@intel.com>
+---
+ .gitignore | 4 ++--
+ MANIFEST.in | 8 ++++----
+ scripts/prepare_headers.py | 2 +-
+ setup.cfg | 6 ++++--
+ setup.py | 8 +++++---
+ {tpm2_pytss => src/tpm2_pytss}/ESAPI.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/FAPI.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/TCTI.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/TCTILdr.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/TSS2_Exception.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/__init__.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/callbacks.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/constants.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/encoding.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/fapi_info.py | 0
+ src/tpm2_pytss/internal/__init__.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/internal/constants.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/internal/crypto.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/internal/templates.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/internal/utils.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/tsskey.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/types.py | 0
+ {tpm2_pytss => src/tpm2_pytss}/utils.py | 0
+ 23 files changed, 16 insertions(+), 12 deletions(-)
+ rename {tpm2_pytss => src/tpm2_pytss}/ESAPI.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/FAPI.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/TCTI.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/TCTILdr.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/TSS2_Exception.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/__init__.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/callbacks.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/constants.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/encoding.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/fapi_info.py (100%)
+ create mode 100644 src/tpm2_pytss/internal/__init__.py
+ rename {tpm2_pytss => src/tpm2_pytss}/internal/constants.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/internal/crypto.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/internal/templates.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/internal/utils.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/tsskey.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/types.py (100%)
+ rename {tpm2_pytss => src/tpm2_pytss}/utils.py (100%)
+
+diff --git a/.gitignore b/.gitignore
+index 07e277e..396cfdb 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -40,5 +40,5 @@ public/
+ *.rej
+ htmlcov
+ /.pytest_cache/
+-tpm2_pytss/internal/type_mapping.py
+-tpm2_pytss/internal/versions.py
++src/tpm2_pytss/internal/type_mapping.py
++src/tpm2_pytss/internal/versions.py
+diff --git a/MANIFEST.in b/MANIFEST.in
+index 6bc43ab..7bbc96a 100644
+--- a/MANIFEST.in
++++ b/MANIFEST.in
+@@ -1,8 +1,8 @@
+ include README.md
+ include LICENSE
+-include tpm2_pytss/version
+-include tpm2_pytss/config.json
+-recursive-include tpm2_pytss/swig *
++include src/tpm2_pytss/version
++include src/tpm2_pytss/config.json
++recursive-include src/tpm2_pytss/swig *
+ recursive-include tests *
+ recursive-include examples *
+-exclude tpm2_pytss/internal/type_mapping.py
++exclude src/tpm2_pytss/internal/type_mapping.py
+diff --git a/scripts/prepare_headers.py b/scripts/prepare_headers.py
+index 0864a3d..7eb0a57 100644
+--- a/scripts/prepare_headers.py
++++ b/scripts/prepare_headers.py
+@@ -11,7 +11,7 @@ import textwrap
+
+ # import tpm2_pytss.constants
+ constants_spec = importlib.util.spec_from_file_location(
+- "tpm2_pytss.internal.constants", "tpm2_pytss/internal/constants.py"
++ "tpm2_pytss.internal.constants", "src/tpm2_pytss/internal/constants.py"
+ )
+ constants = importlib.util.module_from_spec(constants_spec)
+ constants_spec.loader.exec_module(constants)
+diff --git a/setup.cfg b/setup.cfg
+index 89a3c7a..5426a07 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -18,9 +18,11 @@ classifiers =
+ Programming Language :: Python :: 3.10
+
+ [options]
+-packages =
++package_dir=
++ =src
++packages=
+ tpm2_pytss
+- tpm2_pytss/internal
++ tpm2_pytss.internal
+ setup_requires =
+ setuptools_scm[toml]>=3.4.3
+ cffi>=1.0.0
+diff --git a/setup.py b/setup.py
+index f10fe73..b7f1c96 100644
+--- a/setup.py
++++ b/setup.py
+@@ -200,13 +200,15 @@ class type_generator(build_ext):
+
+ p = os.path.join(self.build_lib, "tpm2_pytss/internal/type_mapping.py")
+ sp = os.path.join(
+- os.path.dirname(__file__), "tpm2_pytss/internal/type_mapping.py"
++ os.path.dirname(__file__), "src/tpm2_pytss/internal/type_mapping.py"
+ )
+
+ vp = os.path.join(self.build_lib, "tpm2_pytss/internal/versions.py")
+- svp = os.path.join(os.path.dirname(__file__), "tpm2_pytss/internal/versions.py")
++ svp = os.path.join(
++ os.path.dirname(__file__), "src/tpm2_pytss/internal/versions.py"
++ )
+
+- print(f"generated _type_map with {len(type_map)} mappings")
++ print(f"generated _type_map with {len(type_map)} mappings in {p} and {sp}")
+ print(f"generated _element_type_map with {len(element_type_map)} mappings")
+ print(f"generated _versions with {len(versions)} versions")
+
+diff --git a/tpm2_pytss/ESAPI.py b/src/tpm2_pytss/ESAPI.py
+similarity index 100%
+rename from tpm2_pytss/ESAPI.py
+rename to src/tpm2_pytss/ESAPI.py
+diff --git a/tpm2_pytss/FAPI.py b/src/tpm2_pytss/FAPI.py
+similarity index 100%
+rename from tpm2_pytss/FAPI.py
+rename to src/tpm2_pytss/FAPI.py
+diff --git a/tpm2_pytss/TCTI.py b/src/tpm2_pytss/TCTI.py
+similarity index 100%
+rename from tpm2_pytss/TCTI.py
+rename to src/tpm2_pytss/TCTI.py
+diff --git a/tpm2_pytss/TCTILdr.py b/src/tpm2_pytss/TCTILdr.py
+similarity index 100%
+rename from tpm2_pytss/TCTILdr.py
+rename to src/tpm2_pytss/TCTILdr.py
+diff --git a/tpm2_pytss/TSS2_Exception.py b/src/tpm2_pytss/TSS2_Exception.py
+similarity index 100%
+rename from tpm2_pytss/TSS2_Exception.py
+rename to src/tpm2_pytss/TSS2_Exception.py
+diff --git a/tpm2_pytss/__init__.py b/src/tpm2_pytss/__init__.py
+similarity index 100%
+rename from tpm2_pytss/__init__.py
+rename to src/tpm2_pytss/__init__.py
+diff --git a/tpm2_pytss/callbacks.py b/src/tpm2_pytss/callbacks.py
+similarity index 100%
+rename from tpm2_pytss/callbacks.py
+rename to src/tpm2_pytss/callbacks.py
+diff --git a/tpm2_pytss/constants.py b/src/tpm2_pytss/constants.py
+similarity index 100%
+rename from tpm2_pytss/constants.py
+rename to src/tpm2_pytss/constants.py
+diff --git a/tpm2_pytss/encoding.py b/src/tpm2_pytss/encoding.py
+similarity index 100%
+rename from tpm2_pytss/encoding.py
+rename to src/tpm2_pytss/encoding.py
+diff --git a/tpm2_pytss/fapi_info.py b/src/tpm2_pytss/fapi_info.py
+similarity index 100%
+rename from tpm2_pytss/fapi_info.py
+rename to src/tpm2_pytss/fapi_info.py
+diff --git a/src/tpm2_pytss/internal/__init__.py b/src/tpm2_pytss/internal/__init__.py
+new file mode 100644
+index 0000000..e69de29
+diff --git a/tpm2_pytss/internal/constants.py b/src/tpm2_pytss/internal/constants.py
+similarity index 100%
+rename from tpm2_pytss/internal/constants.py
+rename to src/tpm2_pytss/internal/constants.py
+diff --git a/tpm2_pytss/internal/crypto.py b/src/tpm2_pytss/internal/crypto.py
+similarity index 100%
+rename from tpm2_pytss/internal/crypto.py
+rename to src/tpm2_pytss/internal/crypto.py
+diff --git a/tpm2_pytss/internal/templates.py b/src/tpm2_pytss/internal/templates.py
+similarity index 100%
+rename from tpm2_pytss/internal/templates.py
+rename to src/tpm2_pytss/internal/templates.py
+diff --git a/tpm2_pytss/internal/utils.py b/src/tpm2_pytss/internal/utils.py
+similarity index 100%
+rename from tpm2_pytss/internal/utils.py
+rename to src/tpm2_pytss/internal/utils.py
+diff --git a/tpm2_pytss/tsskey.py b/src/tpm2_pytss/tsskey.py
+similarity index 100%
+rename from tpm2_pytss/tsskey.py
+rename to src/tpm2_pytss/tsskey.py
+diff --git a/tpm2_pytss/types.py b/src/tpm2_pytss/types.py
+similarity index 100%
+rename from tpm2_pytss/types.py
+rename to src/tpm2_pytss/types.py
+diff --git a/tpm2_pytss/utils.py b/src/tpm2_pytss/utils.py
+similarity index 100%
+rename from tpm2_pytss/utils.py
+rename to src/tpm2_pytss/utils.py
+--
+2.35.1
+
diff --git a/dev-python/tpm2-pytss/tpm2-pytss-1.1.0.ebuild b/dev-python/tpm2-pytss/tpm2-pytss-1.1.0.ebuild
index 7121894df275..d7f07c588526 100644
--- a/dev-python/tpm2-pytss/tpm2-pytss-1.1.0.ebuild
+++ b/dev-python/tpm2-pytss/tpm2-pytss-1.1.0.ebuild
@@ -7,8 +7,11 @@ PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1
DESCRIPTION="Python bindings for TSS"
-HOMEPAGE="https://pypi.org/project/tpm2-pytss/"
-SRC_URI="https://github.com/tpm2-software/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
+HOMEPAGE="
+ https://pypi.org/project/tpm2-pytss
+ https://github.com/tpm2-software/tpm2-pytss
+"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD-2"
SLOT="0"
@@ -29,12 +32,10 @@ DEPEND="${RDEPEND}
BDEPEND="dev-python/setuptools_scm[${PYTHON_USEDEP}]
dev-python/pkgconfig[${PYTHON_USEDEP}]"
-distutils_enable_tests pytest
+PATCHES=(
+ "${FILESDIR}/${PN}-1.1.0-src-move-package-under-src-directory.patch"
+ )
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
-python_test() {
- cd ${T}
- PYTHONPATH="${BUILD_DIR}/install/$(python_get_sitedir):${S}:${PYTHONPATH}" \
- epytest ${S}/test --import-mode=importlib
-}
+distutils_enable_tests pytest
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/tpm2-pytss/, dev-python/tpm2-pytss/files/
@ 2023-10-01 7:27 Sam James
0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2023-10-01 7:27 UTC (permalink / raw
To: gentoo-commits
commit: ed8546f3c2fde853395080fc346968f6d6019d63
Author: Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Thu Aug 10 00:40:25 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 1 07:15:10 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed8546f3
dev-python/tpm2-pytss: Fix failing test, add DISTUTILS_EXT
Closes: https://bugs.gentoo.org/911838
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
...-add-check-for-renamed-cryptography-types.patch | 45 ++++++++++++++++++++++
dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild | 44 +++++++++++++++++++++
2 files changed, 89 insertions(+)
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch
new file mode 100644
index 000000000000..c1aeaee4dcd1
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch
@@ -0,0 +1,45 @@
+From e4006e6066c015d9ed55befa9b98247fbdcafd7d Mon Sep 17 00:00:00 2001
+From: Erik Larsson <who+github@cnackers.org>
+Date: Mon, 26 Jun 2023 12:15:41 +0200
+Subject: [PATCH] test: add check for renamed cryptography types
+
+Some types have changed their names in newer cryptography release, so add them to the tests
+
+Signed-off-by: Erik Larsson <who+github@cnackers.org>
+---
+ test/test_crypto.py | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/test/test_crypto.py b/test/test_crypto.py
+index 92cda00..7d7466e 100644
+--- a/test/test_crypto.py
++++ b/test/test_crypto.py
+@@ -596,11 +596,23 @@ class CryptoTest(TSS2_EsapiTest):
+
+ with self.assertRaises(ValueError) as e:
+ TPMT_SENSITIVE.from_pem(der)
+- self.assertEqual(str(e.exception), "unsupported key type: _DSAPrivateKey")
++ self.assertIn(
++ str(e.exception),
++ (
++ "unsupported key type: _DSAPrivateKey",
++ "unsupported key type: DSAPrivateKey",
++ ),
++ )
+
+ with self.assertRaises(ValueError) as e:
+ TPMT_PUBLIC.from_pem(dsa_public_key)
+- self.assertEqual(str(e.exception), "unsupported key type: _DSAPublicKey")
++ self.assertIn(
++ str(e.exception),
++ (
++ "unsupported key type: _DSAPublicKey",
++ "unsupported key type: DSAPublicKey",
++ ),
++ )
+
+ def test_from_pem_with_symmetric(self):
+ sym = TPMT_SYM_DEF_OBJECT(algorithm=TPM2_ALG.AES)
+--
+2.41.0
+
diff --git a/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild b/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild
new file mode 100644
index 000000000000..18d96bdbc4e2
--- /dev/null
+++ b/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYPI_NO_NORMALIZE=1
+PYTHON_COMPAT=( python3_{10..11} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Python bindings for TSS"
+HOMEPAGE="
+ https://pypi.org/project/tpm2-pytss
+ https://github.com/tpm2-software/tpm2-pytss
+"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="+fapi test"
+
+RDEPEND="app-crypt/tpm2-tss:=[fapi=]
+ fapi? ( >=app-crypt/tpm2-tss-3.0.3:= )
+ dev-python/cffi[${PYTHON_USEDEP}]
+ dev-python/asn1crypto[${PYTHON_USEDEP}]
+ dev-python/cryptography[${PYTHON_USEDEP}]
+ dev-python/pycparser[${PYTHON_USEDEP}]
+ dev-python/pyyaml[${PYTHON_USEDEP}]"
+
+DEPEND="${RDEPEND}
+ test? ( app-crypt/swtpm )"
+
+BDEPEND="dev-python/setuptools-scm[${PYTHON_USEDEP}]
+ dev-python/pkgconfig[${PYTHON_USEDEP}]"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-2.1.0-test-add-check-for-renamed-cryptography-types.patch"
+ )
+
+export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
+
+distutils_enable_tests pytest
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/tpm2-pytss/, dev-python/tpm2-pytss/files/
@ 2024-03-08 18:28 Michał Górny
0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2024-03-08 18:28 UTC (permalink / raw
To: gentoo-commits
commit: 881ed34d3f6fa4c41b5aecc363c026f9da41fa5d
Author: Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Fri Mar 8 02:33:23 2024 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Mar 8 18:28:41 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=881ed34d
dev-python/tpm2-pytss: drop 2.1.0-r2
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35662
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/tpm2-pytss/Manifest | 1 -
...ypto-fix-_MyRSAPrivateNumbers-with-crypto.patch | 73 ----------------------
...-add-check-for-renamed-cryptography-types.patch | 45 -------------
...e-pcr_set_auth_value-and-pcr_set_auth_pol.patch | 40 ------------
dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r2.ebuild | 48 --------------
5 files changed, 207 deletions(-)
diff --git a/dev-python/tpm2-pytss/Manifest b/dev-python/tpm2-pytss/Manifest
index 148dfd46cbbc..e52433cd8399 100644
--- a/dev-python/tpm2-pytss/Manifest
+++ b/dev-python/tpm2-pytss/Manifest
@@ -1,2 +1 @@
-DIST tpm2-pytss-2.1.0.tar.gz 203244 BLAKE2B f960fc08c12d10835ec7127e47842ea82b760e2de4fb3060a2f55f9bab5396cbe6f8edd07cb35b98d90ba8ec22c2d3ff287acbad47feac05f02df38b154f2132 SHA512 b4d8b3a0124e67278f08ff72d3635221e84ae26b6a5489ee159e641931aa9045b4b5111ed02d5ff86d69bd89b8460b2592a3fdb94742562351e41783c78184ba
DIST tpm2-pytss-2.2.1.tar.gz 208114 BLAKE2B fe07f38a6c19bc2b2baf079184f39d3ef28268900a35e14bfa22abb61dd956fdb286560ab6d35d66160147296e590fa3dac3d015f9919e1966f43179c1bdcdb1 SHA512 0acaa37d118d71edb123c5e88ef5af5dd78a73b0f8db15500866b6799d98e4c6107f9da1b8c1bce1c9061e9df85d735a39d9335cea65cac0e058db83aed8ad06
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-internal-crypto-fix-_MyRSAPrivateNumbers-with-crypto.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-internal-crypto-fix-_MyRSAPrivateNumbers-with-crypto.patch
deleted file mode 100644
index 4aaecd935c22..000000000000
--- a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-internal-crypto-fix-_MyRSAPrivateNumbers-with-crypto.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 0fbb9d099370c0a7031dd13990986538f586836a Mon Sep 17 00:00:00 2001
-From: Erik Larsson <who+github@cnackers.org>
-Date: Fri, 26 Jan 2024 12:01:41 +0100
-Subject: [PATCH 3/3] internal/crypto: fix _MyRSAPrivateNumbers with
- cryptograpy >= 42.0.1
-
-RSAPrivateNumbers was moved to a rust implementation in 42.0.1.
-So inheritance is no longer possible, so turn the class into a
-wrapper instead of a subclass.
-
-Fixes #561
-
-Signed-off-by: Erik Larsson <who+github@cnackers.org>
----
- src/tpm2_pytss/internal/crypto.py | 21 +++++++++------------
- 1 file changed, 9 insertions(+), 12 deletions(-)
-
-diff --git a/src/tpm2_pytss/internal/crypto.py b/src/tpm2_pytss/internal/crypto.py
-index 93e5181..42030c5 100644
---- a/src/tpm2_pytss/internal/crypto.py
-+++ b/src/tpm2_pytss/internal/crypto.py
-@@ -23,7 +23,7 @@ from cryptography.hazmat.primitives.ciphers.algorithms import AES, Camellia
- from cryptography.hazmat.primitives.ciphers import modes, Cipher, CipherAlgorithm
- from cryptography.hazmat.backends import default_backend
- from cryptography.exceptions import UnsupportedAlgorithm, InvalidSignature
--from typing import Tuple, Type
-+from typing import Tuple, Type, Any
- import secrets
- import sys
-
-@@ -220,7 +220,7 @@ def public_to_key(obj):
- return key
-
-
--class _MyRSAPrivateNumbers(rsa.RSAPrivateNumbers):
-+class _MyRSAPrivateNumbers:
- def __init__(self, p: int, n: int, e: int, pubnums: rsa.RSAPublicNumbers):
-
- q = n // p
-@@ -231,7 +231,12 @@ class _MyRSAPrivateNumbers(rsa.RSAPrivateNumbers):
- dmq1 = rsa.rsa_crt_dmq1(d, q)
- iqmp = rsa.rsa_crt_iqmp(p, q)
-
-- super().__init__(p, q, d, dmp1, dmq1, iqmp, pubnums)
-+ self._private_numbers = rsa.RSAPrivateNumbers(
-+ p, q, d, dmp1, dmq1, iqmp, pubnums
-+ )
-+
-+ def private_key(self, *args: Any, **kwargs: Any) -> rsa.RSAPrivateKey:
-+ return self._private_numbers.private_key(*args, **kwargs)
-
- @staticmethod
- def _xgcd(a: int, b: int) -> Tuple[int, int, int]:
-@@ -251,15 +256,7 @@ class _MyRSAPrivateNumbers(rsa.RSAPrivateNumbers):
- #
- @staticmethod
- def _modinv(a, m):
--
-- if sys.version_info < (3, 8):
-- g, x, y = _MyRSAPrivateNumbers._xgcd(a, m)
-- if g != 1:
-- raise Exception("modular inverse does not exist")
-- else:
-- return x % m
-- else:
-- return pow(a, -1, m)
-+ return pow(a, -1, m)
-
- @staticmethod
- def _generate_d(p, q, e, n):
---
-2.43.0
-
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch
deleted file mode 100644
index c1aeaee4dcd1..000000000000
--- a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From e4006e6066c015d9ed55befa9b98247fbdcafd7d Mon Sep 17 00:00:00 2001
-From: Erik Larsson <who+github@cnackers.org>
-Date: Mon, 26 Jun 2023 12:15:41 +0200
-Subject: [PATCH] test: add check for renamed cryptography types
-
-Some types have changed their names in newer cryptography release, so add them to the tests
-
-Signed-off-by: Erik Larsson <who+github@cnackers.org>
----
- test/test_crypto.py | 16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/test/test_crypto.py b/test/test_crypto.py
-index 92cda00..7d7466e 100644
---- a/test/test_crypto.py
-+++ b/test/test_crypto.py
-@@ -596,11 +596,23 @@ class CryptoTest(TSS2_EsapiTest):
-
- with self.assertRaises(ValueError) as e:
- TPMT_SENSITIVE.from_pem(der)
-- self.assertEqual(str(e.exception), "unsupported key type: _DSAPrivateKey")
-+ self.assertIn(
-+ str(e.exception),
-+ (
-+ "unsupported key type: _DSAPrivateKey",
-+ "unsupported key type: DSAPrivateKey",
-+ ),
-+ )
-
- with self.assertRaises(ValueError) as e:
- TPMT_PUBLIC.from_pem(dsa_public_key)
-- self.assertEqual(str(e.exception), "unsupported key type: _DSAPublicKey")
-+ self.assertIn(
-+ str(e.exception),
-+ (
-+ "unsupported key type: _DSAPublicKey",
-+ "unsupported key type: DSAPublicKey",
-+ ),
-+ )
-
- def test_from_pem_with_symmetric(self):
- sym = TPMT_SYM_DEF_OBJECT(algorithm=TPM2_ALG.AES)
---
-2.41.0
-
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-disable-pcr_set_auth_value-and-pcr_set_auth_pol.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-disable-pcr_set_auth_value-and-pcr_set_auth_pol.patch
deleted file mode 100644
index 6e99688b76ba..000000000000
--- a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-disable-pcr_set_auth_value-and-pcr_set_auth_pol.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From c55775c30c06bf3a3066b4047cb51cb42f1e403d Mon Sep 17 00:00:00 2001
-From: Erik Larsson <who+github@cnackers.org>
-Date: Sat, 6 Jan 2024 06:25:54 +0100
-Subject: [PATCH 2/3] test: disable pcr_set_auth_value and pcr_set_auth_policy
- tests for swtpm
-
-Since [commit][1] in libtpms setting auth values/policies for PCRs are no longer supported.
-
-[1]: https://github.com/stefanberger/libtpms/commit/af4fc0e66df6d012c61aee7c418148fb261d77a9
-
-Signed-off-by: Erik Larsson <who+github@cnackers.org>
----
- test/test_esapi.py | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/test/test_esapi.py b/test/test_esapi.py
-index 269a43b..e0b6d35 100644
---- a/test/test_esapi.py
-+++ b/test/test_esapi.py
-@@ -3585,6 +3585,8 @@ class TestEsys(TSS2_EsapiTest):
- self.ectx.pcr_allocate(pcrsels, session3=object())
-
- def test_pcr_set_auth_policy(self):
-+ if getattr(self.tcti, "name", "") == "swtpm":
-+ self.skipTest("pcr_set_auth_policy not supported by swtpm")
-
- policy = b"0123456789ABCDEF0123456789ABCDEF"
- self.ectx.pcr_set_auth_policy(policy, TPM2_ALG.SHA256, ESYS_TR.PCR20)
-@@ -3630,6 +3632,8 @@ class TestEsys(TSS2_EsapiTest):
- )
-
- def test_pcr_set_auth_value(self):
-+ if getattr(self.tcti, "name", "") == "swtpm":
-+ self.skipTest("pcr_set_auth_value not supported by swtpm")
-
- self.ectx.pcr_set_auth_value(ESYS_TR.PCR20, b"password")
- self.ectx.tr_set_auth(ESYS_TR.PCR20, b"password")
---
-2.43.0
-
diff --git a/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r2.ebuild b/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r2.ebuild
deleted file mode 100644
index 0ec096900a00..000000000000
--- a/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r2.ebuild
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-EAPI=8
-
-DISTUTILS_EXT=1
-DISTUTILS_USE_PEP517=setuptools
-PYPI_NO_NORMALIZE=1
-PYTHON_COMPAT=( python3_{10..12} )
-
-inherit distutils-r1 pypi
-
-DESCRIPTION="Python bindings for TSS"
-HOMEPAGE="
- https://pypi.org/project/tpm2-pytss
- https://github.com/tpm2-software/tpm2-pytss
-"
-
-LICENSE="BSD-2"
-SLOT="0"
-KEYWORDS="~amd64"
-
-IUSE="+fapi test"
-
-RDEPEND="${PYTHON_DEPS}
- app-crypt/tpm2-tss:=[fapi=]
- fapi? ( >=app-crypt/tpm2-tss-3.0.3:= )
- dev-python/cffi[${PYTHON_USEDEP}]
- dev-python/asn1crypto[${PYTHON_USEDEP}]
- dev-python/cryptography[${PYTHON_USEDEP}]
- dev-python/pycparser[${PYTHON_USEDEP}]
- dev-python/pyyaml[${PYTHON_USEDEP}]"
-
-DEPEND="${RDEPEND}
- test? ( app-crypt/swtpm )"
-
-BDEPEND="${PYTHON_DEPS}
- dev-python/setuptools-scm[${PYTHON_USEDEP}]
- dev-python/pkgconfig[${PYTHON_USEDEP}]"
-
-PATCHES=(
- "${FILESDIR}/${PN}-2.1.0-test-add-check-for-renamed-cryptography-types.patch"
- "${FILESDIR}/${PN}-2.1.0-internal-crypto-fix-_MyRSAPrivateNumbers-with-crypto.patch"
- "${FILESDIR}/${PN}-2.1.0-test-disable-pcr_set_auth_value-and-pcr_set_auth_pol.patch"
- )
-
-export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
-
-distutils_enable_tests pytest
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/tpm2-pytss/, dev-python/tpm2-pytss/files/
@ 2024-05-09 20:49 Sam James
0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2024-05-09 20:49 UTC (permalink / raw
To: gentoo-commits
commit: 278cd9db03bbe938c24e4e3c4fc080c913415a4d
Author: Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Thu May 9 02:27:37 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May 9 20:48:36 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=278cd9db
dev-python/tpm2-pytss: Fix compile for newer tpm2-tss, cryptogrpahy
Closes: https://bugs.gentoo.org/931557
Closes: https://bugs.gentoo.org/931593
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/36609
Signed-off-by: Sam James <sam <AT> gentoo.org>
...-skip-some-FAPI-tests-if-testing-agains-t.patch | 83 ++++++++++++++++++++++
...y-fixes-for-newer-version-of-cryptography.patch | 53 ++++++++++++++
...ss-2.2.1-scripts-update-regex-for-defines.patch | 28 ++++++++
dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild | 6 ++
4 files changed, 170 insertions(+)
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch
new file mode 100644
index 000000000000..ff18af2015c6
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch
@@ -0,0 +1,83 @@
+From a04715c5ef5bc3d6b30b1354d64db1762bc42b9c Mon Sep 17 00:00:00 2001
+From: Erik Larsson <who+github@cnackers.org>
+Date: Fri, 12 Apr 2024 19:49:52 +0200
+Subject: [PATCH 1/2] Revert "test: skip some FAPI tests if testing agains
+ tpm2-tss master branch."
+
+This reverts commit 9e948984676b38f71e923a6e167340dc99554ac0.
+
+Fixed in tpm2-tss master branch, so remove the temporary fixes.
+
+Signed-off-by: Erik Larsson <who+github@cnackers.org>
+---
+ test/test_fapi.py | 19 +++++--------------
+ 1 file changed, 5 insertions(+), 14 deletions(-)
+
+diff --git a/test/test_fapi.py b/test/test_fapi.py
+index f702fc9..6b77c66 100644
+--- a/test/test_fapi.py
++++ b/test/test_fapi.py
+@@ -13,7 +13,7 @@ from cryptography.hazmat.primitives.asymmetric.padding import PSS
+
+ from tpm2_pytss import *
+
+-from tpm2_pytss.internal.utils import is_bug_fixed, _lib_version_atleast
++from tpm2_pytss.internal.utils import is_bug_fixed
+
+ from .TSS2_BaseTest import TpmSimulator
+ from tpm2_pytss.TSS2_Exception import TSS2_Exception
+@@ -614,8 +614,7 @@ class Common:
+ self.fapi.sign(key_path, b"\x22" * 32)
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
++ not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
+ reason="tpm2-tss bug, see #2084",
+ )
+ def test_write_authorize_nv(self, esys):
+@@ -662,8 +661,7 @@ class Common:
+ self.fapi.quote(path=key_path, pcrs=[7, 9])
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
++ not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
+ reason="tpm2-tss bug, see #2084",
+ )
+ def test_authorize_policy(self, sign_key):
+@@ -728,9 +726,7 @@ class Common:
+ self.fapi.quote(path=key_path, pcrs=[7, 9])
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2"),
+- reason="tpm2-tss bug, see #2080",
++ not is_bug_fixed(fixed_in="3.2"), reason="tpm2-tss bug, see #2080"
+ )
+ def test_policy_signed(self, cryptography_key):
+ # create external signing key used by the signing authority external to the TPM
+@@ -792,10 +788,6 @@ class Common:
+ with pytest.raises(TSS2_Exception):
+ self.fapi.sign(path=key_path, digest=b"\x11" * 32)
+
+- @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170"),
+- reason="issue on master branch.",
+- )
+ def test_policy_branched(self):
+ pcr_index = 15
+ pcr_data = b"ABCDEF"
+@@ -913,8 +905,7 @@ class Common:
+ self.fapi.delete(path=nv_path)
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
++ not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
+ reason="tpm2-tss bug, see #2089",
+ )
+ def test_policy_action(self):
+--
+2.43.2
+
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch
new file mode 100644
index 000000000000..2938e1938940
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch
@@ -0,0 +1,53 @@
+From 5a33c767be196328948baef569de084d97d62384 Mon Sep 17 00:00:00 2001
+From: Erik Larsson <who+github@cnackers.org>
+Date: Tue, 26 Mar 2024 13:25:10 +0100
+Subject: [PATCH] cryptography: fixes for newer version of cryptography
+
+Signed-off-by: Erik Larsson <who+github@cnackers.org>
+---
+ src/tpm2_pytss/internal/crypto.py | 1 +
+ test/test_encoding.py | 2 +-
+ test/test_policy.py | 2 +-
+ 3 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/tpm2_pytss/internal/crypto.py b/src/tpm2_pytss/internal/crypto.py
+index 42030c5..f9d8c34 100644
+--- a/src/tpm2_pytss/internal/crypto.py
++++ b/src/tpm2_pytss/internal/crypto.py
+@@ -25,6 +25,7 @@ from cryptography.hazmat.backends import default_backend
+ from cryptography.exceptions import UnsupportedAlgorithm, InvalidSignature
+ from typing import Tuple, Type, Any
+ import secrets
++import inspect
+ import sys
+
+ _curvetable = (
+diff --git a/test/test_encoding.py b/test/test_encoding.py
+index 1f58562..8cf4b51 100644
+--- a/test/test_encoding.py
++++ b/test/test_encoding.py
+@@ -1406,7 +1406,7 @@ class ToolsTest(TSS2_BaseTest):
+ def test_tools_decode_tpm2b_name(self):
+ if not self.has_tools:
+ self.skipTest("tools not in path")
+- key = ec.generate_private_key(ec.SECP256R1).public_key()
++ key = ec.generate_private_key(ec.SECP256R1()).public_key()
+ kb = key.public_bytes(
+ serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo
+ )
+diff --git a/test/test_policy.py b/test/test_policy.py
+index f18aa8a..5f56e21 100644
+--- a/test/test_policy.py
++++ b/test/test_policy.py
+@@ -47,7 +47,7 @@ class TestPolicy(TSS2_EsapiTest):
+ super().setUp()
+ self._has_secp192r1 = True
+ try:
+- ec.generate_private_key(ec.SECP192R1)
++ ec.generate_private_key(ec.SECP192R1())
+ except Exception:
+ self._has_secp192r1 = False
+
+--
+2.43.2
+
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch
new file mode 100644
index 000000000000..99f65025434f
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch
@@ -0,0 +1,28 @@
+From b02fdc8e259fe977c1065389c042be69e2985bdf Mon Sep 17 00:00:00 2001
+From: Erik Larsson <who+github@cnackers.org>
+Date: Sat, 20 Apr 2024 10:32:55 +0200
+Subject: [PATCH 2/2] scripts: update regex for #defines
+
+Commit fdb3594b27aee315ad56af361512800266672582 in tpm2-tss changed
+the structure of some defines, so fix the regex.
+
+Signed-off-by: Erik Larsson <who+github@cnackers.org>
+---
+ scripts/prepare_headers.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/scripts/prepare_headers.py b/scripts/prepare_headers.py
+index 6ca9b64..a7529b3 100644
+--- a/scripts/prepare_headers.py
++++ b/scripts/prepare_headers.py
+@@ -32,6 +32,7 @@ def remove_common_guards(s):
+
+ # Restructure #defines with ...
+ s = re.sub("(#define [A-Za-z0-9_]+) +\(\(.*?\) \(.*?\)\)", "\g<1>...", s)
++ s = re.sub("(#define [A-Za-z0-9_]+) +\(\(\(.*?\) .*\)", "\g<1>...", s)
+ s = re.sub("(#define [A-Za-z0-9_]+) +\(\(.*?\).*?\) ", "\g<1>...", s)
+ s = re.sub(
+ "(#define [A-Za-z0-9_]+) .*\n.*?.*\)\)", "\g<1>...", s, flags=re.MULTILINE
+--
+2.43.2
+
diff --git a/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild b/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild
index aa01cc807256..a14aa4203d81 100644
--- a/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild
+++ b/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild
@@ -39,6 +39,12 @@ BDEPEND="
dev-python/setuptools-scm[${PYTHON_USEDEP}]
"
+PATCHES=(
+ "${FILESDIR}/${PN}-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch"
+ "${FILESDIR}/${PN}-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch"
+ "${FILESDIR}/${PN}-2.2.1-scripts-update-regex-for-defines.patch"
+ )
+
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
distutils_enable_tests pytest
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-09 20:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 20:49 [gentoo-commits] repo/gentoo:master commit in: dev-python/tpm2-pytss/, dev-python/tpm2-pytss/files/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2024-03-08 18:28 Michał Górny
2023-10-01 7:27 Sam James
2022-06-12 8:04 Joonas Niilola
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox