From c7f3807e06c4edf634b11228140a8abcb57f91b8 Mon Sep 17 00:00:00 2001 From: rdobuilder Date: Feb 21 2024 09:43:38 +0000 Subject: Update to 7.4.2 Related-to: https://review.rdoproject.org/r/q/Iead3f743115e866aa6035db806ac72a129a34b75 --- diff --git a/.python-pysaml2.metadata b/.python-pysaml2.metadata new file mode 100644 index 0000000..3aefff8 --- /dev/null +++ b/.python-pysaml2.metadata @@ -0,0 +1 @@ +f7b9b94c9bf3357699196efbfa5716bdb43946e3 SOURCES/pysaml2-7.4.2.tar.gz diff --git a/SOURCES/.gitignore b/SOURCES/.gitignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/SOURCES/.gitignore diff --git a/SOURCES/0001-Remove-poetry-cli-usage-and-fix-for-running-unit-tes.patch b/SOURCES/0001-Remove-poetry-cli-usage-and-fix-for-running-unit-tes.patch new file mode 100644 index 0000000..0bc8342 --- /dev/null +++ b/SOURCES/0001-Remove-poetry-cli-usage-and-fix-for-running-unit-tes.patch @@ -0,0 +1,42 @@ +From fc75392193a167d68ec77474f6b558d5551efd94 Mon Sep 17 00:00:00 2001 +From: Alfredo Moralejo +Date: Wed, 21 Feb 2024 09:45:57 +0100 +Subject: [PATCH] Remove poetry cli usage and fix for running unit tests in + CentOS9 + +--- + pyproject.toml | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/pyproject.toml b/pyproject.toml +index e8e149a..802a6d7 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -109,9 +109,6 @@ testpaths = [ + markers = [ + "mongo", + ] +-pythonpath = [ +- "tests", +-] + + [tool.coverage.run] + branch = true +@@ -262,12 +259,7 @@ skip_install = true + whitelist_externals = + xmlsec1 + poetry +-commands_pre = +- poetry install --with test,coverage +- xmlsec1 --version +- poetry run python --version +- poetry run pytest --version +- poetry run tox --version + commands = +- poetry run pytest --import-mode=importlib --cov=saml2 --cov-report=term-missing ++ pytest --import-mode=importlib --cov=saml2 --cov-report=term-missing + """ ++ +-- +2.38.1 + diff --git a/SOURCES/0001-Remove-utility-from-packaging.patch b/SOURCES/0001-Remove-utility-from-packaging.patch new file mode 100644 index 0000000..fea3b6d --- /dev/null +++ b/SOURCES/0001-Remove-utility-from-packaging.patch @@ -0,0 +1,30 @@ +From 1deee97cb9121272cbdbcea491721875269e4fbf Mon Sep 17 00:00:00 2001 +From: Joel Capitao +Date: Sat, 8 Jul 2023 08:00:08 +0200 +Subject: [PATCH] Remove utility from packaging + +This fixes #899. +When packaging saml2 downstream with pyproject RPM macros, +the utility module is installed. This might clash with other +modules. + +(cherry picked from commit f20b6735053fd331aca3faba2bf1521c050bdf63) +--- + pyproject.toml | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 1a76df7b..1c2715e1 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -24,7 +24,6 @@ classifiers = [ + packages = [ + { include = "saml2", from = "src" }, + { include = "saml2test", from = "src" }, +- { include = "utility", from = "src" }, + ] + + [tool.poetry.urls] +-- +2.40.1 + diff --git a/SOURCES/0001-Use-importlib.resources-in-python-3.7.patch b/SOURCES/0001-Use-importlib.resources-in-python-3.7.patch new file mode 100644 index 0000000..43ed86e --- /dev/null +++ b/SOURCES/0001-Use-importlib.resources-in-python-3.7.patch @@ -0,0 +1,83 @@ +From e1392feda59ed0fdcf10934d57f833c64e99c19a Mon Sep 17 00:00:00 2001 +From: Alfredo Moralejo +Date: Thu, 30 Sep 2021 09:39:36 +0200 +Subject: [PATCH] Use importlib.resources in python >= 3.7 + +importlib.resources was added to python standard library since python 3.7 +[1]. This patch is implementing conditional to use it instead of the +importlib_resources backport when using python 3.7 or newer. + +[1] https://docs.python.org/3/whatsnew/3.7.html +--- + setup.cfg | 2 +- + src/saml2/sigver.py | 7 ++++++- + src/saml2/xml/schema/__init__.py | 7 ++++++- + 3 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/setup.cfg b/setup.cfg +index e04c5520..41ccdd7f 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -53,7 +53,7 @@ install_requires = + pytz + requests >= 1.0.0 + six +- importlib_resources ++ importlib_resources;python_version<'3.7' + xmlschema >= 1.2.1 + + +diff --git a/src/saml2/sigver.py b/src/saml2/sigver.py +index 973d6245..c9c66b13 100644 +--- a/src/saml2/sigver.py ++++ b/src/saml2/sigver.py +@@ -9,12 +9,12 @@ import logging + import os + import re + import six ++import sys + from uuid import uuid4 as gen_random_key + from time import mktime + from tempfile import NamedTemporaryFile + from subprocess import Popen + from subprocess import PIPE +-from importlib_resources import path as _resource_path + + from OpenSSL import crypto + +@@ -59,6 +59,11 @@ from saml2.xmlenc import EncryptedData + from saml2.xml.schema import node_to_schema + from saml2.xml.schema import XMLSchemaError + ++# importlib.resources was introduced in python 3.7 ++if sys.version_info[:2] >= (3, 7): ++ from importlib.resources import path as _resource_path ++else: ++ from importlib_resources import path as _resource_path + + logger = logging.getLogger(__name__) + +diff --git a/src/saml2/xml/schema/__init__.py b/src/saml2/xml/schema/__init__.py +index 56e08b1c..ce38b807 100644 +--- a/src/saml2/xml/schema/__init__.py ++++ b/src/saml2/xml/schema/__init__.py +@@ -1,10 +1,15 @@ +-from importlib_resources import path as _resource_path ++import sys + + from xmlschema import XMLSchema as _XMLSchema + from xmlschema.exceptions import XMLSchemaException as XMLSchemaError + + import saml2.data.schemas as _data_schemas + ++# importlib.resources was introduced in python 3.7 ++if sys.version_info[:2] >= (3, 7): ++ from importlib.resources import path as _resource_path ++else: ++ from importlib_resources import path as _resource_path + + def _create_xml_schema_validator(source, **kwargs): + kwargs = { +-- +2.26.3 + diff --git a/SPECS/python-pysaml2.spec b/SPECS/python-pysaml2.spec new file mode 100644 index 0000000..edee53a --- /dev/null +++ b/SPECS/python-pysaml2.spec @@ -0,0 +1,257 @@ +%global srcname pysaml2 +%global gittag v%{version} +%global _description \ +PySAML2 is a pure python implementation of SAML2. It contains all \ +necessary pieces for building a SAML2 service provider or an identity \ +provider. The distribution contains examples of both. Originally \ +written to work in a WSGI environment there are extensions that allow \ +you to use it with other frameworks. + + +Name: python-%{srcname} +Version: 7.4.2 +Release: 2%{?dist} +Summary: Python implementation of SAML Version 2 +License: Apache-2.0 +URL: https://github.com/IdentityPython/%{srcname} + +Source0: https://github.com/IdentityPython/%{srcname}/archive/%{gittag}/%{srcname}-%{version}.tar.gz +#TODO: remove the line below once the patch upstream is merged and contained +# in a release https://github.com/IdentityPython/pysaml2/pull/916 +Patch0001: 0001-Remove-utility-from-packaging.patch +# there is no poetry cli package in RDO so we run the tests with pytest +Patch0002: 0001-Remove-poetry-cli-usage-and-fix-for-running-unit-tes.patch + +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: pyproject-rpm-macros +BuildRequires: git-core +BuildRequires: python3-sphinx +# For tests +BuildRequires: python3-pytest +BuildRequires: python3-pymongo +BuildRequires: python3-responses +BuildRequires: xmlsec1 +BuildRequires: xmlsec1-openssl + + +%description %{_description} + +%package -n python%{python3_pkgversion}-%{srcname} +Summary: Python implementation of SAML Version 2 + +Requires: xmlsec1 +Requires: xmlsec1-openssl + +%description -n python%{python3_pkgversion}-%{srcname} %{_description} + + +%package doc +Summary: Documentation for Python implementation of SAML Version 2 + +%description doc +Documentation for Python implementation of SAML Version 2. + + +%generate_buildrequires +%pyproject_buildrequires -t + +%prep +%autosetup -n %{srcname}-%{version} -S git + +# We need to remove the shebang manually otherwise automation removes +# the whole line leading to have a Syntax error: unterminated triple-quoted +# string. +sed -i 's|f"""#!/usr/bin/env python|f"""|' src/saml2/tools/parse_xsd2.py + +# Avoid non-executable-script rpmlint while maintaining timestamps +find src -name \*.py | +while read source; do + if head -n1 "$source" | grep -F '/usr/bin/env'; then + touch --ref="$source" "$source".ts + sed -i '/\/usr\/bin\/env python/{d;q}' "$source" + touch --ref="$source".ts "$source" + rm "$source".ts + fi +done + +# special case for parse_xsd generated file which have lines like: +#!!!! 'NoneType' object has no attribute 'py_class' +source="src/saml2/schema/wsdl.py" +touch --ref="$source" "$source".ts +sed -i '1,3{d;q}' "$source" +touch --ref="$source".ts "$source" +rm "$source".ts + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files saml2 saml2test + +# compat symlinks +for bin in parse_xsd2 make_metadata mdexport merge_metadata; do + ln -s $bin %{buildroot}/%{_bindir}/${bin}.py +done + +# drop alabaster Sphinx theme, not packaged in Fedora yet +sed -i '/alabaster/d' docs/conf.py +# generate html docs +export PYTHONPATH="%{buildroot}/%{python3_sitelib}" +sphinx-build-3 docs html +# remove the sphinx-build leftovers +rm -rf html/.{doctrees,buildinfo} + +%check +# Many of the unit tests rely on sha1 which is disabled in CentOS 9 +%pytest -k 'not sign and not test_response_ and not test_do_logout_post and not test_do_logout_session_expired and not test_xbox and not test_xbox_non_ascii_ava and not test_1 and not test_2 and not test_issuer_none and not test_other_response and not test_verify_1 and not test_parse_2 and not test_verify_w_authn and not test_unpack_nested_eptid and not test_multiple_attribute_statement and not test_logout_response' + +%files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files} +%{_bindir}/parse_xsd2 +%{_bindir}/parse_xsd2.py +%{_bindir}/make_metadata +%{_bindir}/make_metadata.py +%{_bindir}/mdexport +%{_bindir}/mdexport.py +%{_bindir}/merge_metadata +%{_bindir}/merge_metadata.py +%license LICENSE + +%files doc +%license LICENSE +%doc html + +%changelog +* Fri Jul 21 2023 Fedora Release Engineering - 7.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Mon Jul 10 2023 Joel Capitao - 7.4.2-1 +- Update to 7.4.2 + +* Fri Jul 07 2023 Joel Capitao - 7.3.1-1 +- Update to 7.3.1 +- Switch to pyproject-rpm-macros +- Move to SPDX + +* Thu Jun 29 2023 Python Maint - 7.1.2-3 +- Rebuilt for Python 3.12 + +* Fri Jan 20 2023 Fedora Release Engineering - 7.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Aug 04 2022 Alfredo Moralejo - 7.1.2-1 +- Update to 7.1.2 + +* Fri Jul 22 2022 Fedora Release Engineering - 7.0.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 7.0.1-5 +- Rebuilt for Python 3.11 + +* Fri Jan 28 2022 Kai A. Hiller - 7.0.1-4 +- Add missing requires for xmlsec1 and xmlsec1-openssl + +* Fri Jan 21 2022 Fedora Release Engineering - 7.0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Oct 21 2021 Alfredo Moralejo - 7.0.1-2 +- Use importlib.resources in python >= 3.7 (rhbz#2008668) + +* Fri Sep 24 2021 Joel Capitao - 7.0.1-1 +- Update to 7.0.1 (rhbz#1290944) + +* Fri Jul 23 2021 Fedora Release Engineering - 6.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 6.1.0-3 +- Rebuilt for Python 3.10 + +* Wed Jan 27 2021 Fedora Release Engineering - 6.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Thu Jul 30 2020 Yatin Karel - 6.1.0-1 +- Update to 6.1.0 (rhbz#1290944) + +* Wed Jul 29 2020 Fedora Release Engineering - 4.5.0-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 4.5.0-11 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 4.5.0-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Oct 03 2019 Miro Hrončok - 4.5.0-9 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 4.5.0-8 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 4.5.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Feb 11 2019 Miro Hrončok - 4.5.0-6 +- Subpackage python2-pysaml2 has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Sat Feb 02 2019 Fedora Release Engineering - 4.5.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jul 14 2018 Fedora Release Engineering - 4.5.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 4.5.0-3 +- Rebuilt for Python 3.7 + +* Wed Jun 6 2018 - 4.5.0-2 +- Resolves: rhbz#1582254 - re-enable python2 support + +* Fri May 18 2018 - 4.5.0-1 +- upgrade to current upstream +- enforce Python packaging standards + +* Fri Feb 09 2018 Iryna Shcherbina - 3.0.2-10 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Feb 09 2018 Fedora Release Engineering - 3.0.2-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 3.0.2-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu Mar 16 2017 Jason Joyce - 3.0.2-7 +- security fix for entity expansion issue - CVE-2016-10149 + +* Sat Feb 11 2017 Fedora Release Engineering - 3.0.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 3.0.2-5 +- Rebuild for Python 3.6 + +* Sun Nov 13 2016 Peter Robinson 3.0.2-4 +- fix pycrypto dependency + +* Tue Jul 19 2016 Fedora Release Engineering - 3.0.2-3 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 3.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sat Dec 05 2015 Alan Pevec 3.0.2-1 +- Update to 3.0.2 + +* Wed Jul 15 2015 Alan Pevec - 3.0.0-1 +- update to upstream release 3.0.0 + +* Thu Jun 18 2015 Alan Pevec - 3.0.0-0.3.git40603ae +- include unreleased fix for https://github.com/rohe/pysaml2/issues/202 +- review feedback +- fix rpmlint errors + +* Tue Mar 31 2015 Alan Pevec - 2.4.0-1 +- Update to 2.4.0 + +* Mon Feb 16 2015 Dan Prince - 2.3.0-1 +- Initial package.