diff options
| author | Noam Postavsky | 2017-07-22 23:54:34 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-08-17 20:51:39 -0400 |
| commit | cb7aa6c4a33debd4e0b72e00f846df92f395a181 (patch) | |
| tree | 54a0eb256a5d106f21caf4dfb55982814652e02e | |
| parent | 87645443b5c6dffea928a19c50aded605a28279c (diff) | |
| download | emacs-cb7aa6c4a33debd4e0b72e00f846df92f395a181.tar.gz emacs-cb7aa6c4a33debd4e0b72e00f846df92f395a181.zip | |
Remove custom version parsing from epg-config.el (Bug#27963)
* lisp/epg-config.el (epg-config--compare-version)
(epg-config--parse-version): Remove.
(epg-check-configuration): Use `version<=' instead.
| -rw-r--r-- | lisp/epg-config.el | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/lisp/epg-config.el b/lisp/epg-config.el index 7b963add881..6aed354ca4f 100644 --- a/lisp/epg-config.el +++ b/lisp/epg-config.el | |||
| @@ -210,34 +210,16 @@ version requirement is met." | |||
| 210 | (declare (obsolete epg-find-configuration "25.1")) | 210 | (declare (obsolete epg-find-configuration "25.1")) |
| 211 | (epg-config--make-gpg-configuration epg-gpg-program)) | 211 | (epg-config--make-gpg-configuration epg-gpg-program)) |
| 212 | 212 | ||
| 213 | (defun epg-config--parse-version (string) | ||
| 214 | (let ((index 0) | ||
| 215 | version) | ||
| 216 | (while (eq index (string-match "\\([0-9]+\\)\\.?" string index)) | ||
| 217 | (setq version (cons (string-to-number (match-string 1 string)) | ||
| 218 | version) | ||
| 219 | index (match-end 0))) | ||
| 220 | (nreverse version))) | ||
| 221 | |||
| 222 | (defun epg-config--compare-version (v1 v2) | ||
| 223 | (while (and v1 v2 (= (car v1) (car v2))) | ||
| 224 | (setq v1 (cdr v1) v2 (cdr v2))) | ||
| 225 | (- (or (car v1) 0) (or (car v2) 0))) | ||
| 226 | |||
| 227 | ;;;###autoload | 213 | ;;;###autoload |
| 228 | (defun epg-check-configuration (config &optional minimum-version) | 214 | (defun epg-check-configuration (config &optional minimum-version) |
| 229 | "Verify that a sufficient version of GnuPG is installed." | 215 | "Verify that a sufficient version of GnuPG is installed." |
| 230 | (let ((entry (assq 'version config)) | 216 | (let ((version (alist-get 'version config))) |
| 231 | version) | 217 | (unless (stringp version) |
| 232 | (unless (and entry | 218 | (error "Undetermined version: %S" version)) |
| 233 | (stringp (cdr entry))) | 219 | (unless (version<= (or minimum-version |
| 234 | (error "Undetermined version: %S" entry)) | 220 | epg-gpg-minimum-version) |
| 235 | (setq version (epg-config--parse-version (cdr entry)) | 221 | version) |
| 236 | minimum-version (epg-config--parse-version | 222 | (error "Unsupported version: %s" version)))) |
| 237 | (or minimum-version | ||
| 238 | epg-gpg-minimum-version))) | ||
| 239 | (unless (>= (epg-config--compare-version version minimum-version) 0) | ||
| 240 | (error "Unsupported version: %s" (cdr entry))))) | ||
| 241 | 223 | ||
| 242 | ;;;###autoload | 224 | ;;;###autoload |
| 243 | (defun epg-expand-group (config group) | 225 | (defun epg-expand-group (config group) |