saltbundlepy-cryptography/saltbundlepy-cryptography.spec

131 lines
4.8 KiB
RPMSpec
Raw Normal View History

#
# spec file for package saltbundlepy-cryptography
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy
# Disable python bytecompile for all distros
# It's called explicitly in the spec
%global __brp_python_bytecompile %{nil}
%bcond_with test
Name: saltbundlepy-cryptography
Version: 3.3.2
Release: 0
Summary: Python library which exposes cryptographic recipes and primitives
License: Apache-2.0 OR BSD-3-Clause
Group: Development/Languages/Python
URL: https://cryptography.io/en/latest/
Source0: https://files.pythonhosted.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz
Source1: https://files.pythonhosted.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz.asc
Source2: %{name}.keyring
# PATCH-FIX-SLE disable-uneven-sizes-tests.patch bnc#944204
Patch1: disable-uneven-sizes-tests.patch
Patch2: skip_openssl_memleak_test.patch
# PATCH-FIX-UPSTREAM CVE-2023-23931-dont-allow-update-into.patch bsc#1208036
Patch3: CVE-2023-23931-dont-allow-update-into.patch
# PATCH-FIX-UPSTREAM CVE-2023-49083.patch bsc#1217592
Patch4: CVE-2023-49083.patch
%if (0%{?sle_version} && 0%{?sle_version} < 150000) || 0%{?suse_version} == 1110 || 0%{?rhel} == 7 || 0%{?debian} == 12 || 0%{?ubuntu} == 2204
Patch100: fix-build-with-old-ssl.patch
%endif
%if 0%{?debian} >= 12 || 0%{?ubuntu} >= 2204 || 0%{?rhel} >= 9 || 0%{?suse_version} >= 1600
Patch101: definitions-ERR_GET.patch
Patch102: fips-mode.patch
%endif
BuildRequires: %{saltbundlepy_module asn1crypto >= 0.21.0}
BuildRequires: %{saltbundlepy_module cffi >= 1.7}
BuildRequires: %{saltbundlepy_module cryptography-vectors >= %{version}}
BuildRequires: %{saltbundlepy_module devel >= 3.10}
BuildRequires: %{saltbundlepy_module idna >= 2.1}
BuildRequires: %{saltbundlepy_module pyasn1-modules}
BuildRequires: %{saltbundlepy_module pytz}
BuildRequires: %{saltbundlepy_module setuptools >= 11.3}
BuildRequires: %{saltbundlepy_module six >= 1.4.1}
BuildRequires: fdupes
%if 0%{?suse_version} == 1110 || 0%{?suse_version} == 1315
BuildRequires: saltbundle-libopenssl-devel
%else
BuildRequires: libopenssl-devel
%endif
BuildRequires: pkgconfig
BuildRequires: saltbundlepy-rpm-macros
BuildRequires: saltbundle-libffi-devel
Requires: saltbundlepy-asn1crypto >= 0.21.0
Requires: saltbundlepy-cffi >= 1.7
Requires: saltbundlepy-idna >= 2.1
Requires: saltbundlepy-packaging
Requires: saltbundlepy-pyasn1 >= 0.1.8
Requires: saltbundlepy-setuptools >= 11.3
Requires: saltbundlepy-six >= 1.4.1
# SECTION Test requirements
%if %{with test}
BuildRequires: %{python_module hypothesis >= 1.11.4}
BuildRequires: %{python_module iso8601}
BuildRequires: %{python_module packaging}
BuildRequires: %{python_module pretend}
BuildRequires: %{python_module pyasn1 >= 0.1.8}
BuildRequires: %{python_module pytest > 3.3.0}
%endif
# /SECTION
%python_subpackages
%description
cryptography is a package designed to expose cryptographic
recipes and primitives to Python developers. Our goal is
for it to be your "cryptographic standard library". It
supports Python 2.7, Python 3.4+, and PyPy-5.3+.
cryptography includes both high level recipes, and low
level interfaces to common cryptographic algorithms such as
symmetric ciphers, message digests and key derivation
functions.
%prep
%setup -q -n cryptography-%{version}
%autopatch -p1
%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_build
%install
# Actually other *.c and *.h are appropriate
# see https://github.com/pyca/cryptography/issues/1463
find . -name .keep -print -delete
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%{python_expand # Just a simple test loading the module
export PYTHONPATH="%{buildroot}%{$python_sitearch}"
$python -c 'from cryptography.hazmat.bindings._openssl import ffi, lib; fips_mode = getattr(lib, "FIPS_mode"); mode = fips_mode()'
}
%if %{with test}
%pytest_arch
%endif
%files %{python_files}
%license LICENSE LICENSE.APACHE LICENSE.BSD
%doc AUTHORS.rst CONTRIBUTING.rst CHANGELOG.rst README.rst
%{python_sitearch}/*
%changelog