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.
This commit is contained in:
parent
87645443b5
commit
cb7aa6c4a3
1 changed files with 7 additions and 25 deletions
|
@ -210,34 +210,16 @@ version requirement is met."
|
|||
(declare (obsolete epg-find-configuration "25.1"))
|
||||
(epg-config--make-gpg-configuration epg-gpg-program))
|
||||
|
||||
(defun epg-config--parse-version (string)
|
||||
(let ((index 0)
|
||||
version)
|
||||
(while (eq index (string-match "\\([0-9]+\\)\\.?" string index))
|
||||
(setq version (cons (string-to-number (match-string 1 string))
|
||||
version)
|
||||
index (match-end 0)))
|
||||
(nreverse version)))
|
||||
|
||||
(defun epg-config--compare-version (v1 v2)
|
||||
(while (and v1 v2 (= (car v1) (car v2)))
|
||||
(setq v1 (cdr v1) v2 (cdr v2)))
|
||||
(- (or (car v1) 0) (or (car v2) 0)))
|
||||
|
||||
;;;###autoload
|
||||
(defun epg-check-configuration (config &optional minimum-version)
|
||||
"Verify that a sufficient version of GnuPG is installed."
|
||||
(let ((entry (assq 'version config))
|
||||
version)
|
||||
(unless (and entry
|
||||
(stringp (cdr entry)))
|
||||
(error "Undetermined version: %S" entry))
|
||||
(setq version (epg-config--parse-version (cdr entry))
|
||||
minimum-version (epg-config--parse-version
|
||||
(or minimum-version
|
||||
epg-gpg-minimum-version)))
|
||||
(unless (>= (epg-config--compare-version version minimum-version) 0)
|
||||
(error "Unsupported version: %s" (cdr entry)))))
|
||||
(let ((version (alist-get 'version config)))
|
||||
(unless (stringp version)
|
||||
(error "Undetermined version: %S" version))
|
||||
(unless (version<= (or minimum-version
|
||||
epg-gpg-minimum-version)
|
||||
version)
|
||||
(error "Unsupported version: %s" version))))
|
||||
|
||||
;;;###autoload
|
||||
(defun epg-expand-group (config group)
|
||||
|
|
Loading…
Add table
Reference in a new issue