From 8e67653b20887d6ba79845c6b64fe30ea3ae426e Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Thu, 18 Feb 2021 16:39:43 +0000 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/python-cryptography.git#8fd31561e0c8e57fab71e32c7ec88e8f530c4274 --- .gitignore | 3 -- python-cryptography.spec | 38 ++----------- sources | 5 +- vendor_rust.py | 112 --------------------------------------- 4 files changed, 7 insertions(+), 151 deletions(-) delete mode 100755 vendor_rust.py diff --git a/.gitignore b/.gitignore index 32c836d..5f81814 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,3 @@ /cryptography-3.4.1.tar.gz.asc /cryptography-3.4.2.tar.gz /cryptography-3.4.2.tar.gz.asc -/cryptography-3.4.4.tar.gz -/cryptography-3.4.4.tar.gz.asc -/cryptography-3.4.4-vendor.tar.bz2 diff --git a/python-cryptography.spec b/python-cryptography.spec index 527d6ae..51d1de8 100644 --- a/python-cryptography.spec +++ b/python-cryptography.spec @@ -6,8 +6,8 @@ %global pyo3_version 0.13.1 Name: python-%{srcname} -Version: 3.4.4 -Release: 2%{?dist} +Version: 3.4.2 +Release: 1%{?dist} Summary: PyCA's cryptography library License: ASL 2.0 or BSD @@ -19,19 +19,11 @@ Source1: %{pypi_source}.asc # gpg2 --recv-keys "05FD 9FA1 6CF7 5735 0D91 A560 235A E5F1 29F9 ED98" # gpg2 --export --export-options export-minimal "05FD 9FA1 6CF7 5735 0D91 A560 235A E5F1 29F9 ED98" > gpgkey-05FD_9FA1_6CF7_5735_0D91_A560_235A_E5F1_29F9_ED98.gpg Source2: gpgkey-05FD_9FA1_6CF7_5735_0D91_A560_235A_E5F1_29F9_ED98.gpg -%if 0%{?rhel} - # created by ./vendor_rust.py helper script -Source3: cryptography-%{version}-vendor.tar.bz2 -%endif BuildRequires: openssl-devel BuildRequires: gcc BuildRequires: gnupg2 -%if 0%{?fedora} BuildRequires: rust-packaging -%else -BuildRequires: rust-toolset -%endif BuildRequires: python%{python3_pkgversion}-cffi >= 1.7 BuildRequires: python%{python3_pkgversion}-devel @@ -41,14 +33,12 @@ BuildRequires: python%{python3_pkgversion}-six >= 1.4.1 %if %{with tests} BuildRequires: python%{python3_pkgversion}-cryptography-vectors = %{version} -%if 0%{?fedora} BuildRequires: python%{python3_pkgversion}-hypothesis >= 1.11.4 -BuildRequires: python%{python3_pkgversion}-pytest-xdist -%endif BuildRequires: python%{python3_pkgversion}-iso8601 BuildRequires: python%{python3_pkgversion}-pretend BuildRequires: python%{python3_pkgversion}-pytest >= 6.0 BuildRequires: python%{python3_pkgversion}-pytest-subtests >= 0.3.2 +BuildRequires: python%{python3_pkgversion}-pytest-xdist BuildRequires: python%{python3_pkgversion}-pytz %endif @@ -71,20 +61,13 @@ recipes to Python developers. %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %autosetup -p1 -n %{srcname}-%{version} +%cargo_prep +rm -f src/rust/Cargo.lock %generate_buildrequires - -%if 0%{?fedora} -# Fedora: use cargo macros to make use of RPMified crates -%cargo_prep cd src/rust -rm -f Cargo.lock %cargo_generate_buildrequires cd ../.. -%else -# RHEL: use vendored Rust crates -%cargo_prep -V 3 -%endif %build %py3_build @@ -97,11 +80,6 @@ find . -name .keep -print -delete %check %if %{with tests} -%if 0%{?rhel} -# skip hypothesis tests on RHEL -rm -rf tests/hypothesis -%endif - # see https://github.com/pyca/cryptography/issues/4885 and # see https://bugzilla.redhat.com/show_bug.cgi?id=1761194 for deselected tests PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest -k "not (test_buffer_protocol_alternate_modes or test_dh_parameters_supported or test_load_ecdsa_no_named_curve)" @@ -114,12 +92,6 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest -k "not (test_ %{python3_sitearch}/%{srcname}-%{version}-py*.egg-info %changelog -* Fri Feb 12 2021 Christian Heimes - 3.4.4-2 -- Provide RHEL build infrastructure - -* Wed Feb 10 2021 Christian Heimes - 3.4.4-1 -- Update to 3.4.4 (#1927044) - * Mon Feb 08 2021 Christian Heimes - 3.4.2-1 - Update to 3.4.2 (#1926339) - Package no longer depends on Rust (#1926181) diff --git a/sources b/sources index 3142fdd..00d5b88 100644 --- a/sources +++ b/sources @@ -1,3 +1,2 @@ -SHA512 (cryptography-3.4.4.tar.gz) = 3c94cb3eccc67cd1d7be9d16353f94a08019534517bbe9cd97ee75f05631418d1688fa7efc7284a62482d22b731de524f45268cf357d47a37a2fb033f1b9b3fc -SHA512 (cryptography-3.4.4.tar.gz.asc) = 395c8af891a2ae9c2a5954291e58d223fb5a9157794f22cf83bb798dd13534277d44846edca723b44dcbcb609e5db55e3fca7416fd452f23c5bb6e126c4c5284 -SHA512 (cryptography-3.4.4-vendor.tar.bz2) = c1ab9ad8e1580bae315416f455db7f9376f78787f6859758645f40f0380225c65952e7d2c60e441029cb6d9f7f447b3667c98b85edd2204f2c0e20aef4fd1905 +SHA512 (cryptography-3.4.2.tar.gz) = 8fa9fad24d55d3ff129d4ebf0837cd267bbd180429cda09e60730e67fb18e6af7ff4630989b18ab31ffc85046259eba546ad63388fd6e252bfbc850e7cbc62fc +SHA512 (cryptography-3.4.2.tar.gz.asc) = ae8ef10065db06d58879a3eb553f0d0c430f28da9a48789f09410cee694409c715972a3506c5bd3c8519125df412805b547e1109d9d3867d79858578e3082098 diff --git a/vendor_rust.py b/vendor_rust.py deleted file mode 100755 index cd8355e..0000000 --- a/vendor_rust.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/python3 -"""Vendor PyCA cryptography's Rust crates -""" -import argparse -import os -import re -import tarfile -import tempfile -import shutil -import subprocess -import sys - -VENDOR_DIR = "vendor" -CARGO_TOML = "src/rust/Cargo.toml" -RE_VERSION = re.compile("Version:\s*(.*)") - -parser = argparse.ArgumentParser(description="Vendor Rust packages") -parser.add_argument( - "--spec", default="python-cryptography.spec", help="cryptography source tar bundle" -) - - -def cargo(cmd, manifest): - args = ["cargo", cmd, f"--manifest-path={manifest}"] - return subprocess.check_call( - args, stdout=subprocess.DEVNULL, stderr=sys.stderr, env={} - ) - - -def tar_reset(tarinfo): - """Reset user, group, mtime, and mode to create reproducible tar""" - tarinfo.uid = 0 - tarinfo.gid = 0 - tarinfo.uname = "root" - tarinfo.gname = "root" - tarinfo.mtime = 0 - if tarinfo.type == tarfile.DIRTYPE: - tarinfo.mode = 0o755 - else: - tarinfo.mode = 0o644 - if tarinfo.pax_headers: - raise ValueError(tarinfo.name, tarinfo.pax_headers) - return tarinfo - - -def tar_reproducible(tar, basedir): - """Create reproducible tar file""" - - content = [basedir] - for root, dirs, files in os.walk(basedir): - for directory in dirs: - content.append(os.path.join(root, directory)) - for filename in files: - content.append(os.path.join(root, filename)) - content.sort() - - for fn in content: - tar.add(fn, filter=tar_reset, recursive=False, arcname=fn) - - -def main(): - args = parser.parse_args() - spec = args.spec - - # change cwd to work in bundle directory - here = os.path.dirname(os.path.abspath(spec)) - os.chdir(here) - - # extract version number from bundle name - with open(spec) as f: - for line in f: - mo = RE_VERSION.search(line) - if mo is not None: - version = mo.group(1) - break - else: - raise ValueError(f"Cannot find version in {spec}") - - bundle_file = f"cryptography-{version}.tar.gz" - vendor_file = f"cryptography-{version}-vendor.tar.bz2" - - # remove existing vendor directory and file - if os.path.isdir(VENDOR_DIR): - shutil.rmtree(VENDOR_DIR) - try: - os.unlink(vendor_file) - except FileNotFoundError: - pass - - print(f"Getting crates for {bundle_file}", file=sys.stderr) - - # extract tar file in tempdir - # fetch and vendor Rust crates - with tempfile.TemporaryDirectory(dir=here) as tmp: - with tarfile.open(bundle_file) as tar: - tar.extractall(path=tmp) - manifest = os.path.join(tmp, f"cryptography-{version}", CARGO_TOML) - cargo("fetch", manifest) - cargo("vendor", manifest) - - print("\nCreating tar ball...", file=sys.stderr) - with tarfile.open(vendor_file, "x:bz2") as tar: - tar_reproducible(tar, VENDOR_DIR) - - # remove vendor dir - shutil.rmtree(VENDOR_DIR) - - parser.exit(0, f"Created {vendor_file}\n") - - -if __name__ == "__main__": - main()