diff options
| author | Khem Raj <raj.khem@gmail.com> | 2020-01-21 18:09:19 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2020-01-22 09:56:34 -0800 |
| commit | 9322d09dc4030b32d930a03359254386a2b2b0d1 (patch) | |
| tree | 6f282ff57edbafdb4b20475aa2498ddf6886d3bf | |
| parent | 9e314f7bcb8efb2cbd0c1c1af753ff9510431738 (diff) | |
| download | meta-openembedded-9322d09dc4030b32d930a03359254386a2b2b0d1.tar.gz | |
crda: Fix build with python3
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-networking/recipes-connectivity/crda/crda/crda-4.14-python-3.patch | 101 | ||||
| -rw-r--r-- | meta-networking/recipes-connectivity/crda/crda_3.18.bb | 3 |
2 files changed, 103 insertions, 1 deletions
diff --git a/meta-networking/recipes-connectivity/crda/crda/crda-4.14-python-3.patch b/meta-networking/recipes-connectivity/crda/crda/crda-4.14-python-3.patch new file mode 100644 index 0000000000..9125d0ab97 --- /dev/null +++ b/meta-networking/recipes-connectivity/crda/crda/crda-4.14-python-3.patch | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | Imported from Gentoo | ||
| 2 | https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c50acec16bc7c33d6dc122c007d713e7fbecf9c | ||
| 3 | |||
| 4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 5 | |||
| 6 | --- a/utils/key2pub.py | ||
| 7 | +++ b/utils/key2pub.py | ||
| 8 | @@ -1,22 +1,22 @@ | ||
| 9 | -#!/usr/bin/env python | ||
| 10 | +#!/usr/bin/env python3 | ||
| 11 | |||
| 12 | import sys | ||
| 13 | try: | ||
| 14 | from M2Crypto import RSA | ||
| 15 | -except ImportError, e: | ||
| 16 | +except ImportError as e: | ||
| 17 | sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message) | ||
| 18 | sys.stderr.write('Please install the "M2Crypto" Python module.\n') | ||
| 19 | sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n') | ||
| 20 | sys.exit(1) | ||
| 21 | |||
| 22 | def print_ssl_64(output, name, val): | ||
| 23 | - while val[0] == '\0': | ||
| 24 | + while val[0:1] == b'\0': | ||
| 25 | val = val[1:] | ||
| 26 | while len(val) % 8: | ||
| 27 | - val = '\0' + val | ||
| 28 | + val = b'\0' + val | ||
| 29 | vnew = [] | ||
| 30 | while len(val): | ||
| 31 | - vnew.append((val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7])) | ||
| 32 | + vnew.append((val[0:1], val[1:2], val[2:3], val[3:4], val[4:5], val[5:6], val[6:7], val[7:8])) | ||
| 33 | val = val[8:] | ||
| 34 | vnew.reverse() | ||
| 35 | output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) | ||
| 36 | @@ -34,13 +34,13 @@ def print_ssl_64(output, name, val): | ||
| 37 | output.write('};\n\n') | ||
| 38 | |||
| 39 | def print_ssl_32(output, name, val): | ||
| 40 | - while val[0] == '\0': | ||
| 41 | + while val[0:1] == b'\0': | ||
| 42 | val = val[1:] | ||
| 43 | while len(val) % 4: | ||
| 44 | - val = '\0' + val | ||
| 45 | + val = b'\0' + val | ||
| 46 | vnew = [] | ||
| 47 | while len(val): | ||
| 48 | - vnew.append((val[0], val[1], val[2], val[3], )) | ||
| 49 | + vnew.append((val[0:1], val[1:2], val[2:3], val[3:4])) | ||
| 50 | val = val[4:] | ||
| 51 | vnew.reverse() | ||
| 52 | output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) | ||
| 53 | @@ -81,21 +81,21 @@ struct pubkey { | ||
| 54 | |||
| 55 | static struct pubkey keys[] __attribute__((unused))= { | ||
| 56 | ''') | ||
| 57 | - for n in xrange(n + 1): | ||
| 58 | + for n in range(n + 1): | ||
| 59 | output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) | ||
| 60 | output.write('};\n') | ||
| 61 | pass | ||
| 62 | |||
| 63 | def print_gcrypt(output, name, val): | ||
| 64 | output.write('#include <stdint.h>\n') | ||
| 65 | - while val[0] == '\0': | ||
| 66 | + while val[0:1] == b'\0': | ||
| 67 | val = val[1:] | ||
| 68 | output.write('static const uint8_t %s[%d] = {\n' % (name, len(val))) | ||
| 69 | idx = 0 | ||
| 70 | for v in val: | ||
| 71 | if not idx: | ||
| 72 | output.write('\t') | ||
| 73 | - output.write('0x%.2x, ' % ord(v)) | ||
| 74 | + output.write('0x%.2x, ' % (v if sys.version_info[0] >=3 else ord(v))) | ||
| 75 | idx += 1 | ||
| 76 | if idx == 8: | ||
| 77 | idx = 0 | ||
| 78 | @@ -118,7 +118,7 @@ struct key_params { | ||
| 79 | |||
| 80 | static const struct key_params keys[] __attribute__((unused))= { | ||
| 81 | ''') | ||
| 82 | - for n in xrange(n + 1): | ||
| 83 | + for n in range(n + 1): | ||
| 84 | output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) | ||
| 85 | output.write('};\n') | ||
| 86 | |||
| 87 | @@ -136,7 +136,7 @@ except IndexError: | ||
| 88 | mode = None | ||
| 89 | |||
| 90 | if not mode in modes: | ||
| 91 | - print 'Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys())) | ||
| 92 | + print('Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))) | ||
| 93 | sys.exit(2) | ||
| 94 | |||
| 95 | output = open(outfile, 'w') | ||
| 96 | @@ -154,3 +154,5 @@ for f in files: | ||
| 97 | idx += 1 | ||
| 98 | |||
| 99 | modes[mode][1](output, idx - 1) | ||
| 100 | + | ||
| 101 | +output.close() | ||
diff --git a/meta-networking/recipes-connectivity/crda/crda_3.18.bb b/meta-networking/recipes-connectivity/crda/crda_3.18.bb index d3c00424db..b380eaf94e 100644 --- a/meta-networking/recipes-connectivity/crda/crda_3.18.bb +++ b/meta-networking/recipes-connectivity/crda/crda_3.18.bb | |||
| @@ -4,7 +4,7 @@ SECTION = "net" | |||
| 4 | LICENSE = "copyleft-next-0.3.0" | 4 | LICENSE = "copyleft-next-0.3.0" |
| 5 | LIC_FILES_CHKSUM = "file://copyleft-next-0.3.0;md5=8743a2c359037d4d329a31e79eabeffe" | 5 | LIC_FILES_CHKSUM = "file://copyleft-next-0.3.0;md5=8743a2c359037d4d329a31e79eabeffe" |
| 6 | 6 | ||
| 7 | DEPENDS = "python-m2crypto-native python-typing-native python-native libnl libgcrypt" | 7 | DEPENDS = "python3-m2crypto-native libnl libgcrypt" |
| 8 | 8 | ||
| 9 | SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz \ | 9 | SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz \ |
| 10 | file://do-not-run-ldconfig-if-destdir-is-set.patch \ | 10 | file://do-not-run-ldconfig-if-destdir-is-set.patch \ |
| @@ -14,6 +14,7 @@ SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz \ | |||
| 14 | file://make.patch \ | 14 | file://make.patch \ |
| 15 | file://use-target-word-size-instead-of-host-s.patch \ | 15 | file://use-target-word-size-instead-of-host-s.patch \ |
| 16 | file://fix-issues-when-USE_OPENSSL-1.patch \ | 16 | file://fix-issues-when-USE_OPENSSL-1.patch \ |
| 17 | file://crda-4.14-python-3.patch \ | ||
| 17 | " | 18 | " |
| 18 | SRC_URI[md5sum] = "0431fef3067bf503dfb464069f06163a" | 19 | SRC_URI[md5sum] = "0431fef3067bf503dfb464069f06163a" |
| 19 | SRC_URI[sha256sum] = "43fcb9679f8b75ed87ad10944a506292def13e4afb194afa7aa921b01e8ecdbf" | 20 | SRC_URI[sha256sum] = "43fcb9679f8b75ed87ad10944a506292def13e4afb194afa7aa921b01e8ecdbf" |
