1 |
commit: ba6d20d101e079eb1e997fcfb830b40b111b7217 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 22 09:52:43 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 22 10:10:10 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba6d20d1 |
7 |
|
8 |
dev-python/pycryptodome: Unbundle libtomcrypt |
9 |
|
10 |
Closes: https://bugs.gentoo.org/732662 |
11 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
12 |
|
13 |
.../pycryptodome-3.9.9-system-libtomcrypt.patch | 43 +++++++++++++++++ |
14 |
.../pycryptodome/pycryptodome-3.9.9-r1.ebuild | 54 ++++++++++++++++++++++ |
15 |
2 files changed, 97 insertions(+) |
16 |
|
17 |
diff --git a/dev-python/pycryptodome/files/pycryptodome-3.9.9-system-libtomcrypt.patch b/dev-python/pycryptodome/files/pycryptodome-3.9.9-system-libtomcrypt.patch |
18 |
new file mode 100644 |
19 |
index 00000000000..927ad65e7c4 |
20 |
--- /dev/null |
21 |
+++ b/dev-python/pycryptodome/files/pycryptodome-3.9.9-system-libtomcrypt.patch |
22 |
@@ -0,0 +1,43 @@ |
23 |
+--- a/setup.py 2019-01-19 22:52:55.000000000 +0100 |
24 |
++++ b/setup.py 2019-02-15 15:29:46.960976879 +0100 |
25 |
+@@ -367,11 +367,13 @@ ext_modules = [ |
26 |
+ include_dirs=['src/'], |
27 |
+ sources=["src/CAST.c"]), |
28 |
+ Extension("Crypto.Cipher._raw_des", |
29 |
+- include_dirs=['src/', 'src/libtom/'], |
30 |
+- sources=["src/DES.c"]), |
31 |
++ include_dirs=['src/'], |
32 |
++ sources=["src/DES.c"], |
33 |
++ extra_link_args=["-ltomcrypt"]), |
34 |
+ Extension("Crypto.Cipher._raw_des3", |
35 |
+- include_dirs=['src/', 'src/libtom/'], |
36 |
+- sources=["src/DES3.c"]), |
37 |
++ include_dirs=['src/'], |
38 |
++ sources=["src/DES3.c"], |
39 |
++ extra_link_args=["-ltomcrypt"]), |
40 |
+ Extension("Crypto.Util._cpuid_c", |
41 |
+ include_dirs=['src/'], |
42 |
+ sources=['src/cpuid.c']), |
43 |
+@@ -400,8 +402,9 @@ ext_modules = [ |
44 |
+ include_dirs=['src/'], |
45 |
+ sources=["src/ARC4.c"]), |
46 |
+ Extension("Crypto.Cipher._Salsa20", |
47 |
+- include_dirs=['src/', 'src/libtom/'], |
48 |
+- sources=["src/Salsa20.c"]), |
49 |
++ include_dirs=['src/'], |
50 |
++ sources=["src/Salsa20.c"], |
51 |
++ extra_link_args=["-ltomcrypt"]), |
52 |
+ Extension("Crypto.Cipher._chacha20", |
53 |
+ include_dirs=['src/'], |
54 |
+ sources=["src/chacha20.c"]), |
55 |
+--- a/src/DES.c 2019-01-19 22:52:55.000000000 +0100 |
56 |
++++ b/src/DES.c 2019-02-15 15:30:27.014967034 +0100 |
57 |
+@@ -39,7 +39,7 @@ FAKE_INIT(raw_des3) |
58 |
+ |
59 |
+ /* Include the actial DES implementation */ |
60 |
+ #define LTC_NO_PROTOTYPES |
61 |
+-#include "libtom/tomcrypt_des.c" |
62 |
++#include <tomcrypt.h> |
63 |
+ |
64 |
+ struct block_state { |
65 |
+ symmetric_key sk; |
66 |
|
67 |
diff --git a/dev-python/pycryptodome/pycryptodome-3.9.9-r1.ebuild b/dev-python/pycryptodome/pycryptodome-3.9.9-r1.ebuild |
68 |
new file mode 100644 |
69 |
index 00000000000..8366e337747 |
70 |
--- /dev/null |
71 |
+++ b/dev-python/pycryptodome/pycryptodome-3.9.9-r1.ebuild |
72 |
@@ -0,0 +1,54 @@ |
73 |
+# Copyright 1999-2020 Gentoo Authors |
74 |
+# Distributed under the terms of the GNU General Public License v2 |
75 |
+ |
76 |
+EAPI=7 |
77 |
+ |
78 |
+PYTHON_COMPAT=( python3_{6..9} pypy3 ) |
79 |
+PYTHON_REQ_USE="threads(+)" |
80 |
+ |
81 |
+inherit distutils-r1 |
82 |
+ |
83 |
+DESCRIPTION="A self-contained cryptographic library for Python" |
84 |
+HOMEPAGE="https://www.pycryptodome.org/ |
85 |
+ https://github.com/Legrandin/pycryptodome/ |
86 |
+ https://pypi.org/project/pycryptodome/" |
87 |
+SRC_URI=" |
88 |
+ https://github.com/Legrandin/pycryptodome/archive/v${PV}.tar.gz |
89 |
+ -> ${P}.tar.gz" |
90 |
+ |
91 |
+LICENSE="BSD-2 Unlicense" |
92 |
+SLOT="0" |
93 |
+KEYWORDS="~amd64 ~x86" |
94 |
+IUSE="" |
95 |
+ |
96 |
+DEPEND=" |
97 |
+ dev-libs/gmp:0= |
98 |
+ >=dev-libs/libtomcrypt-1.18.2-r1:=" |
99 |
+BDEPEND=" |
100 |
+ virtual/python-cffi[${PYTHON_USEDEP}]" |
101 |
+RDEPEND=" |
102 |
+ ${DEPEND} |
103 |
+ ${BDEPEND} |
104 |
+ !dev-python/pycrypto" |
105 |
+ |
106 |
+PATCHES=( |
107 |
+ "${FILESDIR}/pycryptodome-3.9.4-parallel-make.patch" |
108 |
+ "${FILESDIR}/pycryptodome-3.9.9-system-libtomcrypt.patch" |
109 |
+) |
110 |
+ |
111 |
+distutils_enable_tests setup.py |
112 |
+ |
113 |
+python_prepare_all() { |
114 |
+ # parallel make fixes |
115 |
+ # Multiple targets were compiling the same file, setuptools doesn't |
116 |
+ # understand this and you get race conditions where a file gets |
117 |
+ # overwritten while it's linking. This makes the files look like separate |
118 |
+ # files so this race won't happen |
119 |
+ ln src/blowfish.c src/blowfish_eks.c || die |
120 |
+ ln src/mont.c src/mont_math.c || die |
121 |
+ |
122 |
+ # make sure we're unbundling it correctly |
123 |
+ rm -r src/libtom || die |
124 |
+ |
125 |
+ distutils-r1_python_prepare_all |
126 |
+} |