;;; inversion.el --- When you need something in version XX.XX
-;;; Copyright (C) 2002-2003, 2005-2011 Free Software Foundation, Inc.
+;;; Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
-;; Version: 0.2
+;; Version: 1.3
;; Keywords: OO, lisp
;; This file is part of GNU Emacs.
(defconst inversion-decoders
'(
- (alpha "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?alpha\\([0-9]+\\)?$" 3)
- (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?beta\\([0-9]+\\)?$" 3)
- (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*(beta\\([0-9]+\\)?)" 3)
+ (alpha "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]*\\)?\\s-*\\.?alpha\\([0-9]+\\)?$" 4)
+ (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]*\\)?\\s-*\\.?beta\\([0-9]+\\)?$" 4)
+ (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]*\\)?\\s-*\\.?(beta\\([0-9]+\\)?)$" 4)
+ (beta "^[^/]+/\\w+--\\w+--\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)--patch-\\([0-9]+\\)" 4)
+ (beta "^\\w+: v\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)-\\([0-9]+\\)-\\(.*\\)" 5)
(prerelease "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?pre\\([0-9]+\\)?$" 3)
- (full "^\\([0-9]+\\)\\.\\([0-9]+\\)$" 2)
+ (full "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?$" 3)
(fullsingle "^\\([0-9]+\\)$" 1)
- (patch "^\\([0-9]+\\)\\.\\([0-9]+\\) (patch \\([0-9]+\\))" 3)
+ (patch "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?\\s-*(patch \\([0-9]+\\))" 4)
(point "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" 3)
+ (point "^\\w+: v\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)-\\(0\\)-\\(.*\\)" 5)
(build "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\).\\([0-9]+\\)$" 4)
+ (full "^[^/]+/\\w+--\\w+--\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)--version-\\([0-9]+\\)" 4)
+ (full "^\\w+: v\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" 5)
)
"List of decoders for version strings.
Each decoder is of the form:
;; Decode the code
(setq code (inversion-decode-version ver))
(unless code
- (error "%S-version value cannot be decoded" package))
+ (error "%S-version value (%s) cannot be decoded" package ver))
code))
(defun inversion-package-incompatibility-version (package)
(v2-3 (nth 3 ver2))
(v2-4 (nth 4 ver2))
)
- (or (and (= v1-0 v2-0)
- (= v1-1 v2-1)
- (= v1-2 v2-2)
- (= v1-3 v2-3)
- v1-4 v2-4 ; all or nothin if elt - is =
+
+ (cond ((and (equal (list v1-1 v1-2 v1-3 v1-4)
+ (list v2-1 v2-2 v2-3 v2-4))
+ v1-0 v2-0)
+ (< v1-0 v2-0))
+ ((and (equal v1-1 v2-1)
+ (equal v1-2 v2-2)
+ (equal v1-3 v2-3)
+ v1-4 v2-4) ; all or nothing if elt - is =
(< v1-4 v2-4))
- (and (= v1-0 v2-0)
- (= v1-1 v2-1)
- (= v1-2 v2-2)
- v1-3 v2-3 ; all or nothin if elt - is =
+ ((and (equal v1-1 v2-1)
+ (equal v1-2 v2-2)
+ v1-3 v2-3) ; all or nothing if elt - is =
(< v1-3 v2-3))
- (and (= v1-1 v2-1)
+ ((and (equal v1-1 v2-1)
+ v1-2 v2-2)
(< v1-2 v2-2))
- (and (< v1-1 v2-1))
- (and (< v1-0 v2-0)
- (= v1-1 v2-1)
- (= v1-2 v2-2)
- )
+ ((and v1-1 v2-1)
+ (< v1-1 v2-1))
)))
(defun inversion-check-version (version incompatible-version
- minimum &rest reserved)
+ minimum &rest reserved)
"Check that a given version meets the minimum requirement.
VERSION, INCOMPATIBLE-VERSION and MINIMUM are of similar format to
return entries of `inversion-decode-version', or a classic version
string. INCOMPATIBLE-VERSION can be nil.
RESERVED arguments are kept for a later use.
Return:
-- nil if everything is ok
+- nil if everything is ok.
- 'outdated if VERSION is less than MINIMUM.
- 'incompatible if VERSION is not backward compatible with MINIMUM.
- t if the check failed."
;; Return the package symbol that was required.
package))
-(defun inversion-require-emacs (emacs-ver xemacs-ver)
- "Declare that you need either EMACS-VER, or XEMACS-VER.
+;;;###autoload
+(defun inversion-require-emacs (emacs-ver xemacs-ver sxemacs-ver)
+ "Declare that you need either EMACS-VER, XEMACS-VER or SXEMACS-ver.
Only checks one based on which kind of Emacs is being run."
(let ((err (inversion-test 'emacs
- (if (featurep 'xemacs)
- xemacs-ver
- emacs-ver))))
+ (cond ((featurep 'sxemacs)
+ sxemacs-ver)
+ ((featurep 'xemacs)
+ xemacs-ver)
+ (t
+ emacs-ver)))))
(if err (error err)
;; Something nice...
t)))
(with-temp-buffer
;; The 3000 is a bit arbitrary, but should cut down on
;; fileio as version info usually is at the very top
- ;; of a file. AFter a long commentary could be bad.
+ ;; of a file. After a long commentary could be bad.
(insert-file-contents-literally file nil 0 3000)
(goto-char (point-min))
(when (re-search-forward (format tag package 'version) nil t)
;;(message "%S added to `load-path'" default-directory)
(add-to-list 'load-path default-directory))
;; We get to this point iff we do not accept or there is no
- ;; system file. Lets check the version of what we just
+ ;; system file. Let's check the version of what we just
;; installed... just to be safe.
(let ((newver (inversion-find-version package)))
(if (not newver)