Blame SPECS/python3.11-cryptography.spec

59d0b2
%global __python3 /usr/bin/python3.11
59d0b2
%global python3_pkgversion 3.11
59d0b2
59d0b2
# RHEL: Tests disabled due to missing deps
59d0b2
%bcond_with tests
59d0b2
59d0b2
%global srcname cryptography
59d0b2
59d0b2
Name:           python%{python3_pkgversion}-%{srcname}
59d0b2
Version:        37.0.2
59d0b2
Release:        5%{?dist}
59d0b2
Summary:        PyCA's cryptography library
59d0b2
59d0b2
# We bundle various crates with cryptography which is dual licensed
59d0b2
# under the ASL 2.0 and BSD-3-Clause, as well as the Python license
59d0b2
# for the OS random engine derived by CPython.
59d0b2
59d0b2
# Inflector: BSD
59d0b2
# aliasable: MIT
59d0b2
# asn1: BSD
59d0b2
# asn1_derive: BSD
59d0b2
# autocfg: MIT or ASL 2.0
59d0b2
# base64: MIT or ASL 2.0
59d0b2
# cfg-if: MIT or ASL 2.0
59d0b2
# chrono: MIT or ASL 2.0
59d0b2
# indoc: MIT or ASL 2.0
59d0b2
# indoc-impl: MIT or ASL 2.0
59d0b2
# instant: BSD
59d0b2
# lazy_static: MIT or ASL 2.0
59d0b2
# libc: MIT or ASL 2.0
59d0b2
# lock_api: MIT or ASL 2.0
59d0b2
# num-integer: MIT or ASL 2.0
59d0b2
# num-traits: MIT or ASL 2.0
59d0b2
# once_cell: MIT or ASL 2.0
59d0b2
# ouroboros: MIT or ASL 2.0
59d0b2
# ouroboros_macro: MIT or ASL 2.0
59d0b2
# parking_lot: MIT or ASL 2.0
59d0b2
# parking_lot_core: MIT or ASL 2.0
59d0b2
# paste: MIT or ASL 2.0
59d0b2
# paste-impl: MIT or ASL 2.0
59d0b2
# pem: MIT
59d0b2
# proc-macro-error: MIT or ASL 2.0
59d0b2
# proc-macro-error-attr: MIT or ASL 2.0
59d0b2
# proc-macro-hack: MIT or ASL 2.0
59d0b2
# proc-macro2: MIT or ASL 2.0
59d0b2
# pyo3: ASL 2.0
59d0b2
# pyo3-build-config: ASL 2.0
59d0b2
# pyo3-macros: ASL 2.0
59d0b2
# pyo3-macros-backend: ASL 2.0
59d0b2
# quote: MIT or ASL 2.0
59d0b2
# scopeguard: MIT or ASL 2.0
59d0b2
# smallvec: MIT or ASL 2.0
59d0b2
# stable_deref_trait: MIT or ASL 2.0
59d0b2
# syn: MIT or ASL 2.0
59d0b2
# unicode-xid: MIT or ASL 2.0
59d0b2
# unindent: MIT or ASL 2.0
59d0b2
# version_check: MIT or ASL 2.0
59d0b2
59d0b2
License:        (ASL 2.0 or BSD) and Python and BSD and MIT and (MIT or ASL 2.0) and ASL 2.0
59d0b2
URL:            https://cryptography.io/en/latest/
59d0b2
Source0:        https://github.com/pyca/cryptography/archive/%{version}/%{srcname}-%{version}.tar.gz
59d0b2
                # created by ./vendor_rust.py helper script
