aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/epg-config.el27
1 files changed, 21 insertions, 6 deletions
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index 85434985d39..39d264c05ad 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -98,11 +98,14 @@ Note that the buffer name starts with a space."
98 :type 'boolean) 98 :type 'boolean)
99 99
100(defconst epg-gpg-minimum-version "1.4.3") 100(defconst epg-gpg-minimum-version "1.4.3")
101(defconst epg-gpg2-minimum-version "2.1.6")
101 102
102(defconst epg-config--program-alist 103(defconst epg-config--program-alist
103 `((OpenPGP 104 `((OpenPGP
104 epg-gpg-program 105 epg-gpg-program
105 ("gpg2" . "2.1.6") ("gpg" . ,epg-gpg-minimum-version)) 106 ("gpg2" . ,epg-gpg2-minimum-version)
107 ("gpg" . ((,epg-gpg-minimum-version . "2.0")
108 ,epg-gpg2-minimum-version)))
106 (CMS 109 (CMS
107 epg-gpgsm-program 110 epg-gpgsm-program
108 ("gpgsm" . "2.0.4"))) 111 ("gpgsm" . "2.0.4")))
@@ -231,14 +234,26 @@ version requirement is met."
231 (epg-config--make-gpg-configuration epg-gpg-program)) 234 (epg-config--make-gpg-configuration epg-gpg-program))
232 235
233;;;###autoload 236;;;###autoload
234(defun epg-check-configuration (config &optional minimum-version) 237(defun epg-check-configuration (config &optional req-versions)
235 "Verify that a sufficient version of GnuPG is installed." 238 "Verify that a sufficient version of GnuPG is installed.
239CONFIG should be a `epg-configuration' object (a plist).
240REQ-VERSIONS should be a list with elements of the form (MIN
241. MAX) where MIN and MAX are version strings indicating a
242semi-open range of acceptable versions. REQ-VERSIONS may also be
243a single minimum version string."
236 (let ((version (alist-get 'version config))) 244 (let ((version (alist-get 'version config)))
237 (unless (stringp version) 245 (unless (stringp version)
238 (error "Undetermined version: %S" version)) 246 (error "Undetermined version: %S" version))
239 (unless (version<= (or minimum-version 247 (catch 'version-ok
240 epg-gpg-minimum-version) 248 (pcase-dolist ((or `(,min . ,max)
241 version) 249 (and min (let max nil)))
250 (if (listp req-versions) req-versions
251 (list req-versions)))
252 (when (and (version<= (or min epg-gpg-minimum-version)
253 version)
254 (or (null max)
255 (version< version max)))
256 (throw 'version-ok t)))
242 (error "Unsupported version: %s" version)))) 257 (error "Unsupported version: %s" version))))
243 258
244;;;###autoload 259;;;###autoload