From 631fb329dd0c33ff2f807cbc4a66e2839e50d335 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 20 May 2024 14:26:04 +0200 Subject: [PATCH] gpgme: cache the engine version See https://github.com/msys2/msys2-pacman/issues/26 See https://dev.gnupg.org/T6369 This saves a gpg spawn for every gpgme_get_key() call, for example around 100ms when starting pacman. --- gpgme/0002-gpgme-engine-cache-version.patch | 17 +++++++++++++++++ gpgme/PKGBUILD | 12 +++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 gpgme/0002-gpgme-engine-cache-version.patch diff --git a/gpgme/0002-gpgme-engine-cache-version.patch b/gpgme/0002-gpgme-engine-cache-version.patch new file mode 100644 index 000000000000..bd84644aa66f --- /dev/null +++ b/gpgme/0002-gpgme-engine-cache-version.patch @@ -0,0 +1,17 @@ +diff --git a/src/engine.c b/src/engine.c +index 69f1c150..a02d0405 100644 +--- a/src/engine.c ++++ b/src/engine.c +@@ -449,7 +449,11 @@ _gpgme_set_engine_info (gpgme_engine_info_t info, gpgme_protocol_t proto, + new_home_dir = NULL; + } + +- new_version = engine_get_version (proto, new_file_name); ++ if (info->version && strcmp (info->file_name, new_file_name) == 0) ++ new_version = strdup (info->version); ++ else ++ new_version = engine_get_version (proto, new_file_name); ++ + if (!new_version) + { + new_version = strdup ("1.0.0"); /* Fake one for dummy entries. */ diff --git a/gpgme/PKGBUILD b/gpgme/PKGBUILD index fa7761ba3531..a52467d5f64e 100644 --- a/gpgme/PKGBUILD +++ b/gpgme/PKGBUILD @@ -3,7 +3,7 @@ pkgbase=gpgme pkgname=('libgpgme' 'libgpgme-devel' 'libgpgme-python') pkgver=1.23.2 -pkgrel=1 +pkgrel=2 pkgdesc="A C wrapper library for GnuPG" arch=('i686' 'x86_64') url="https://gnupg.org/related_software/gpgme/" @@ -26,10 +26,12 @@ makedepends=( 'python-wheel' ) source=(https://gnupg.org/ftp/gcrypt/${pkgbase}/${pkgbase}-${pkgver}.tar.bz2{,.sig} - 0001-fix-broken-version.patch) + 0001-fix-broken-version.patch + 0002-gpgme-engine-cache-version.patch) sha256sums=('9499e8b1f33cccb6815527a1bc16049d35a6198a6c5fae0185f2bd561bce5224' 'SKIP' - '80771f9811ad809c8ff8977b05cfcc0d2d4a1c764c3df6ae5aa91c5aa7565a9a') + '80771f9811ad809c8ff8977b05cfcc0d2d4a1c764c3df6ae5aa91c5aa7565a9a' + '6af420e4db50956fdc3abb2b75e9fa355a883bed9ede989437d55524868c1069') #These might be signed by any of these keys https://gnupg.org/signature_key.html validpgpkeys=('5B80C5754298F0CB55D8ED6ABCEF7E294B092E28' '6DAA6E64A76D2840571B4902528897B826403ADA' @@ -41,6 +43,10 @@ prepare() { # otherwise it appends "unknown" to the version which isn't a valid python version patch -p1 -i "${srcdir}/0001-fix-broken-version.patch" + # https://github.com/msys2/msys2-pacman/issues/26 + # https://dev.gnupg.org/T6369#186304 + patch -p1 -i "${srcdir}/0002-gpgme-engine-cache-version.patch" + autoreconf -ivf }