diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e5b7a85 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/tpm2-pytss-1.2.0.tar.gz diff --git a/python-tpm2-pytss-1.2.0-openssl.patch b/python-tpm2-pytss-1.2.0-openssl.patch new file mode 100644 index 0000000..522a5fb --- /dev/null +++ b/python-tpm2-pytss-1.2.0-openssl.patch @@ -0,0 +1,12 @@ +diff -up tpm2-pytss-1.2.0/test/test_crypto.py.old tpm2-pytss-1.2.0/test/test_crypto.py +--- tpm2-pytss-1.2.0/test/test_crypto.py.old 2022-10-17 15:26:41.205419193 +0200 ++++ tpm2-pytss-1.2.0/test/test_crypto.py 2022-10-17 15:28:29.717379140 +0200 +@@ -581,7 +581,7 @@ class CryptoTest(TSS2_EsapiTest): + def test_ecc_bad_curves(self): + with self.assertRaises(ValueError) as e: + pub = TPMT_PUBLIC.from_pem(ecc_bad_curve) +- self.assertEqual(str(e.exception), "unsupported curve: sect163r2") ++ self.assertEqual(str(e.exception), "Unsupported key format") + + pub = TPMT_PUBLIC.from_pem(ecc_public_key) + pub.parameters.eccDetail.curveID = TPM2_ECC.NONE diff --git a/python-tpm2-pytss.spec b/python-tpm2-pytss.spec new file mode 100644 index 0000000..1c91232 --- /dev/null +++ b/python-tpm2-pytss.spec @@ -0,0 +1,73 @@ +%global pypi_name tpm2-pytss +%global _name tpm2_pytss + +Name: python-%{pypi_name} +Version: 1.2.0 +Release: 1%{?dist} +Summary: TPM 2.0 TSS Bindings for Python + +License: BSD-2-Clause +URL: https://github.com/tpm2-software/tpm2-pytss +Source: %{pypi_source %{pypi_name}} +Patch0: python-tpm2-pytss-1.2.0-openssl.patch + +BuildRequires: python3-devel +BuildRequires: python3-pytest +BuildRequires: python3-pytest-xdist +BuildRequires: tpm2-tss-devel >= 2.0.0 +BuildRequires: gcc +# for tests +BuildRequires: swtpm +BuildRequires: tpm2-tools + +%global _description %{expand: +TPM2 TSS Python bindings for Enhanced System API (ESYS), Feature API (FAPI), +Marshaling (MU), TCTI Loader (TCTILdr) and RC Decoding (rcdecode) libraries. +It also contains utility methods for wrapping keys to TPM 2.0 data structures +for importation into the TPM, unwrapping keys and exporting them from the TPM, +TPM-less makecredential command and name calculations, TSS2 PEM Key format +support, importing Keys from PEM, DER and SSH formats, conversion from +tpm2-tools based command line strings and loading tpm2-tools context files. +} + +%description %{_description} + +%package -n python3-%{pypi_name} +Summary: %{summary} + +%description -n python3-%{pypi_name} %{_description} + +%prep +%autosetup -p1 -n %{pypi_name}-%{version} + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install + +%pyproject_save_files %{_name} + + +%check +%pyproject_check_import +# tests are very dependent on the python/openssl versions and fail at various places +# The test test_tools_decode_tpms_nv_public fails on Fedora rawhide now +%pytest --import-mode=append -k "not test_tools_decode_tpms_nv_public" -n %{_smp_build_ncpus} + + +%files -n python3-%{pypi_name} -f %{pyproject_files} +%doc README.md + + +%changelog +* Wed Oct 26 2022 Jakub Jelen - 1.2.0-1 +- Official Fedora package (#2135713) + +* Tue Apr 12 2022 Traxtopel - 1.1.0-1 +- Initial package. diff --git a/sources b/sources new file mode 100644 index 0000000..d32335e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (tpm2-pytss-1.2.0.tar.gz) = 688223d05a2ed5f3a5aeec47c77a02c10d40d4f23a97622e76acbf8f86b14ac2a92482869c5e04de395edb96b1e1b142c5ff53c7dbc97673ead531e4d6138184