Mercurial > emacs
annotate lisp/cedet/inversion.el @ 104470:6ccad1511df1
Minor whitespace changes and `require' fixes.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 06 Sep 2009 21:22:05 +0000 |
parents | 4af663a1c4ab |
children |
rev | line source |
---|---|
104407
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; inversion.el --- When you need something in version XX.XX |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2009 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Version: 0.2 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; Keywords: OO, lisp |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;;; Commentary: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; Keeping track of rapidly developing software is a tough thing to |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; do, especially if you want to have co-dependent packages which all |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; move at different rates. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; This library provides a framework for specifying version numbers |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; and (as side effect) have a flexible way of getting a desired feature set. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 ;; If you would like to use this package to satisfy dependency replace this: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;; (require 'spiffy) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;; with this: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 ;; (require 'inversion) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 ;; (inversion-require 'spiffy "1.0") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ;; If you feel the need to not throw errors, you can do this instead: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;; (let ((err (inversion-test 'spiffy "1.0"))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;; (if err (your-stuff-here))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 ;; If you new package (2.0) needs to make sure a load file from your |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 ;; package is compatible, use this test: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 ;; (if (not (inversion-reverse-test 'spiffy version-from-file)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;; ;; Everything ok |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; (do stuff) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 ;; ;; Out of date |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 ;; (import-old-code)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 ;; If you would like to make inversion optional, do this: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 ;; (or (require 'inversion nil t) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 ;; (defun inversion-test (p v) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 ;; (string= v (symbol-value |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 ;; (intern-soft (concat (symbol-string p) "-version")))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 ;; Or modify to specify `inversion-require' instead. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 ;; TODO: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 ;; Offer to download newer versions of a package. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 ;;; History: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 ;; Sept 3, 2002: First general publication. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 ;;; Code: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (defvar inversion-version "1.3" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 "Current version of InVersion.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (defvar inversion-incompatible-version "0.1alpha1" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 "An earlier release which is incompatible with this release.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (defconst inversion-decoders |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 '( |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (alpha "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*alpha\\([0-9]+\\)?$" 3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*beta\\([0-9]+\\)?$" 3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*(beta\\([0-9]+\\)?)" 3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (prerelease "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*pre\\([0-9]+\\)?$" 3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (full "^\\([0-9]+\\)\\.\\([0-9]+\\)$" 2) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (fullsingle "^\\([0-9]+\\)$" 1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (patch "^\\([0-9]+\\)\\.\\([0-9]+\\) (patch \\([0-9]+\\))" 3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (point "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" 3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (build "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\).\\([0-9]+\\)$" 4) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 "List of decoders for version strings. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 Each decoder is of the form: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ( RELEASE-TYPE REGEXP MAX ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 RELEASE-TYPE is a symbol specifying something like `beta' or `alpha'. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 REGEXP is the regular expression to match a version string. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 MAX is the maximum number of match-numbers in the release number. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 Decoders must be ordered to decode least stable versions before the |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 more stable ones.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 ;;; Version Checking |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (defun inversion-decode-version (version-string) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 "Decode VERSION-STRING into an encoded list. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 Return value is of the form: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (RELEASE MAJOR MINOR ...) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 where RELEASE is a symbol such as `full', or `beta'." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (let ((decoders inversion-decoders) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (result nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (while (and decoders (not result)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (if (string-match (nth 1 (car decoders)) version-string) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (let ((ver nil) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (num-left (nth 2 (car decoders))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (count 1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (while (<= count num-left) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (setq ver (cons |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (if (match-beginning count) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (string-to-number |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (substring version-string |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (match-beginning count) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (match-end count))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 ver) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 count (1+ count))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (setq result (cons (caar decoders) (nreverse ver)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (setq decoders (cdr decoders)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 result)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (defun inversion-package-version (package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 "Return the decoded version for PACKAGE." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (let ((ver (symbol-value |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 (intern-soft |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (concat (symbol-name package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 "-version")))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (code nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (unless ver |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 (error "Package %S does not define %S-version" package package)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ;; Decode the code |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 (setq code (inversion-decode-version ver)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (unless code |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (error "%S-version value cannot be decoded" package)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 code)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (defun inversion-package-incompatibility-version (package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 "Return the decoded incompatibility version for PACKAGE. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 The incompatibility version is specified by the programmer of |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 a package when a package is not backward compatible. It is |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 not an indication of new features or bug fixes." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (let ((ver (symbol-value |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (intern-soft |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (concat (symbol-name package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 "-incompatible-version"))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 (if (not ver) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 ;; Decode the code |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (inversion-decode-version ver)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (defun inversion-recode (code) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 "Convert CODE into a string." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (let ((r (nth 0 code)) ; release-type |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 (n (nth 1 code)) ; main number |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (i (nth 2 code)) ; first increment |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (p (nth 3 code))) ; second increment |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (cond |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 ((eq r 'full) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (setq r "" p "")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 ((eq r 'point) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (setq r "."))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 (format "%s.%s%s%s" n i r p))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 (defun inversion-release-to-number (release-symbol) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 "Convert RELEASE-SYMBOL into a number." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 (let* ((ra (assoc release-symbol inversion-decoders)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (rn (- (length inversion-decoders) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 (length (member ra inversion-decoders))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 rn)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (defun inversion-= (ver1 ver2) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 "Return non-nil if VER1 is equal to VER2." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (equal ver1 ver2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (defun inversion-< (ver1 ver2) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 "Return non-nil if VER1 is less than VER2." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 (let ((v1-0 (inversion-release-to-number (nth 0 ver1))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (v1-1 (nth 1 ver1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (v1-2 (nth 2 ver1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (v1-3 (nth 3 ver1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (v1-4 (nth 4 ver1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 ;; v2 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 (v2-0 (inversion-release-to-number (nth 0 ver2))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (v2-1 (nth 1 ver2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (v2-2 (nth 2 ver2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 (v2-3 (nth 3 ver2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (v2-4 (nth 4 ver2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 (or (and (= v1-0 v2-0) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (= v1-1 v2-1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (= v1-2 v2-2) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (= v1-3 v2-3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 v1-4 v2-4 ; all or nothin if elt - is = |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (< v1-4 v2-4)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (and (= v1-0 v2-0) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (= v1-1 v2-1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (= v1-2 v2-2) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 v1-3 v2-3 ; all or nothin if elt - is = |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (< v1-3 v2-3)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (and (= v1-1 v2-1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (< v1-2 v2-2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (and (< v1-1 v2-1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (and (< v1-0 v2-0) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (= v1-1 v2-1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (= v1-2 v2-2) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 ))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (defun inversion-check-version (version incompatible-version |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 minimum &rest reserved) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 "Check that a given version meets the minimum requirement. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 VERSION, INCOMPATIBLE-VERSION and MINIMUM are of similar format to |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 return entries of `inversion-decode-version', or a classic version |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 string. INCOMPATIBLE-VERSION can be nil. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 RESERVED arguments are kept for a later use. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 Return: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 - nil if everything is ok |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 - 'outdated if VERSION is less than MINIMUM. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 - 'incompatible if VERSION is not backward compatible with MINIMUM. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 - t if the check failed." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (let ((code (if (stringp version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (inversion-decode-version version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 version)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (req (if (stringp minimum) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (inversion-decode-version minimum) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 minimum)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 ;; Perform a test. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (cond |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 ((inversion-= code req) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 ;; Same version.. Yay! |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 nil) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 ((inversion-< code req) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 ;; Version is too old! |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 'outdated) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 ((inversion-< req code) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 ;; Newer is installed. What to do? |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (let ((incompatible |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (if (stringp incompatible-version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (inversion-decode-version incompatible-version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 incompatible-version))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (cond |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 ((not incompatible) nil) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 ((or (inversion-= req incompatible) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (inversion-< req incompatible)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 ;; The requested version is = or < than what the package |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 ;; maintainer says is incompatible. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 'incompatible) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 ;; Things are ok. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (t nil)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 ;; Check failed |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (t t)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (defun inversion-test (package minimum &rest reserved) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 "Test that PACKAGE meets the MINIMUM version requirement. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 PACKAGE is a symbol, similar to what is passed to `require'. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 MINIMUM is of similar format to return entries of |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 `inversion-decode-version', or a classic version string. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 RESERVED arguments are kept for a later user. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 This depends on the symbols `PACKAGE-version' and optionally |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 `PACKAGE-incompatible-version' being defined in PACKAGE. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 Return nil if everything is ok. Return an error string otherwise." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (let ((check (inversion-check-version |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (inversion-package-version package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (inversion-package-incompatibility-version package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 minimum reserved))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (cond |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 ((null check) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 ;; Same version.. Yay! |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 nil) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 ((eq check 'outdated) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 ;; Version is too old! |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 (format "You need to upgrade package %s to %s" package minimum)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 ((eq check 'incompatible) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 ;; Newer is installed but the requested version is = or < than |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 ;; what the package maintainer says is incompatible, then throw |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 ;; that error. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (format "Package %s version is not backward compatible with %s" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 package minimum)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 ;; Check failed |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 (t "Inversion version check failed.")))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 (defun inversion-reverse-test (package oldversion &rest reserved) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 "Test that PACKAGE at OLDVERSION is still compatible. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 If something like a save file is loaded at OLDVERSION, this |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 test will identify if OLDVERSION is compatible with the current version |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 of PACKAGE. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 PACKAGE is a symbol, similar to what is passed to `require'. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 OLDVERSION is of similar format to return entries of |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 `inversion-decode-version', or a classic version string. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 RESERVED arguments are kept for a later user. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 This depends on the symbols `PACKAGE-version' and optionally |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 `PACKAGE-incompatible-version' being defined in PACKAGE. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 Return nil if everything is ok. Return an error string otherwise." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (let ((check (inversion-check-version |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (inversion-package-version package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 (inversion-package-incompatibility-version package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 oldversion reserved))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (cond |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 ((null check) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 ;; Same version.. Yay! |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 nil) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 ((eq check 'outdated) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 ;; Version is too old! |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (format "Package %s version %s is not compatible with current version" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 package oldversion)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 ((eq check 'incompatible) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 ;; Newer is installed but the requested version is = or < than |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 ;; what the package maintainer says is incompatible, then throw |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 ;; that error. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (format "Package %s version is not backward compatible with %s" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 package oldversion)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 ;; Check failed |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (t "Inversion version check failed.")))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (defun inversion-require (package version &optional file directory |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 &rest reserved) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 "Declare that you need PACKAGE with at least VERSION. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 PACKAGE might be found in FILE. (See `require'.) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 Throws an error if VERSION is incompatible with what is installed. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 Optional argument DIRECTORY is a location where new versions of |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 this tool can be located. If there is a versioning problem and |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 DIRECTORY is provided, inversion will offer to download the file. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 Optional argument RESERVED is saved for later use." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 (require package file) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 (let ((err (inversion-test package version))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 (when err |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 (if directory |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 (inversion-download-package-ask err package directory version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (error err))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 ;; Return the package symbol that was required. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 package)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 (defun inversion-require-emacs (emacs-ver xemacs-ver) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 "Declare that you need either EMACS-VER, or XEMACS-VER. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 Only checks one based on which kind of Emacs is being run." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 (let ((err (inversion-test 'emacs |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 (if (featurep 'xemacs) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 xemacs-ver |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 emacs-ver)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 (if err (error err) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 ;; Something nice... |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 t))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (defconst inversion-find-data |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 '("(def\\(var\\|const\\)\\s-+%s-%s\\s-+\"\\([^\"]+\\)" 2) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 "Regexp template and match data index of a version string.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (defun inversion-find-version (package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 "Search for the version and incompatible version of PACKAGE. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 Does not load PACKAGE nor requires that it has been previously loaded. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 Search in the directories in `load-path' for a PACKAGE.el library. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 Visit the file found and search for the declarations of variables or |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 constants `PACKAGE-version' and `PACKAGE-incompatible-version'. The |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 value of these variables must be a version string. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 Return a pair (VERSION-STRING . INCOMPATIBLE-VERSION-STRING) where |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 INCOMPATIBLE-VERSION-STRING can be nil. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 Return nil when VERSION-STRING was not found." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (let* ((file (locate-library (format "%s.el" package) t)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (tag (car inversion-find-data)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 (idx (nth 1 inversion-find-data)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (when file |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (with-temp-buffer |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 ;; The 3000 is a bit arbitrary, but should cut down on |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 ;; fileio as version info usually is at the very top |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 ;; of a file. AFter a long commentary could be bad. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (insert-file-contents-literally file nil 0 3000) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 (goto-char (point-min)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 (when (re-search-forward (format tag package 'version) nil t) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (setq version (list (match-string idx))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 (goto-char (point-min)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (when (re-search-forward |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (format tag package 'incompatible-version) nil t) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (setcdr version (match-string idx)))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 version)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (defun inversion-add-to-load-path (package minimum |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 &optional installdir |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 &rest subdirs) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 "Add the PACKAGE path to `load-path' if necessary. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 MINIMUM is the minimum version requirement of PACKAGE. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 Optional argument INSTALLDIR is the base directory where PACKAGE is |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 installed. It defaults to `default-directory'/PACKAGE. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 SUBDIRS are sub-directories to add to `load-path', following the main |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 INSTALLDIR path." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 (let ((ver (inversion-find-version package))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 ;; If PACKAGE not found or a bad version already in `load-path', |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 ;; prepend the new PACKAGE path, so it will be loaded first. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (when (or (not ver) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (and |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 (inversion-check-version (car ver) (cdr ver) minimum) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 (message "Outdated %s %s shadowed to meet minimum version %s" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 package (car ver) minimum) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 t)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 (let* ((default-directory |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 (or installdir |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 (expand-file-name (format "./%s" package)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 subdir) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 (when (file-directory-p default-directory) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 ;; Add SUBDIRS |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 (while subdirs |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 (setq subdir (expand-file-name (car subdirs)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 subdirs (cdr subdirs)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 (when (file-directory-p subdir) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 ;;(message "%S added to `load-path'" subdir) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (add-to-list 'load-path subdir))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 ;; Add the main path |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 ;;(message "%S added to `load-path'" default-directory) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 (add-to-list 'load-path default-directory)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 ;; We get to this point iff we do not accept or there is no |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 ;; system file. Lets check the version of what we just |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 ;; installed... just to be safe. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 (let ((newver (inversion-find-version package))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 (if (not newver) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 (error "Failed to find version for newly installed %s" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 package)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (if (inversion-check-version (car newver) (cdr newver) minimum) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 (error "Outdated %s %s just installed" package (car newver))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 ))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 ;;; Inversion tests |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 (defun inversion-unit-test () |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 "Test inversion to make sure it can identify different version strings." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 (interactive) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 (let ((c1 (inversion-package-version 'inversion)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (c1i (inversion-package-incompatibility-version 'inversion)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (c2 (inversion-decode-version "1.3alpha2")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (c3 (inversion-decode-version "1.3beta4")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 (c4 (inversion-decode-version "1.3 beta5")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 (c5 (inversion-decode-version "1.3.4")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 (c6 (inversion-decode-version "2.3alpha")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 (c7 (inversion-decode-version "1.3")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 (c8 (inversion-decode-version "1.3pre1")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 (c9 (inversion-decode-version "2.4 (patch 2)")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 (c10 (inversion-decode-version "2.4 (patch 3)")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 (c11 (inversion-decode-version "2.4.2.1")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 (c12 (inversion-decode-version "2.4.2.2")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (if (not (and |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 (inversion-= c1 c1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 (inversion-< c1i c1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 (inversion-< c2 c3) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (inversion-< c3 c4) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 (inversion-< c4 c5) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (inversion-< c5 c6) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 (inversion-< c2 c4) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 (inversion-< c2 c5) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (inversion-< c2 c6) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 (inversion-< c3 c5) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (inversion-< c3 c6) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 (inversion-< c7 c6) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 (inversion-< c4 c7) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 (inversion-< c2 c7) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (inversion-< c8 c6) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 (inversion-< c8 c7) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 (inversion-< c4 c8) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (inversion-< c2 c8) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 (inversion-< c9 c10) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 (inversion-< c10 c11) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 (inversion-< c11 c12) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 ;; Negatives |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 (not (inversion-< c3 c2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 (not (inversion-< c4 c3)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 (not (inversion-< c5 c4)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (not (inversion-< c6 c5)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 (not (inversion-< c7 c2)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 (not (inversion-< c7 c8)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 (not (inversion-< c12 c11)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 ;; Test the tester on inversion |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (not (inversion-test 'inversion inversion-version)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 ;; Test that we throw an error |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 (inversion-test 'inversion "0.0.0") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 (inversion-test 'inversion "1000.0") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 )) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 (error "Inversion tests failed") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 (message "Inversion tests passed.")))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 ;;; URL and downloading code |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 (defun inversion-locate-package-files (package directory &optional version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 "Get a list of distributions of PACKAGE from DIRECTORY. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 DIRECTORY can be an ange-ftp compatible filename, such as: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 \"/ftp@ftp1.sourceforge.net/pub/sourceforge/PACKAGE\" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 If it is a URL, wget will be used for download. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 Optional argument VERSION will restrict the list of available versions |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 to the file matching VERSION exactly, or nil." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 ;;DIRECTORY should also allow a URL: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 ;; \"http://ftp1.sourceforge.net/PACKAGE\" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 ;; but then I can get file listings easily. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 (if (symbolp package) (setq package (symbol-name package))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (directory-files directory t |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 (if version |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (concat "^" package "-" version "\\>") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 package))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (defvar inversion-package-common-tails '( ".tar.gz" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 ".tar" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 ".zip" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 ".gz" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 "Common distribution mechanisms for Emacs Lisp packages.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 (defun inversion-locate-package-files-and-split (package directory &optional version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 "Use `inversion-locate-package-files' to get a list of PACKAGE files. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 DIRECTORY is the location where distributions of PACKAGE are. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 VERSION is an optional argument specifying a version to restrict to. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 The return list is an alist with the version string in the CAR, |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 and the full path name in the CDR." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 (if (symbolp package) (setq package (symbol-name package))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 (let ((f (inversion-locate-package-files package directory version)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 (out nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 (while f |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 (let* ((file (car f)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 (dist (file-name-nondirectory file)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 (tails inversion-package-common-tails) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 (verstring nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 (while (and tails (not verstring)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 (when (string-match (concat (car tails) "$") dist) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 (setq verstring |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 (substring dist (1+ (length package)) (match-beginning 0)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 (setq tails (cdr tails))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 (if (not verstring) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 (error "Cannot decode version for %s" dist)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 (setq out |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 (cons |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 (cons verstring file) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 out)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 (setq f (cdr f)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 out)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 (defun inversion-download-package-ask (err package directory version) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 "Due to ERR, offer to download PACKAGE from DIRECTORY. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 The package should have VERSION available for download." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 (if (symbolp package) (setq package (symbol-name package))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 (let ((files (inversion-locate-package-files-and-split |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 package directory version))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 (if (not files) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 (error err) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (if (not (y-or-n-p (concat err ": Download update? "))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 (error err) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (let ((dest (read-directory-name (format "Download %s to: " |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 t))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (if (> (length files) 1) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 (setq files |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 (list |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 "foo" ;; ignored |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 (read-file-name "Version to download: " |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 directory |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 files |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 t |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 (concat |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 (file-name-as-directory directory) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 nil)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 (copy-file (cdr (car files)) dest)))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 (defun inversion-upgrade-package (package &optional directory) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 "Try to upgrade PACKAGE in DIRECTORY is available." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 (interactive "sPackage to upgrade: ") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 (if (stringp package) (setq package (intern package))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 (if (not directory) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 ;; Hope that the package maintainer specified. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 (setq directory (symbol-value (or (intern-soft |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 (concat (symbol-name package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 "-url")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 (intern-soft |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 (concat (symbol-name package) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 "-directory")))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 (let ((files (inversion-locate-package-files-and-split |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 package directory)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 (cver (inversion-package-version package)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 (newer nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 (mapc (lambda (f) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 (if (inversion-< cver (inversion-decode-version (car f))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (setq newer (cons f newer)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 files) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 newer |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 )) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 ;; (inversion-upgrade-package |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 ;; 'semantic |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 ;; "/ftp@ftp1.sourceforge.net:/pub/sourceforge/cedet") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 ;; "/ftp@ftp1.sourceforge.net:/pub/sourceforge/cedet" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 (provide 'inversion) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 ;;; inversion.el ends here |