[arch-commits] Commit in crda/trunk (PKGBUILD crda-4.14-python-3.patch)

Tobias Powalowski tpowa at archlinux.org
Mon Mar 29 08:33:03 UTC 2021


    Date: Monday, March 29, 2021 @ 08:33:03
  Author: tpowa
Revision: 411200

upgpkg: crda 4.14-4: fix python3 building

Added:
  crda/trunk/crda-4.14-python-3.patch
Modified:
  crda/trunk/PKGBUILD

--------------------------+
 PKGBUILD                 |   12 +++--
 crda-4.14-python-3.patch |   95 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-03-29 08:20:26 UTC (rev 411199)
+++ PKGBUILD	2021-03-29 08:33:03 UTC (rev 411200)
@@ -2,28 +2,30 @@
 
 pkgname=crda
 pkgver=4.14
-pkgrel=3
+pkgrel=4
 pkgdesc="Central Regulatory Domain Agent for wireless networks"
 arch=(x86_64)
 url="https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA"
 license=('custom')
 depends=('wireless-regdb' 'libnl' 'libgcrypt' 'systemd' 'iw')
-makedepends=('python2-m2crypto')
+makedepends=('python-m2crypto')
 install=crda.install
 source=("https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/snapshot/crda-$pkgver.tar.gz"
         set-wireless-regdom
         0001-Makefile-Link-libreg.so-against-the-crypto-library.patch
-        0001-Makefile-Don-t-run-ldconfig.patch)
+        0001-Makefile-Don-t-run-ldconfig.patch
+        crda-4.14-python-3.patch)
 sha256sums=('5a8f35bb8b27474f466b0e75d451ba917433d8aab1889678a64d9c4e72a8b8c2'
             '603ce97da5cce3f5337e99007ce04e2f295bb33a36b308794884011f7bcabaf3'
             '96b2068b27202f8bc78009869520e396cb3f3ac7a826efef06d0fc41047f2520'
-            'ff52990cf9295e5cebcf07ebbf2a96e225d97088573edcc898b29ce33a0fb663')
+            'ff52990cf9295e5cebcf07ebbf2a96e225d97088573edcc898b29ce33a0fb663'
+            '95057c7a1c8f2be8b70785356162b86831ba9f198fc43c411267ca97ddb68ed9')
 validpgpkeys=('E4053F8D0E7C4B9A0A20AB27DC553250F8FE7407') #Luis R. Rodriguez
 prepare() {
   cd "${srcdir}"/${pkgname}-${pkgver}
-  sed 's|^#!/usr/bin/env python|#!/usr/bin/python2|' -i utils/key2pub.py
   patch -p1 -i "${srcdir}"/0001-Makefile-Link-libreg.so-against-the-crypto-library.patch
   patch -p1 -i "${srcdir}"/0001-Makefile-Don-t-run-ldconfig.patch
+  patch -p1 -i "${srcdir}"/crda-4.14-python-3.patch
 }
 
 build() {

Added: crda-4.14-python-3.patch
===================================================================
--- crda-4.14-python-3.patch	                        (rev 0)
+++ crda-4.14-python-3.patch	2021-03-29 08:33:03 UTC (rev 411200)
@@ -0,0 +1,95 @@
+diff --git a/utils/key2pub.py b/utils/key2pub.py
+index 9bb04cd..632e6a6 100755
+--- a/utils/key2pub.py
++++ b/utils/key2pub.py
+@@ -3,20 +3,20 @@
+ 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 <stdint.h>\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,7 +117,7 @@ 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')
+     
+@@ -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()



More information about the arch-commits mailing list