59d0b2
Source1:        cryptography-%{version}-vendor.tar.bz2
59d0b2
Source2:        conftest-skipper.py
59d0b2
59d0b2
# Security fix for CVE-2023-23931: memory corruption via immutable objects
59d0b2
# Bugzilla tracker: https://bugzilla.redhat.com/show_bug.cgi?id=2171817
59d0b2
# Resolved upstream: https://github.com/pyca/cryptography/commit/94a50a9731f35405f0357fa5f3b177d46a726ab3
59d0b2
Patch0:         CVE-2023-23931.patch
59d0b2
59d0b2
ExclusiveArch:  %{rust_arches}
59d0b2
59d0b2
BuildRequires:  openssl-devel
59d0b2
BuildRequires:  gcc
59d0b2
BuildRequires:  gnupg2
59d0b2
%if 0%{?fedora}
59d0b2
BuildRequires:  rust-packaging
59d0b2
%else
59d0b2
BuildRequires:  rust-toolset
59d0b2
%endif
59d0b2
59d0b2
BuildRequires:  python%{python3_pkgversion}-cffi >= 1.7
59d0b2
BuildRequires:  python%{python3_pkgversion}-devel
59d0b2
BuildRequires:  python%{python3_pkgversion}-rpm-macros
59d0b2
BuildRequires:  python%{python3_pkgversion}-setuptools
59d0b2
BuildRequires:  python%{python3_pkgversion}-setuptools-rust >= 0.11.3
59d0b2
# Cargo.toml requires asn1 0.6, but package FTBFS with 0.6.1
59d0b2
#BuildRequires:  rust-asn1-devel >= 0.6.4
59d0b2
59d0b2
%if %{with tests}
59d0b2
%if 0%{?fedora}
59d0b2
BuildRequires:  python%{python3_pkgversion}-hypothesis >= 1.11.4
59d0b2
BuildRequires:  python%{python3_pkgversion}-iso8601
59d0b2
BuildRequires:  python%{python3_pkgversion}-pretend
59d0b2
BuildRequires:  python%{python3_pkgversion}-pytest-xdist
59d0b2
%endif
59d0b2
BuildRequires:  python%{python3_pkgversion}-pytest >= 6.0
59d0b2
BuildRequires:  python%{python3_pkgversion}-pytest-benchmark
59d0b2
BuildRequires:  python%{python3_pkgversion}-pytest-subtests >= 0.3.2
59d0b2
BuildRequires:  python%{python3_pkgversion}-pytz
59d0b2
%endif
59d0b2
59d0b2
Requires:       openssl-libs
59d0b2
Requires:       python%{python3_pkgversion}-cffi >= 1.7
59d0b2
59d0b2
# Provides for the bundled crates
59d0b2
59d0b2
Provides: bundled(crate(Inflector)) = 0.11.4
59d0b2
Provides: bundled(crate(aliasable)) = 0.1.3
59d0b2
Provides: bundled(crate(asn1)) = 0.8.7
59d0b2
Provides: bundled(crate(asn1_derive)) = 0.8.7
59d0b2
Provides: bundled(crate(autocfg)) = 1.1.0
59d0b2
Provides: bundled(crate(base64)) = 0.13.0
59d0b2
Provides: bundled(crate(cfg-if)) = 1.0.0
59d0b2
Provides: bundled(crate(chrono)) = 0.4.19
59d0b2
Provides: bundled(crate(indoc)) = 0.3.6
59d0b2
Provides: bundled(crate(indoc-impl)) = 0.3.6
59d0b2
Provides: bundled(crate(instant)) = 0.1.12
59d0b2
Provides: bundled(crate(lazy_static)) = 1.4.0
59d0b2
Provides: bundled(crate(libc)) = 0.2.124
59d0b2
Provides: bundled(crate(lock_api)) = 0.4.7
59d0b2
Provides: bundled(crate(num-integer)) = 0.1.44
59d0b2
Provides: bundled(crate(num-traits)) = 0.2.14
59d0b2
Provides: bundled(crate(once_cell)) = 1.10.0
59d0b2
Provides: bundled(crate(ouroboros)) = 0.15.0
59d0b2
Provides: bundled(crate(ouroboros_macro)) = 0.15.0
59d0b2
Provides: bundled(crate(parking_lot)) = 0.11.2
59d0b2
Provides: bundled(crate(parking_lot_core)) = 0.8.5
59d0b2
Provides: bundled(crate(paste)) = 0.1.18
59d0b2
Provides: bundled(crate(paste-impl)) = 0.1.18
59d0b2
Provides: bundled(crate(pem)) = 1.0.2
59d0b2
Provides: bundled(crate(proc-macro-error)) = 1.0.4
59d0b2
Provides: bundled(crate(proc-macro-error-attr)) = 1.0.4
59d0b2
Provides: bundled(crate(proc-macro-hack)) = 0.5.19
59d0b2
Provides: bundled(crate(proc-macro2)) = 1.0.37
59d0b2
Provides: bundled(crate(pyo3)) = 0.15.2
59d0b2
Provides: bundled(crate(pyo3-build-config)) = 0.15.2
59d0b2
Provides: bundled(crate(pyo3-macros)) = 0.15.2
59d0b2
Provides: bundled(crate(pyo3-macros-backend)) = 0.15.2
59d0b2
Provides: bundled(crate(quote)) = 1.0.18
59d0b2
Provides: bundled(crate(scopeguard)) = 1.1.0
59d0b2
Provides: bundled(crate(smallvec)) = 1.8.0
59d0b2
Provides: bundled(crate(stable_deref_trait)) = 1.2.0
59d0b2
Provides: bundled(crate(syn)) = 1.0.91
59d0b2
Provides: bundled(crate(unicode-xid)) = 0.2.2
59d0b2
Provides: bundled(crate(unindent)) = 0.1.8
59d0b2
Provides: bundled(crate(version_check)) = 0.9.4
59d0b2
59d0b2
# Cryptography crate
59d0b2
Provides: crate(cryptography-rust) = 0.1.0
59d0b2
59d0b2
%description
59d0b2
cryptography is a package designed to expose cryptographic primitives and
59d0b2
recipes to Python developers.
59d0b2
59d0b2
%prep
59d0b2
%autosetup -p1 -n %{srcname}-%{version}
59d0b2
59d0b2
59d0b2
%if 0%{?fedora}
59d0b2
# Fedora: use cargo macros to make use of RPMified crates
59d0b2
%cargo_prep
59d0b2
cd src/rust
59d0b2
rm -f Cargo.lock
59d0b2
%cargo_generate_buildrequires
59d0b2
cd ../..
59d0b2
%else
59d0b2
# RHEL: use vendored Rust crates
59d0b2
%cargo_prep -V 1
59d0b2
%endif
59d0b2
59d0b2
%build
59d0b2
export RUSTFLAGS="%__global_rustflags"
59d0b2
%py3_build
59d0b2
59d0b2
%install
59d0b2
# Actually other *.c and *.h are appropriate
59d0b2
# see https://github.com/pyca/cryptography/issues/1463
59d0b2
find . -name .keep -print -delete
59d0b2
%py3_install
59d0b2
59d0b2
%check
59d0b2
%if %{with tests}
59d0b2
%if 0%{?rhel}
59d0b2
# skip hypothesis tests on RHEL
59d0b2
rm -rf tests/hypothesis
59d0b2
# append skipper to skip iso8601 and pretend tests
59d0b2
cat < %{SOURCE2} >> tests/conftest.py
59d0b2
%endif
59d0b2
59d0b2
%if 0%{?eln}
59d0b2
# enable SHA-1 signatures for RSA tests
59d0b2
# also see https://github.com/pyca/cryptography/pull/6931 and rhbz#2060343
59d0b2
export OPENSSL_ENABLE_SHA1_SIGNATURES=yes
59d0b2
%endif
59d0b2
59d0b2
# see https://github.com/pyca/cryptography/issues/4885 and
59d0b2
# see https://bugzilla.redhat.com/show_bug.cgi?id=1761194 for deselected tests
59d0b2
# see rhbz#2042413 for memleak. It's unstable under Python 3.11 and makes
59d0b2
# not much sense for downstream testing.
59d0b2
PYTHONPATH=${PWD}/vectors:%{buildroot}%{python3_sitearch} \
59d0b2
    %{__python3} -m pytest \
