summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Orling <tim.orling@konsulko.com>2022-03-12 12:53:54 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-16 08:48:08 +0000
commitc6f79207f8183eb3ec366dff39df070563e0e6e2 (patch)
treecadefa8e6e2de8e7d436e7a86958347dff842727
parent8af946e718317b1a47cf1a8a78938ba55f992cb8 (diff)
downloadpoky-c6f79207f8183eb3ec366dff39df070563e0e6e2.tar.gz
python3-cryptography: move from meta-python
* inherit new setuptools_rust class (which inherits new pyo3 class, which inherits cargo and python3-dir). * RDEPENDS on python3-pytest-subtests for ptest * Copy pyproject.toml for ptest as it defines the pytest.marker(s) needed * Use 'cargo bitbake' to generate the crate:// SRC_URIs - Needed some hacks to the Cargo.toml in src/rust/ to make this work (probably only package.repository was strictly required): [package] description = "cryptography includes both high level recipes and low level interfaces to common cryptographic algorithms such as symmetric ciphers, message digests, and key derivation functions." homepage = "https://github.com/pyca/cryptography" repository = "https://github.com/pyca/cryptography" * Add patches to src/rust/Cargo.toml to fix cargo errors including pem version * Add check-memfree.py to ptest to check for sufficient free memory (From OE-Core rev: 27bd134c899d00d93806ecb0a62ec3f30b1e6ec6) Signed-off-by: Tim Orling <tim.orling@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python3-cryptography/0001-Cargo.toml-specify-pem-version.patch31
-rw-r--r--meta/recipes-devtools/python/python3-cryptography/0002-Cargo.toml-edition-2018-2021.patch28
-rwxr-xr-xmeta/recipes-devtools/python/python3-cryptography/check-memfree.py10
-rw-r--r--meta/recipes-devtools/python/python3-cryptography/run-ptest4
-rw-r--r--meta/recipes-devtools/python/python3-cryptography_36.0.1.bb123
5 files changed, 196 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-cryptography/0001-Cargo.toml-specify-pem-version.patch b/meta/recipes-devtools/python/python3-cryptography/0001-Cargo.toml-specify-pem-version.patch
new file mode 100644
index 0000000000..d7ab757bb5
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-cryptography/0001-Cargo.toml-specify-pem-version.patch
@@ -0,0 +1,31 @@
1From ec8d3f3c61280c8140b34ed1479baef5e706f064 Mon Sep 17 00:00:00 2001
2From: Tim Orling <tim.orling@konsulko.com>
3Date: Fri, 14 Jan 2022 22:02:25 -0800
4Subject: [PATCH] Cargo.toml: specify pem version
5
6pem = "1.0" is not resolving, specify the current
7pem = { version: "1.0.2"}
8
9Upstream-Status: Pending
10
11Signed-off-by: Tim Orling <tim.orling@konsulko.com>
12---
13 src/rust/Cargo.toml | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
17index 617167d0..174eaa80 100644
18--- a/src/rust/Cargo.toml
19+++ b/src/rust/Cargo.toml
20@@ -9,7 +9,7 @@ publish = false
21 lazy_static = "1"
22 pyo3 = { version = "0.15.1" }
23 asn1 = { version = "0.8.7", default-features = false, features = ["derive"] }
24-pem = "1.0"
25+pem = { version = "1.0.2" }
26 chrono = { version = "0.4", default-features = false, features = ["alloc", "clock"] }
27 ouroboros = "0.13"
28
29--
302.30.2
31
diff --git a/meta/recipes-devtools/python/python3-cryptography/0002-Cargo.toml-edition-2018-2021.patch b/meta/recipes-devtools/python/python3-cryptography/0002-Cargo.toml-edition-2018-2021.patch
new file mode 100644
index 0000000000..366e3a4d39
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-cryptography/0002-Cargo.toml-edition-2018-2021.patch
@@ -0,0 +1,28 @@
1From 4b73298b214a5b69ea6edf3c2e21dd82b2b29708 Mon Sep 17 00:00:00 2001
2From: Tim Orling <tim.orling@konsulko.com>
3Date: Fri, 14 Jan 2022 22:34:59 -0800
4Subject: [PATCH 2/2] Cargo.toml: edition 2018 -> 2021
5
6Upstream-Status: Pending
7
8Signed-off-by: Tim Orling <tim.orling@konsulko.com>
9---
10 src/rust/Cargo.toml | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
14index 174eaa80..7ad053d9 100644
15--- a/src/rust/Cargo.toml
16+++ b/src/rust/Cargo.toml
17@@ -2,7 +2,7 @@
18 name = "cryptography-rust"
19 version = "0.1.0"
20 authors = ["The cryptography developers <cryptography-dev@python.org>"]
21-edition = "2018"
22+edition = "2021"
23 publish = false
24
25 [dependencies]
26--
272.30.2
28
diff --git a/meta/recipes-devtools/python/python3-cryptography/check-memfree.py b/meta/recipes-devtools/python/python3-cryptography/check-memfree.py
new file mode 100755
index 0000000000..c111a9074c
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-cryptography/check-memfree.py
@@ -0,0 +1,10 @@
1#!/usr/bin/env python3
2# https://stackoverflow.com/questions/22102999/get-total-physical-memory-in-python/28161352
3import sys
4meminfo = dict((i.split()[0].rstrip(':'),int(i.split()[1])) for i in open('/proc/meminfo').readlines())
5mem_free = meminfo['MemTotal']/1024./1024.
6if mem_free < 2.:
7 raise RuntimeError("Insufficient free memory({:.3f}): requires > 2 GB".format(mem_free))
8 sys.exit(1)
9else:
10 print("Free memory: {:.3f} GB".format(mem_free))
diff --git a/meta/recipes-devtools/python/python3-cryptography/run-ptest b/meta/recipes-devtools/python/python3-cryptography/run-ptest
new file mode 100644
index 0000000000..1e97dda63e
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-cryptography/run-ptest
@@ -0,0 +1,4 @@
1#!/bin/sh
2if ./check-memfree.py; then
3 pytest -vvvv tests/
4fi
diff --git a/meta/recipes-devtools/python/python3-cryptography_36.0.1.bb b/meta/recipes-devtools/python/python3-cryptography_36.0.1.bb
new file mode 100644
index 0000000000..00791dce2d
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-cryptography_36.0.1.bb
@@ -0,0 +1,123 @@
1SUMMARY = "Provides cryptographic recipes and primitives to python developers"
2HOMEPAGE = "https://cryptography.io/"
3SECTION = "devel/python"
4LICENSE = "( Apache-2.0 | BSD-3-Clause ) & PSF-2.0"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=bf405a8056a6647e7d077b0e7bc36aba \
6 file://LICENSE.APACHE;md5=4e168cce331e5c827d4c2b68a6200e1b \
7 file://LICENSE.BSD;md5=5ae30ba4123bc4f2fa49aa0b0dce887b \
8 file://LICENSE.PSF;md5=43c37d21e1dbad10cddcd150ba2c0595 \
9 "
10LDSHARED += "-pthread"
11
12SRC_URI[sha256sum] = "53e5c1dc3d7a953de055d77bef2ff607ceef7a2aac0353b5d630ab67f7423638"
13
14SRC_URI += " \
15 file://run-ptest \
16 file://check-memfree.py \
17 file://0001-Cargo.toml-specify-pem-version.patch \
18 file://0002-Cargo.toml-edition-2018-2021.patch \
19"
20
21inherit pypi setuptools3_rust
22
23PIP_INSTALL_DIST_PATH = "${S}/dist"
24
25DEPENDS += " \
26 ${PYTHON_PN}-asn1crypto-native \
27 ${PYTHON_PN}-cffi-native \
28 ${PYTHON_PN}-setuptools-rust-native \
29 ${PYTHON_PN}-six-native \
30"
31
32SRC_URI += " \
33 crate://crates.io/Inflector/0.11.4 \
34 crate://crates.io/aliasable/0.1.3 \
35 crate://crates.io/asn1/0.8.7 \
36 crate://crates.io/asn1_derive/0.8.7 \
37 crate://crates.io/autocfg/1.0.1 \
38 crate://crates.io/base64/0.13.0 \
39 crate://crates.io/bitflags/1.3.2 \
40 crate://crates.io/cfg-if/1.0.0 \
41 crate://crates.io/chrono/0.4.19 \
42 crate://crates.io/indoc-impl/0.3.6 \
43 crate://crates.io/indoc/0.3.6 \
44 crate://crates.io/instant/0.1.12 \
45 crate://crates.io/lazy_static/1.4.0 \
46 crate://crates.io/libc/0.2.112 \
47 crate://crates.io/lock_api/0.4.5 \
48 crate://crates.io/num-integer/0.1.44 \
49 crate://crates.io/num-traits/0.2.14 \
50 crate://crates.io/once_cell/1.9.0 \
51 crate://crates.io/ouroboros/0.13.0 \
52 crate://crates.io/ouroboros_macro/0.13.0 \
53 crate://crates.io/parking_lot/0.11.2 \
54 crate://crates.io/parking_lot_core/0.8.5 \
55 crate://crates.io/paste-impl/0.1.18 \
56 crate://crates.io/paste/0.1.18 \
57 crate://crates.io/pem/1.0.2 \
58 crate://crates.io/proc-macro-error-attr/1.0.4 \
59 crate://crates.io/proc-macro-error/1.0.4 \
60 crate://crates.io/proc-macro-hack/0.5.19 \
61 crate://crates.io/proc-macro2/1.0.36 \
62 crate://crates.io/pyo3-build-config/0.15.1 \
63 crate://crates.io/pyo3-macros-backend/0.15.1 \
64 crate://crates.io/pyo3-macros/0.15.1 \
65 crate://crates.io/pyo3/0.15.1 \
66 crate://crates.io/quote/1.0.14 \
67 crate://crates.io/redox_syscall/0.2.10 \
68 crate://crates.io/scopeguard/1.1.0 \
69 crate://crates.io/smallvec/1.7.0 \
70 crate://crates.io/stable_deref_trait/1.2.0 \
71 crate://crates.io/syn/1.0.85 \
72 crate://crates.io/unicode-xid/0.2.2 \
73 crate://crates.io/unindent/0.1.7 \
74 crate://crates.io/version_check/0.9.4 \
75 crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 \
76 crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 \
77 crate://crates.io/winapi/0.3.9 \
78"
79
80RDEPENDS:${PN} += " \
81 ${PYTHON_PN}-asn1crypto \
82 ${PYTHON_PN}-cffi \
83 ${PYTHON_PN}-idna \
84 ${PYTHON_PN}-setuptools \
85 ${PYTHON_PN}-six \
86"
87
88RDEPENDS:${PN}:append:class-target = " \
89 ${PYTHON_PN}-numbers \
90 ${PYTHON_PN}-threading \
91"
92
93RDEPENDS:${PN}-ptest += " \
94 ${PYTHON_PN}-bcrypt \
95 ${PYTHON_PN}-cryptography-vectors \
96 ${PYTHON_PN}-hypothesis \
97 ${PYTHON_PN}-iso8601 \
98 ${PYTHON_PN}-pretend \
99 ${PYTHON_PN}-psutil \
100 ${PYTHON_PN}-pytest \
101 ${PYTHON_PN}-pytest-subtests \
102 ${PYTHON_PN}-pytz \
103"
104
105inherit ptest
106
107do_install_ptest() {
108 install -D ${WORKDIR}/check-memfree.py ${D}${PTEST_PATH}/
109 install -d ${D}${PTEST_PATH}/tests
110 cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
111 install -d ${D}${PTEST_PATH}/tests/hazmat
112 cp -rf ${S}/tests/hazmat/* ${D}${PTEST_PATH}/tests/hazmat/
113 cp -r ${S}/pyproject.toml ${D}${PTEST_PATH}/
114}
115
116FILES:${PN}-ptest += " \
117 ${PTEST_PATH}/check-memfree.py \
118"
119FILES:${PN}-dbg += " \
120 ${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/hazmat/bindings/.debug \
121"
122
123BBCLASSEXTEND = "native nativesdk"