From d926803a7b730ee199a59f99b908c9daffb5c587 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 13 Feb 2018 23:08:48 +0000
Subject: gnupg: update to 2.2.4

---
 abs/core/gnupg/PKGBUILD               | 49 ++++++++++++++++++++---------------
 abs/core/gnupg/install                | 43 ++++++++++++++++++++++--------
 abs/core/gnupg/protect-tool-env.patch | 28 --------------------
 3 files changed, 60 insertions(+), 60 deletions(-)
 delete mode 100644 abs/core/gnupg/protect-tool-env.patch

diff --git a/abs/core/gnupg/PKGBUILD b/abs/core/gnupg/PKGBUILD
index 6d7dc98..42cc6a5 100644
--- a/abs/core/gnupg/PKGBUILD
+++ b/abs/core/gnupg/PKGBUILD
@@ -1,35 +1,40 @@
-# $Id: PKGBUILD 195927 2013-10-05 17:40:59Z bisson $
+# $Id$
 # Maintainer: Gaetan Bisson <bisson@archlinux.org>
 # Contributor: Tobias Powalowski <tpowa@archlinux.org>
 # Contributor: Andreas Radke <andyrtr@archlinux.org>
 # Contributor: Judd Vinet <jvinet@zeroflux.org>
 
 pkgname=gnupg
-pkgver=2.0.22
+pkgver=2.2.4
 pkgrel=2
 pkgdesc='Complete and free implementation of the OpenPGP standard'
 url='http://www.gnupg.org/'
 license=('GPL')
-arch=('i686' 'x86_64')
-optdepends=('curl: gpg2keys_curl'
-            'libldap: gpg2keys_ldap'
-            'libusb-compat: scdaemon')
-makedepends=('curl' 'libldap' 'libusb-compat')
-depends=('bzip2' 'libksba' 'libgcrypt' 'pth' 'libassuan' 'readline' 'pinentry' 'dirmngr')
-source=("ftp://ftp.gnupg.org/gcrypt/${pkgname}/${pkgname}-${pkgver}.tar.bz2"{,.sig}
-        'protect-tool-env.patch')
-sha1sums=('9ba9ee288e9bf813e0f1e25cbe06b58d3072d8b8' 'SKIP'
-          '2ec97ba55ae47ff0d63bc813b8c64cb79cef11db')
+arch=('x86_64')
+optdepends=('libldap: gpg2keys_ldap'
+            'libusb-compat: scdaemon'
+            'pcsclite: scdaemon')
+makedepends=('libldap' 'libusb-compat' 'pcsclite')
+checkdepends=('openssh')
+depends=('npth' 'libgpg-error' 'libgcrypt' 'libksba' 'libassuan'
+         'pinentry' 'bzip2' 'readline' 'gnutls' 'sqlite')
+validpgpkeys=('D8692123C4065DEA5E0F3AB5249B39D24F25E3B6'
+              '46CC730865BB5C78EBABADCF04376F3EE0856959'
+              '031EC2536E580D8EA286A9F22071B08A33BD3F06'
+              'D238EA65D64C67ED4C3073F28A861B1C7EFD60D9')
+source=("https://gnupg.org/ftp/gcrypt/${pkgname}/${pkgname}-${pkgver}.tar.bz2"{,.sig})
+sha256sums=('401a3e64780fdfa6d7670de0880aa5c9d589b3db7a7098979d7606cec546f2ec'
+            'SKIP')
 
 install=install
 