59d0b2
    -k "not (test_buffer_protocol_alternate_modes or test_dh_parameters_supported or test_load_ecdsa_no_named_curve or test_openssl_memleak)"
59d0b2
%endif
59d0b2
59d0b2
%files -n python%{python3_pkgversion}-%{srcname}
59d0b2
%doc README.rst docs
59d0b2
%license LICENSE LICENSE.APACHE LICENSE.BSD
59d0b2
%{python3_sitearch}/%{srcname}
59d0b2
%{python3_sitearch}/%{srcname}-%{version}-py*.egg-info
59d0b2
59d0b2
%changelog
59d0b2
* Thu Feb 23 2023 Charalampos Stratakis <cstratak@redhat.com> - 37.0.2-5
59d0b2
- Bump release for rebuild
59d0b2
59d0b2
* Mon Feb 20 2023 Charalampos Stratakis <cstratak@redhat.com> - 37.0.2-4
59d0b2
- Security fix for CVE-2023-23931
59d0b2
59d0b2
* Tue Feb 14 2023 Charalampos Stratakis <cstratak@redhat.com> - 37.0.2-3
59d0b2
- Rebuild for gating
59d0b2
59d0b2
* Mon Feb 13 2023 Charalampos Stratakis <cstratak@redhat.com> - 37.0.2-2
59d0b2
- Add explicit dependency on python3.11-rpm-macros
59d0b2
59d0b2
* Thu Dec 01 2022 Charalampos Stratakis <cstratak@redhat.com> - 37.0.2-1
59d0b2
- Initial package
59d0b2
- Fedora contributions by:
59d0b2
      Alfredo Moralejo <amoralej@redhat.com>
59d0b2
      Charalampos Stratakis <cstratak@redhat.com>
59d0b2
      Christian Heimes <christian@python.org>
59d0b2
      Colin Walters <walters@verbum.org>
59d0b2
      Dennis Gilmore <dennis@ausil.us>
59d0b2
      Fabio Valentini <decathorpe@gmail.com>
59d0b2
      Felix Schwarz <felix.schwarz@oss.schwarz.eu>
59d0b2
      Haikel Guemar <hguemar@fedoraproject.org>
59d0b2
      Igor Gnatenko <ignatenkobrain@fedoraproject.org>
59d0b2
      Iryna Shcherbina <shcherbina.iryna@gmail.com>
59d0b2
      Lumir Balhar <lbalhar@redhat.com>
59d0b2
      Matěj Cepl <mcepl@cepl.eu>
59d0b2
      Miro Hrončok <miro@hroncok.cz>
59d0b2
      Nathaniel McCallum <npmccallum@redhat.com>
59d0b2
      Randy Barlow <randy@electronsweatshop.com>
59d0b2
      Robert Kuska <rkuska@redhat.com>
59d0b2
      Sahana Prasad <sahana@redhat.com>
59d0b2
      Stephen Gallagher <sgallagh@redhat.com>
59d0b2
      Troy Dawson <tdawson@redhat.com>