From 4bb96446855b8958204225d0de0a18193e3d1f1f Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 6 Jan 2022 16:55:15 +0100 Subject: [PATCH 1/3] 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 00000000000000..3e1c51ce59c5c2 --- /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 e8082064f764a5..4c5183f23c6446 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" From 0e72ce7ddc613aead7e6c157f6832d8e5dd0ddca Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 6 Jan 2022 16:54:55 +0100 Subject: [PATCH 2/3] python3-M2Crypto: update to 0.38.0. * remove python2 version * enable tests --- .../python-M2Crypto/patches/libressl.patch | 140 ------------------ srcpkgs/python-M2Crypto/template | 29 ---- srcpkgs/python3-M2Crypto | 1 - srcpkgs/python3-M2Crypto/template | 20 +++ .../update | 0 5 files changed, 20 insertions(+), 170 deletions(-) delete mode 100644 srcpkgs/python-M2Crypto/patches/libressl.patch delete mode 100644 srcpkgs/python-M2Crypto/template delete mode 120000 srcpkgs/python3-M2Crypto create mode 100644 srcpkgs/python3-M2Crypto/template rename srcpkgs/{python-M2Crypto => python3-M2Crypto}/update (100%) diff --git a/srcpkgs/python-M2Crypto/patches/libressl.patch b/srcpkgs/python-M2Crypto/patches/libressl.patch deleted file mode 100644 index ee2a24ad9f4a32..00000000000000 --- a/srcpkgs/python-M2Crypto/patches/libressl.patch +++ /dev/null @@ -1,140 +0,0 @@ ---- a/SWIG/_bio.i -+++ b/SWIG/_bio.i -@@ -293,8 +293,12 @@ int bio_should_write(BIO* a) { - } - - /* Macros for things not defined before 1.1.0 */ --#if OPENSSL_VERSION_NUMBER < 0x10100000L --static BIO_METHOD * -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+ -+#if !defined(LIBRESSL_VERSION_NUMBER) -+static -+#endif -+BIO_METHOD * - BIO_meth_new( int type, const char *name ) - { - BIO_METHOD *method = malloc( sizeof(BIO_METHOD) ); -@@ -306,7 +310,10 @@ BIO_meth_new( int type, const char *name ) - return method; - } - --static void -+#if !defined(LIBRESSL_VERSION_NUMBER) -+static -+#endif -+void - BIO_meth_free( BIO_METHOD *meth ) - { - if ( meth == NULL ) { ---- a/SWIG/_evp.i -+++ b/SWIG/_evp.i -@@ -19,7 +19,7 @@ Copyright (c) 2009-2010 Heikki Toivonen. All rights re - #include - #include - --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - - HMAC_CTX *HMAC_CTX_new(void) { - HMAC_CTX *ret = PyMem_Malloc(sizeof(HMAC_CTX)); ---- a/SWIG/_lib11_compat.i -+++ b/SWIG/_lib11_compat.i -@@ -8,7 +8,7 @@ - */ - - %{ --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - - #include - #include ---- a/SWIG/_lib.i -+++ b/SWIG/_lib.i -@@ -21,7 +21,7 @@ - - %{ - /* OpenSSL 1.0.2 copmatbility shim */ --#if OPENSSL_VERSION_NUMBER < 0x10002000L -+#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER) - typedef void (*OPENSSL_sk_freefunc)(void *); - typedef void *(*OPENSSL_sk_copyfunc)(const void *); - typedef struct stack_st OPENSSL_STACK; -@@ -499,7 +499,7 @@ int passphrase_callback(char *buf, int num, int v, voi - %inline %{ - - void lib_init() { --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - SSLeay_add_all_algorithms(); - ERR_load_ERR_strings(); - #endif ---- a/SWIG/_ssl.i -+++ b/SWIG/_ssl.i -@@ -275,7 +275,7 @@ const SSL_METHOD *sslv3_method(void) { - #endif - - const SSL_METHOD *tlsv1_method(void) { --#if OPENSSL_VERSION_NUMBER >= 0x10100000L -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - PyErr_WarnEx(PyExc_DeprecationWarning, - "Function TLSv1_method has been deprecated.", 1); - #endif ---- a/SWIG/_threads.i -+++ b/SWIG/_threads.i -@@ -5,7 +5,7 @@ - #include - #include - --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - #define CRYPTO_num_locks() (CRYPTO_NUM_LOCKS) - static PyThread_type_lock lock_cs[CRYPTO_num_locks()]; - static long lock_count[CRYPTO_num_locks()]; -@@ -13,7 +13,7 @@ static int thread_mode = 0; - #endif - - void threading_locking_callback(int mode, int type, const char *file, int line) { --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - if (mode & CRYPTO_LOCK) { - PyThread_acquire_lock(lock_cs[type], WAIT_LOCK); - lock_count[type]++; -@@ -25,7 +25,7 @@ void threading_locking_callback(int mode, int type, co - } - - unsigned long threading_id_callback(void) { --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - return (unsigned long)PyThread_get_thread_ident(); - #else - return (unsigned long)0; -@@ -35,7 +35,7 @@ unsigned long threading_id_callback(void) { - - %inline %{ - void threading_init(void) { --#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L -+#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - int i; - if (!thread_mode) { - for (i=0; i - #include diff --git a/srcpkgs/python-M2Crypto/template b/srcpkgs/python-M2Crypto/template deleted file mode 100644 index 55f5130596a42e..00000000000000 --- a/srcpkgs/python-M2Crypto/template +++ /dev/null @@ -1,29 +0,0 @@ -# Template file for 'python-M2Crypto' -pkgname=python-M2Crypto -version=0.35.2 -revision=7 -wrksrc="M2Crypto-${version}" -build_style=python-module -pycompile_module="M2Crypto" -hostmakedepends="python-setuptools python3-setuptools swig openssl-devel" -makedepends="openssl-devel python-devel python3-devel" -depends="python-typing" -short_desc="Python2 crypto and SSL toolkit" -maintainer="Orphaned " -license="MIT" -homepage="https://gitlab.com/m2crypto/m2crypto/" -distfiles="${PYPI_SITE}/M/M2Crypto/M2Crypto-${version}.tar.gz" -checksum=4c6ad45ffb88670c590233683074f2440d96aaccb05b831371869fc387cbd127 - -post_install() { - vlicense LICENCE -} - -python3-M2Crypto_package() { - pycompile_module="M2Crypto" - short_desc="${short_desc/Python2/Python3}" - pkg_install() { - vmove usr/lib/python3* - vlicense LICENCE - } -} diff --git a/srcpkgs/python3-M2Crypto b/srcpkgs/python3-M2Crypto deleted file mode 120000 index b9eea2597a6898..00000000000000 --- a/srcpkgs/python3-M2Crypto +++ /dev/null @@ -1 +0,0 @@ -python-M2Crypto \ No newline at end of file diff --git a/srcpkgs/python3-M2Crypto/template b/srcpkgs/python3-M2Crypto/template new file mode 100644 index 00000000000000..999ec2d7cf7728 --- /dev/null +++ b/srcpkgs/python3-M2Crypto/template @@ -0,0 +1,20 @@ +# Template file for 'python3-M2Crypto' +pkgname=python3-M2Crypto +version=0.38.0 +revision=1 +wrksrc="M2Crypto-${version}" +build_style=python3-module +hostmakedepends="python3-setuptools swig openssl-devel" +makedepends="openssl-devel python3-devel" +depends="python3" +checkdepends="ca-certificates python3-pytest python3-parameterized" +short_desc="Python crypto and SSL toolkit" +maintainer="Orphaned " +license="MIT" +homepage="https://gitlab.com/m2crypto/m2crypto/" +distfiles="${PYPI_SITE}/M/M2Crypto/M2Crypto-${version}.tar.gz" +checksum=99f2260a30901c949a8dc6d5f82cd5312ffb8abc92e76633baf231bbbcb2decb + +post_install() { + vlicense LICENCE +} diff --git a/srcpkgs/python-M2Crypto/update b/srcpkgs/python3-M2Crypto/update similarity index 100% rename from srcpkgs/python-M2Crypto/update rename to srcpkgs/python3-M2Crypto/update From e785894802a925b7cdeba0e7dbaf4e5c8d43d2f0 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Thu, 6 Jan 2022 18:52:12 +0100 Subject: [PATCH 3/3] removed-packages: add python-M2Crypto --- srcpkgs/removed-packages/template | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/srcpkgs/removed-packages/template b/srcpkgs/removed-packages/template index fcedf355babb12..0b057f0241bd61 100644 --- a/srcpkgs/removed-packages/template +++ b/srcpkgs/removed-packages/template @@ -1,7 +1,7 @@ # Template file for 'removed-packages' pkgname=removed-packages version=0.1 -revision=56 +revision=57 build_style=meta short_desc="Uninstalls packages removed from repository" maintainer="Piotr Wójcik " @@ -252,6 +252,7 @@ replaces=" psiconv<=0.9.9_9 ptii<=0.4_2 pyside-tools<=0.2.15_2 + python-M2Crypto<=0.35.2_7 python-PyQt4<=4.12.1_4 python-SecretStorage<=2.3.1_4 python-audit<=2.8.5_2