-conflicts=('gnupg2')
-provides=("gnupg2=${pkgver}")
-replaces=('gnupg2')
+conflicts=('dirmngr' 'gnupg2')
+provides=('dirmngr' "gnupg2=${pkgver}")
+replaces=('dirmngr' 'gnupg2')
 
 prepare() {
 	cd "${srcdir}/${pkgname}-${pkgver}"
-	patch -p1 -i ../protect-tool-env.patch # FS#31900
+	sed '/noinst_SCRIPTS = gpg-zip/c sbin_SCRIPTS += gpg-zip' -i tools/Makefile.in
 }
 
 build() {
@@ -41,7 +46,6 @@ build() {
 		--libexecdir=/usr/lib/gnupg \
 		--enable-maintainer-mode \
 		--enable-symcryptrun \
-		--enable-gpgtar \
 
 	make
 }
@@ -54,8 +58,11 @@ check() {
 package() {
 	cd "${srcdir}/${pkgname}-${pkgver}"
 	make DESTDIR="${pkgdir}" install
-	ln -s gpg2 "${pkgdir}"/usr/bin/gpg
-	ln -s gpgv2 "${pkgdir}"/usr/bin/gpgv
-	ln -s gpg2.1.gz "${pkgdir}"/usr/share/man/man1/gpg.1.gz
-	rm "${pkgdir}/usr/share/gnupg/com-certs.pem" # FS#33059
+	ln -s gpg "${pkgdir}"/usr/bin/gpg2
+	ln -s gpgv "${pkgdir}"/usr/bin/gpgv2
+
+	cd doc/examples/systemd-user
+	for i in *.*; do
+		install -Dm644 "$i" "${pkgdir}/usr/lib/systemd/user/$i"
+	done
 }
diff --git a/abs/core/gnupg/install b/abs/core/gnupg/install
index 3a5dc9f..95cb351 100644
--- a/abs/core/gnupg/install
+++ b/abs/core/gnupg/install
@@ -1,20 +1,41 @@
-info_dir=/usr/share/info
-info_files=(gnupg.info gnupg.info-1 gnupg.info-2)
+_global_units() {
+	_units=(dirmngr.socket gpg-agent.socket gpg-agent-{browser,extra,ssh}.socket)
+	_dir=/etc/systemd/user/sockets.target.wants
+
+	case $1 in
+		enable)
+			mkdir -p $_dir
+			for _u in "${_units[@]}"; do
+				ln -sf /usr/lib/systemd/user/$_u $_dir/$_u
+			done
+			;;
+		disable)
+			for _u in "${_units[@]}"; do
+				rm -f $_dir/$_u
+			done
+			rmdir -p --ignore-fail-on-non-empty $_dir
+			;;
+	esac
+}
 
 post_install() {
-  [ -x usr/bin/install-info ] || return 0
-  for f in ${info_files[@]}; do
-    usr/bin/install-info ${info_dir}/$f ${info_dir}/dir 2> /dev/null
-  done
+	# See FS#42798 and FS#47371
+	dirmngr </dev/null &>/dev/null
+
+	# Let systemd supervise daemons by default
+	_global_units enable
 }
 
 post_upgrade() {
-  post_install $1
+	if (( $(vercmp $2 2.1.13-1) < 0 )); then
+		echo "==> Please kill running gpg-agent and dirmngr processes before using this release."
+	fi
+
+	if (( $(vercmp $2 2.1.21-3) < 0 )); then
+		_global_units enable
+	fi
 }
 
 pre_remove() {
-  [ -x usr/bin/install-info ] || return 0
-  for f in ${info_files[@]}; do
-    usr/bin/install-info --delete ${info_dir}/$f ${info_dir}/dir 2> /dev/null
-  done
+	_global_units disable
 }
diff --git a/abs/core/gnupg/protect-tool-env.patch b/abs/core/gnupg/protect-tool-env.patch
deleted file mode 100644
index 132791f..0000000
--- a/abs/core/gnupg/protect-tool-env.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -Naur old/agent/protect-tool.c new/agent/protect-tool.c
---- old/agent/protect-tool.c	2012-12-08 13:53:17.067611957 +1100
-+++ new/agent/protect-tool.c	2012-12-08 13:53:28.247633012 +1100
-@@ -102,6 +102,7 @@
- static int opt_status_msg;
- static const char *opt_p12_charset;
- static const char *opt_agent_program; 
-+static session_env_t opt_session_env;
- 
- static char *get_passphrase (int promptno);
- static void release_passphrase (char *pw);
-@@ -1040,6 +1041,7 @@
- 
-   opt_homedir = default_homedir ();
- 
-+  opt_session_env = session_env_new ();
- 
-   pargs.argc = &argc;
-   pargs.argv = &argv;
-@@ -1091,7 +1093,7 @@
-                                 opt.verbose,
-                                 opt_homedir,
-                                 opt_agent_program,
--                                NULL, NULL, NULL);
-+                                NULL, NULL, opt_session_env);
- 
-   if (opt_prompt)
-     opt_prompt = percent_plus_unescape (opt_prompt, 0);
-- 
cgit v0.12

