From 4bb96446855b8958204225d0de0a18193e3d1f1f Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 6 Jan 2022 16:55:15 +0100 Subject: [PATCH] crda: add a patch for python3 --- srcpkgs/crda/patches/python3.patch | 101 +++++++++++++++++++++++++++++ srcpkgs/crda/template | 4 +- 2 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/crda/patches/python3.patch diff --git a/srcpkgs/crda/patches/python3.patch b/srcpkgs/crda/patches/python3.patch new file mode 100644 index 00000000000..3e1c51ce59c --- /dev/null +++ b/srcpkgs/crda/patches/python3.patch @@ -0,0 +1,101 @@ +https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/crda/trunk/crda-4.14-python-3.patch +--- a/utils/key2pub.py ++++ b/utils/key2pub.py +@@ -1,22 +1,22 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + import sys + try: + from M2Crypto import RSA +-except ImportError, e: ++except ImportError as e: + sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message) + sys.stderr.write('Please install the "M2Crypto" Python module.\n') + sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n') + sys.exit(1) + + def print_ssl_64(output, name, val): +- while val[0] == '\0': ++ while val[0:1] == b'\0': + val = val[1:] + while len(val) % 8: +- val = '\0' + val ++ val = b'\0' + val + vnew = [] + while len(val): +- vnew.append((val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7])) ++ 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])) + val = val[8:] + vnew.reverse() + output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) +@@ -34,13 +34,13 @@ def print_ssl_64(output, name, val): + output.write('};\n\n') + + def print_ssl_32(output, name, val): +- while val[0] == '\0': ++ while val[0:1] == b'\0': + val = val[1:] + while len(val) % 4: +- val = '\0' + val ++ val = b'\0' + val + vnew = [] + while len(val): +- vnew.append((val[0], val[1], val[2], val[3], )) ++ vnew.append((val[0:1], val[1:2], val[2:3], val[3:4])) + val = val[4:] + vnew.reverse() + output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) +@@ -80,21 +80,21 @@ struct pubkey { + + static struct pubkey keys[] = { + ''') +- for n in xrange(n + 1): ++ for n in range(n + 1): + output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) + output.write('};\n') + pass + + def print_gcrypt(output, name, val): + output.write('#include \n') +- while val[0] == '\0': ++ while val[0:1] == b'\0': + val = val[1:] + output.write('static const uint8_t %s[%d] = {\n' % (name, len(val))) + idx = 0 + for v in val: + if not idx: + output.write('\t') +- output.write('0x%.2x, ' % ord(v)) ++ output.write('0x%.2x, ' % (v if sys.version_info[0] >=3 else ord(v))) + idx += 1 + if idx == 8: + idx = 0 +@@ -117,10 +117,10 @@ struct key_params { + + static const struct key_params __attribute__ ((unused)) keys[] = { + ''') +- for n in xrange(n + 1): ++ for n in range(n + 1): + output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) + output.write('};\n') +- ++ + + modes = { + '--ssl': (print_ssl, print_ssl_keys), +@@ -135,7 +135,7 @@ except IndexError: + mode = None + + if not mode in modes: +- print 'Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys())) ++ print('Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))) + sys.exit(2) + + output = open(outfile, 'w') +@@ -153,3 +153,5 @@ for f in files: + idx += 1 + + modes[mode][1](output, idx - 1) ++ ++output.close() diff --git a/srcpkgs/crda/template b/srcpkgs/crda/template index e8082064f76..4c5183f23c6 100644 --- a/srcpkgs/crda/template +++ b/srcpkgs/crda/template @@ -1,11 +1,11 @@ # Template file for 'crda' pkgname=crda version=4.14 -revision=1 +revision=2 _dbname=wireless-regdb _dbversion=2020.11.20 _dbsrc="${XBPS_BUILDDIR}/${_dbname}-${_dbversion}/" -hostmakedepends="openssl python python-M2Crypto pkg-config" +hostmakedepends="openssl python3-M2Crypto pkg-config" makedepends="libnl-devel libgcrypt-devel" depends="iw" short_desc="Central Regulatory Domain Agent for wireless networks"