From 5e36fdf261eb1a2771cfd73b7b961ead653f6dc4 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 22 Mar 2019 22:02:17 +0000 Subject: user/gpgme: fix tests on 32-bit platforms --- user/gpgme/APKBUILD | 9 +++-- user/gpgme/test32bit.patch | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 user/gpgme/test32bit.patch (limited to 'user/gpgme') diff --git a/user/gpgme/APKBUILD b/user/gpgme/APKBUILD index bb97598e4..c541b7af7 100644 --- a/user/gpgme/APKBUILD +++ b/user/gpgme/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox pkgname=gpgme pkgver=1.12.0 -pkgrel=1 +pkgrel=2 pkgdesc="GnuPG Made Easy" url="https://www.gnupg.org/related_software/gpgme/" arch="all" @@ -13,7 +13,9 @@ depends_dev="libgpg-error-dev libassuan-dev qt5-qtbase-dev" makedepends="$depends_dev doxygen python3-dev swig cmd:which" subpackages="$pkgname-dev $pkgname-doc gpgmepp qgpgme py3-gpg:_py" source="https://gnupg.org/ftp/gcrypt/$pkgname/$pkgname-$pkgver.tar.bz2 - 1.12.0-fix-t-tofuinfo.patch" + 1.12.0-fix-t-tofuinfo.patch + test32bit.patch + " build() { cd "$builddir" @@ -60,4 +62,5 @@ _py() { } sha512sums="c228b3df28377df882be536ada56dc9c73150048a58e591aa4495f89c854af95820152cd60139840f994c249e9c7df50d8b89eb9d6dc4ce02aa80bbfebcdd014 gpgme-1.12.0.tar.bz2 -c8748651021a6ea670329cffb9565b905272b092315e77dc6fa9fa23890f8a55c2159edbfa026e8af961f2ff0c0d524dc8332a2e9a24fce2b37ac7cc4bb88cb3 1.12.0-fix-t-tofuinfo.patch" +c8748651021a6ea670329cffb9565b905272b092315e77dc6fa9fa23890f8a55c2159edbfa026e8af961f2ff0c0d524dc8332a2e9a24fce2b37ac7cc4bb88cb3 1.12.0-fix-t-tofuinfo.patch +26bb302f462d7164842acea38080b3937b0b7b11d12fcfe1a61d656a41c993474dc7d9ca2298f936b030874a2f59f85b2189b11087f8b39d4c685a9a4e5d9450 test32bit.patch" diff --git a/user/gpgme/test32bit.patch b/user/gpgme/test32bit.patch new file mode 100644 index 000000000..49dafdddb --- /dev/null +++ b/user/gpgme/test32bit.patch @@ -0,0 +1,93 @@ +From 651a1afe80bcc421da26f38015e8a322e140f130 Mon Sep 17 00:00:00 2001 +From: Ben McGinnes +Date: Sat, 20 Oct 2018 11:07:55 +1100 +Subject: [PATCH] python bindings: callback test + +* lang/python/tests/t-callbacks.py: Updated test logic to try + generating a key which expires in 2099 and if that fails then + fallback to an expiration in 2037 in an attempt to catch the 32-bit + systems. +--- + lang/python/tests/t-callbacks.py | 32 ++++++++++++++++++++++++++++++-- + 1 file changed, 30 insertions(+), 2 deletions(-) + +diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py +index 5bcac237..3a210dd0 100755 +--- a/lang/python/tests/t-callbacks.py ++++ b/lang/python/tests/t-callbacks.py +@@ -20,12 +20,14 @@ + from __future__ import absolute_import, print_function, unicode_literals + + import os ++import platform + import gpg + import support + _ = support # to appease pyflakes. + + del absolute_import, print_function, unicode_literals + ++oops = None + c = gpg.Context() + c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) + +@@ -99,6 +101,17 @@ Expire-Date: 2099-12-31 + + """ + ++prams = """ ++Key-Type: RSA ++Key-Length: 1024 ++Name-Real: Joe Tester ++Name-Comment: with stupid passphrase ++Name-Email: joe+gpg@example.org ++Passphrase: Crypt0R0cks ++Expire-Date: 2037-12-31 ++ ++""" ++ + messages = [] + + +@@ -111,7 +124,10 @@ def progress_cb(what, typ, current, total, hook=None): + + c = gpg.Context() + c.set_progress_cb(progress_cb, messages) +-c.op_genkey(parms, None, None) ++try: ++ c.op_genkey(parms, None, None) ++except Exception as oops: ++ c.op_genkey(prams, None, None) + assert len(messages) > 0 + + +@@ -123,7 +139,10 @@ def progress_cb(what, typ, current, total, hook=None): + c = gpg.Context() + c.set_progress_cb(progress_cb, None) + try: +- c.op_genkey(parms, None, None) ++ try: ++ c.op_genkey(parms, None, None) ++ except Exception as oops: ++ c.op_genkey(prams, None, None) + except Exception as e: + assert e == myException + else: +@@ -139,6 +158,15 @@ alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False) + cookie = object() + edit_cb_called = False + ++def oops_check(): ++ if oops is not None and platform.architecture()[0] != "64bit": ++ y2k38_msg = "System appears to be 32-bit and vulnerable to EOL in 2038." ++ elif oops is not None and platform.architecture()[0] == "64bit": ++ y2k38_msg = "System appears to be 64-bit, but may use 32-bit time." ++ else: ++ y2k38_msg = "System is 64-bit and/or not susceptible to 2038 EOL." ++ return y2k38_msg ++ + + def edit_cb(status, args, hook): + global edit_cb_called +-- +2.11.0 + -- cgit v1.2.3-70-g09d2