Blame SPECS/python3.11-cryptography.spec

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