annotate lisp/package-get.el @ 3406:e20f099668a6

[xemacs-hg @ 2006-05-17 06:18:45 by malcolmp] PROBLEMS: Add entry concerning X errors when using ssh.
author malcolmp
date Wed, 17 May 2006 06:18:45 +0000
parents 65264c66457b
children 14fbcab7c67b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; package-get.el --- Retrieve XEmacs package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1998 by Pete Ware
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
4 ;; Copyright (C) 2002 Ben Wing.
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
5 ;; Copyright (C) 2003, Steve Youngs
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Author: Pete Ware <ware@cis.ohio-state.edu>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Heavy-Modifications: Greg Klanderman <greg@alphatech.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Jan Vroonhof <vroonhof@math.ethz.ch>
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
10 ;; Steve Youngs <youngs@xemacs.org>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; Keywords: internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; along with XEmacs; see the file COPYING. If not, write to the Free
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;; 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;;; Synched up with: Not in FSF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 ;; package-get -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 ;; Retrieve a package and any other required packages from an archive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 ;;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 434
diff changeset
38 ;; Note (JV): Most of this no longer applies!
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; The idea:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; A new XEmacs lisp-only release is generated with the following steps:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 ;; 1. The maintainer runs some yet to be written program that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 ;; generates all the dependency information. This should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 ;; determine all the require and provide statements and associate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;; them with a package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ;; 2. All the packages are then bundled into their own tar balls
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ;; (or whatever format)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ;; 3. Maintainer automatically generates a new `package-get-base'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ;; data structure which contains information such as the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ;; package name, the file to be retrieved, an md5 checksum,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ;; etc (see `package-get-base').
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 ;; 4. The maintainer posts an announcement with the new version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 ;; of `package-get-base'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 ;; 5. A user/system manager saves this posting and runs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 ;; `package-get-update' which uses the previously saved list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 ;; of packages, `package-get-here' that the user/site
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 ;; wants to determine what new versions to download and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 ;; install.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 ;; A user/site manager can generate a new `package-get-here' structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 ;; by using `package-get-setup' which generates a customize like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 ;; interface to the list of packages. The buffer looks something
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;; like:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 ;; gnus - a mail and news reader
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 ;; [] Always install
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 ;; [] Needs updating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ;; [] Required by other [packages]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 ;; version: 2.0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 ;; vm - a mail reader
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 ;; [] Always install
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ;; [] Needs updating
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
74 ;; [] Required by other [packages]
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 ;; Where `[]' indicates a toggle box
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 ;; - Clicking on "Always install" puts this into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 ;; `package-get-here' list. "Needs updating" indicates a new
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 ;; version is available. Anything already in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 ;; `package-get-here' has this enabled.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 ;; - "Required by other" means some other packages are going to force
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 ;; this to be installed. Clicking on [packages] gives a list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 ;; of packages that require this.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
85 ;;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ;; The `package-get-base' should be installed in a file in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 ;; `data-directory'. The `package-get-here' should be installed in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ;; site-lisp. Both are then read at run time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ;; TODO:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 ;; - Implement `package-get-setup'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 ;; - Actually put `package-get-base' and `package-get-here' into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 ;; files that are read.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 ;; - Allow users to have their own packages that they want installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 ;; in ~/.xemacs/.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 ;; - SOMEONE needs to write the programs that generate the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 ;; provides/requires database and makes it into a lisp data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 ;; structure suitable for `package-get-base'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 ;; - Handle errors such as no package providing a required symbol.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 ;; - Tie this into the `require' function to download packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 ;; transparently.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 ;;; Change Log
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 (require 'package-admin)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 ;; (require 'package-get-base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 (defgroup package-tools nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 "Tools to manipulate packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 :group 'emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 (defgroup package-get nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 "Automatic Package Fetcher and Installer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 :prefix "package-get"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 :group 'package-tools)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
119 ;;;###autoload
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 (defvar package-get-base nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 "List of packages that are installed at this site.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 For each element in the alist, car is the package name and the cdr is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 a plist containing information about the package. Typical fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 kept in the plist are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 version - version of this package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 provides - list of symbols provided
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 requires - list of symbols that are required.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 These in turn are provided by other packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 filename - name of the file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 size - size of the file (aka the bundled package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 md5sum - computed md5 checksum
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 description - What this package is for.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 type - Whether this is a 'binary (default) or 'single file package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 More fields may be added as needed. An example:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 '(
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 (name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 (version \"<version 2>\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 file \"filename\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 description \"what this package is about.\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 provides (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 requires (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 size <integer-bytes>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 md5sum \"<checksum\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 type single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 (version \"<version 1>\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 file \"filename\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 description \"what this package is about.\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 provides (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 requires (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 size <integer-bytes>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 md5sum \"<checksum\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 type single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 For version information, it is assumed things are listed in most
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 recent to least recent -- in other words, the version names don't have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 be lexically ordered. It is debatable if it makes sense to have more than
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 one version of a package available.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 (defcustom package-get-dir (temp-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 "*Where to store temporary files for staging."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 :tag "Temporary directory"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 :type 'directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171
1378
69a674f5861f [xemacs-hg @ 2003-03-24 16:30:55 by youngs]
youngs
parents: 1374
diff changeset
172 ;;;###autoload
1483
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
173 (defcustom package-get-package-index-file-location
3179
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
174 (cond
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
175 ;; historical backage
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
176 ((getenv "EMACSPACKAGEPATH")
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
177 (split-path (getenv "EMACSPACKAGEPATH")))
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
178 ((getenv "EMACSEARLYPACKAGES")
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
179 (split-path (getenv "EMACSEARLYPACKAGES")))
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
180 (configure-early-package-directories
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
181 (car configure-early-package-directories))
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
182 (t
15139dbf89f4 [xemacs-hg @ 2005-12-27 18:50:47 by michaels]
michaels
parents: 3141
diff changeset
183 user-init-directory))
1483
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
184 "*The directory where the package-index file can be found."
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
185 :type 'directory
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
186 :group 'package-get)
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
187
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
188 ;;;###autoload
1378
69a674f5861f [xemacs-hg @ 2003-03-24 16:30:55 by youngs]
youngs
parents: 1374
diff changeset
189 (defcustom package-get-install-to-user-init-directory nil
69a674f5861f [xemacs-hg @ 2003-03-24 16:30:55 by youngs]
youngs
parents: 1374
diff changeset
190 "*If non-nil install packages under `user-init-directory'."
69a674f5861f [xemacs-hg @ 2003-03-24 16:30:55 by youngs]
youngs
parents: 1374
diff changeset
191 :type 'boolean
69a674f5861f [xemacs-hg @ 2003-03-24 16:30:55 by youngs]
youngs
parents: 1374
diff changeset
192 :group 'package-get)
69a674f5861f [xemacs-hg @ 2003-03-24 16:30:55 by youngs]
youngs
parents: 1374
diff changeset
193
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 (define-widget 'host-name 'string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 "A Host name."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 :tag "Host")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 (defcustom package-get-remote nil
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
199 "*The remote site to contact for downloading packages.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
200 Format is '(site-name directory-on-site). As a special case, `site-name'
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
201 can be `nil', in which case `directory-on-site' is treated as a local
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
202 directory."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 :tag "Package repository"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
204 :type '(set (choice (const :tag "None" nil)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
205 (list :tag "Local" (const :tag "Local" nil) directory)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
206 (list :tag "Remote" host-name directory)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 (defcustom package-get-download-sites
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 '(
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
212 ;; Main XEmacs Site (ftp.xemacs.org)
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
213 ("US (Main XEmacs Site)"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
214 "ftp.xemacs.org" "pub/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
215 ;; In alphabetical order of Country, our mirrors...
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
216 ("Argentina (xmundo.net)" "xemacs.xmundo.net" "pub/mirrors/xemacs/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
217 ("Australia (aarnet.edu.au)" "mirror.aarnet.edu.au" "pub/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
218 ("Australia (au.xemacs.org)" "ftp.au.xemacs.org" "pub/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
219 ("Austria (at.xemacs.org)" "ftp.at.xemacs.org" "editors/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
220 ("Belgium (be.xemacs.org)" "ftp.be.xemacs.org" "xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
221 ("Brazil (br.xemacs.org)" "ftp.br.xemacs.org" "pub/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
222 ("Canada (ca.xemacs.org)" "ftp.ca.xemacs.org" "pub/Mirror/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
223 ("Canada (crc.ca)" "ftp.crc.ca" "pub/packages/editors/xemacs/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
224 ("Canada (nrc.ca)" "ftp.nrc.ca" "pub/packages/editors/xemacs/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
225 ("Czech Republic (cz.xemacs.org)" "ftp.cz.xemacs.org" "MIRRORS/ftp.xemacs.org/pub/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
226 ("Denmark (dk.xemacs.org)" "ftp.dk.xemacs.org" "pub/emacs/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
227 ("Finland (fi.xemacs.org)" "ftp.fi.xemacs.org" "pub/mirrors/ftp.xemacs.org/pub/tux/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
228 ("France (fr.xemacs.org)" "ftp.fr.xemacs.org" "pub/xemacs/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
229 ("France (mirror.cict.fr)" "mirror.cict.fr" "xemacs/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
230 ("France (pasteur.fr)" "ftp.pasteur.fr" "pub/computing/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
231 ("Germany (de.xemacs.org)" "ftp.de.xemacs.org" "pub/ftp.xemacs.org/tux/xemacs/packages")
3141
66c42fc5d26b [xemacs-hg @ 2005-12-16 23:52:22 by adrian]
adrian
parents: 3116
diff changeset
232 ("Hong Kong (hk.xemacs.org)" "ftp.hk.xemacs.org" "pub/xemacsftp/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
233 ("Iceland (is.xemacs.org)" "ftp.is.xemacs.org" "pub/xemacs/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
234 ("Ireland (ie.xemacs.org)" "ftp.ie.xemacs.org" "mirrors/ftp.xemacs.org/pub/xemacs/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
235 ("Ireland (heanet.ie)" "ftp.heanet.ie" "mirrors/ftp.xemacs.org/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
236 ("Italy (it.xemacs.org)" "ftp.it.xemacs.org" "unix/packages/XEMACS/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
237 ("Japan (aist.go.jp)" "ring.aist.go.jp" "pub/text/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
238 ("Japan (asahi-net.or.jp)" "ring.asahi-net.or.jp" "pub/text/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
239 ("Japan (dti.ad.jp)" "ftp.dti.ad.jp" "pub/unix/editor/xemacs/packages")
3116
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
240 ; ("Japan (jaist.ac.jp)" "ftp.jaist.ac.jp" "pub/GNU/xemacs/packages")
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
241 ; ("Japan (jp.xemacs.org)" "ftp.jp.xemacs.org" "pub/GNU/xemacs/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
242 ; ("Japan (nucba.ac.jp)" "mirror.nucba.ac.jp" "mirror/xemacs/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
243 ("Japan (sut.ac.jp)" "sunsite.sut.ac.jp" "pub/archives/packages/xemacs/packages")
1374
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
244 ("Korea (kr.xemacs.org)" "ftp.kr.xemacs.org" "pub/tools/emacs/xemacs/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
245 ("New Zealand (nz.xemacs.org)" "ftp.nz.xemacs.org" "mirror/ftp.xemacs.org/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
246 ("Norway (no.xemacs.org)" "ftp.no.xemacs.org" "pub/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
247 ("Poland (pl.xemacs.org)" "ftp.pl.xemacs.org" "pub/unix/editors/xemacs/packages")
3193
65264c66457b [xemacs-hg @ 2006-01-06 12:24:19 by adrian]
adrian
parents: 3179
diff changeset
248 ("Portugal (pt.xemacs.org)" "ftp.pt.xemacs.org" "pub/MIRRORS/ftp.xemacs.org/packages")
3116
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
249 ("Russia (ru.xemacs.org)" "ftp.ru.xemacs.org" "pub/emacs/xemacs/packages")
3021
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
250 ; ("South Africa (za.xemacs.org)" "ftp.za.xemacs.org" "mirrorsites/ftp.xemacs.org/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
251 ("Sweden (se.xemacs.org)" "ftp.se.xemacs.org" "pub/gnu/xemacs/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
252 ("Switzerland (ch.xemacs.org)" "ftp.ch.xemacs.org" "mirror/xemacs/packages")
3021
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
253 ("Taiwan (ftp.tw.xemacs.org)" "ftp.tw.xemacs.org" "Unix/Editors/XEmacs/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
254 ("UK (uk.xemacs.org)" "ftp.uk.xemacs.org" "sites/ftp.xemacs.org/pub/xemacs/packages")
3021
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
255 ("US (ibiblio.org)" "mirrors.ibiblio.org" "pub/mirrors/xemacs/packages")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
256 ("US (stealth.net)" "ftp.stealth.net" "pub/mirrors/ftp.xemacs.org/pub/xemacs/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
257 ("US (unc.edu)" "metalab.unc.edu" "pub/packages/editors/xemacs/packages")
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
258 ("US (us.xemacs.org)" "ftp.us.xemacs.org" "pub/xemacs/packages")
3116
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
259 ; ("US (utk.edu)" "ftp.sunsite.utk.edu" "pub/xemacs/packages")
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
260 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 "*List of remote sites available for downloading packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 List format is '(site-description site-name directory-on-site).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 SITE-DESCRIPTION is a textual description of the site. SITE-NAME
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 is the internet address of the download site. DIRECTORY-ON-SITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 is the directory on the site in which packages may be found.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 This variable is used to initialize `package-get-remote', the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 variable actually used to specify package download sites."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 :tag "Package download sites"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
269 :type '(repeat (list (string :tag "Name") host-name directory))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
272 ;;;###autoload
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
273 (defcustom package-get-pre-release-download-sites
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
274 '(
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
275 ;; Main XEmacs Site (ftp.xemacs.org)
3116
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
276 ("US Pre-Releases (Main XEmacs Site)" "ftp.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
277 "pub/xemacs/beta/experimental/packages")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
278 ;; In alphabetical order of Country, our mirrors...
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
279 ("Argentina Pre-Releases (xmundo.net)" "xemacs.xmundo.net"
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
280 "pub/mirrors/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
281 ("Australia Pre-Releases (aarnet.edu.au)" "mirror.aarnet.edu.au"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
282 "pub/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
283 ("Australia Pre-Releases (au.xemacs.org)" "ftp.au.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
284 "pub/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
285 ("Austria Pre-Releases (at.xemacs.org)" "ftp.at.xemacs.org"
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
286 "editors/xemacs/beta/experimental/packages")
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
287 ("Belgium (be.xemacs.org)" "ftp.be.xemacs.org"
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
288 "xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
289 ("Brazil Pre-Releases (br.xemacs.org)" "ftp.br.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
290 "pub/xemacs/xemacs-21.5/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
291 ("Canada Pre-Releases (ca.xemacs.org)" "ftp.ca.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
292 "pub/Mirror/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
293 ("Canada Pre-Releases (crc.ca)" "ftp.crc.ca"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
294 "pub/packages/editors/xemacs/beta/experimental/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
295 ("Canada Pre-Releases (nrc.ca)" "ftp.nrc.ca"
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
296 "pub/packages/editors/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
297 ("Czech Republic Pre-Releases (cz.xemacs.org)" "ftp.cz.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
298 "MIRRORS/ftp.xemacs.org/pub/xemacs/xemacs-21.5/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
299 ("Denmark Pre-Releases (dk.xemacs.org)" "ftp.dk.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
300 "pub/emacs/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
301 ("Finland Pre-Releases (fi.xemacs.org)" "ftp.fi.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
302 "pub/mirrors/ftp.xemacs.org/pub/tux/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
303 ("France Pre-Releases (fr.xemacs.org)" "ftp.fr.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
304 "pub/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
305 ("France Pre-Releases (mirror.cict.fr)" "mirror.cict.fr"
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
306 "xemacs/beta/experimental/packages")
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
307 ("France Pre-Releases (pasteur.fr)" "ftp.pasteur.fr"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
308 "pub/computing/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
309 ("Germany Pre-Releases (de.xemacs.org)" "ftp.de.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
310 "pub/ftp.xemacs.org/tux/xemacs/beta/experimental/packages")
3141
66c42fc5d26b [xemacs-hg @ 2005-12-16 23:52:22 by adrian]
adrian
parents: 3116
diff changeset
311 ("Hong Kong Pre-Releases (hk.xemacs.org)" "ftp.hk.xemacs.org"
66c42fc5d26b [xemacs-hg @ 2005-12-16 23:52:22 by adrian]
adrian
parents: 3116
diff changeset
312 "pub/xemacsftp/beta/experimental/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
313 ("Iceland Pre-Releases (is.xemacs.org)" "ftp.is.xemacs.org"
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
314 "pub/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
315 ("Ireland Pre-Releases (ie.xemacs.org)" "ftp.ie.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
316 "mirrors/ftp.xemacs.org/pub/xemacs/beta/experimental/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
317 ("Ireland Pre-Releases (heanet.ie)" "ftp.heanet.ie"
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
318 "mirrors/ftp.xemacs.org/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
319 ("Italy Pre-Releases (it.xemacs.org)" "ftp.it.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
320 "unix/packages/XEMACS/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
321 ("Japan Pre-Releases (aist.go.jp)" "ring.aist.go.jp"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
322 "pub/text/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
323 ("Japan Pre-Releases (asahi-net.or.jp)" "ring.asahi-net.or.jp"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
324 "pub/text/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
325 ("Japan Pre-Releases (dti.ad.jp)" "ftp.dti.ad.jp"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
326 "pub/unix/editor/xemacs/beta/experimental/packages")
3116
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
327 ; ("Japan Pre-Releases (jaist.ac.jp)" "ftp.jaist.ac.jp"
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
328 ; "pub/GNU/xemacs/beta/experimental/packages")
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
329 ; ("Japan Pre-Releases (jp.xemacs.org)" "ftp.jp.xemacs.org"
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
330 ; "pub/GNU/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
331 ("Japan Pre-Releases (sut.ac.jp)" "sunsite.sut.ac.jp"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
332 "pub/archives/packages/xemacs/xemacs-21.5/experimental/packages")
3013
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
333 ("Korea (kr.xemacs.org)" "ftp.kr.xemacs.org"
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
334 "pub/tools/emacs/xemacs/beta/experimental/packages")
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
335 ("New Zealand Pre-Releases (nz.xemacs.org)" "ftp.nz.xemacs.org"
ae52b2073aa3 [xemacs-hg @ 2005-10-23 16:56:43 by adrian]
adrian
parents: 2802
diff changeset
336 "mirror/ftp.xemacs.org/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
337 ("Norway Pre-Releases (no.xemacs.org)" "ftp.no.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
338 "pub/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
339 ("Poland Pre-Releases (pl.xemacs.org)" "ftp.pl.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
340 "pub/unix/editors/xemacs/beta/experimental/packages")
3193
65264c66457b [xemacs-hg @ 2006-01-06 12:24:19 by adrian]
adrian
parents: 3179
diff changeset
341 ("Portugal Pre-Releases (pt.xemacs.org)" "ftp.pt.xemacs.org"
65264c66457b [xemacs-hg @ 2006-01-06 12:24:19 by adrian]
adrian
parents: 3179
diff changeset
342 "pub/MIRRORS/ftp.xemacs.org/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
343 ("Russia Pre-Releases (ru.xemacs.org)" "ftp.ru.xemacs.org"
3116
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
344 "pub/emacs/xemacs/beta/experimental/packages")
3021
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
345 ; ("South Africa Pre-Releases (za.xemacs.org)" "ftp.za.xemacs.org"
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
346 ; "mirrorsites/ftp.xemacs.org/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
347 ("Sweden Pre-Releases (se.xemacs.org)" "ftp.se.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
348 "pub/gnu/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
349 ("Switzerland Pre-Releases (ch.xemacs.org)" "ftp.ch.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
350 "mirror/xemacs/beta/experimental/packages")
3021
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
351 ("Taiwan Pre-Releases (ftp.tw.xemacs.org)" "ftp.tw.xemacs.org"
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
352 "Unix/Editors/XEmacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
353 ("UK Pre-Releases (uk.xemacs.org)" "ftp.uk.xemacs.org"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
354 "sites/ftp.xemacs.org/pub/xemacs/beta/experimental/packages")
3021
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
355 ("US Pre-Releases (ibiblio.org)" "mirrors.ibiblio.org"
285d258fdeb6 [xemacs-hg @ 2005-10-24 22:40:20 by adrian]
adrian
parents: 3013
diff changeset
356 "pub/mirrors/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
357 ("US Pre-Releases (stealth.net)" "ftp.stealth.net"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
358 "pub/mirrors/ftp.xemacs.org/pub/xemacs/beta/experimental/packages")
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
359 ("US Pre-Releases (unc.edu)" "metalab.unc.edu"
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
360 "pub/packages/editors/xemacs/beta/experimental/packages")
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
361 ("US Pre-Releases (us.xemacs.org)" "ftp.us.xemacs.org"
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
362 "pub/xemacs/beta/experimental/packages")
3116
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
363 ; ("US Pre-Releases (utk.edu)" "ftp.sunsite.utk.edu"
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
364 ; "pub/xemacs/beta/experimental/packages")
ffbb20e35ed9 [xemacs-hg @ 2005-11-29 21:00:29 by adrian]
adrian
parents: 3021
diff changeset
365 )
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
366 "*List of remote sites available for downloading \"Pre-Release\" packages.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
367 List format is '(site-description site-name directory-on-site).
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
368 SITE-DESCRIPTION is a textual description of the site. SITE-NAME
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
369 is the internet address of the download site. DIRECTORY-ON-SITE
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
370 is the directory on the site in which packages may be found.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
371 This variable is used to initialize `package-get-remote', the
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
372 variable actually used to specify package download sites."
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
373 :tag "Pre-Release Package download sites"
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
374 :type '(repeat (list (string :tag "Name") host-name directory))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
375 :group 'package-get)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
376
1374
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
377 ;;;###autoload
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
378 (defcustom package-get-site-release-download-sites
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
379 nil
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
380 "*List of remote sites available for downloading \"Site Release\" packages.
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
381 List format is '(site-description site-name directory-on-site).
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
382 SITE-DESCRIPTION is a textual description of the site. SITE-NAME
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
383 is the internet address of the download site. DIRECTORY-ON-SITE
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
384 is the directory on the site in which packages may be found.
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
385 This variable is used to initialize `package-get-remote', the
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
386 variable actually used to specify package download sites."
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
387 :tag "Site Release Package download sites"
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
388 :type '(repeat (list (string :tag "Name") host-name directory))
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
389 :group 'package-get)
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1368
diff changeset
390
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 (defcustom package-get-remove-copy t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 "*After copying and installing a package, if this is t, then remove the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 copy. Otherwise, keep it around."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 ;; #### it may make sense for this to be a list of names.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 ;; #### also, should we rename "*base*" to "*index*" or "*db*"?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 ;; "base" is a pretty poor name.
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
400 (defcustom package-get-base-filename "package-index.LATEST.gpg"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 "*Name of the default package-get database file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 This may either be a relative path, in which case it is interpreted
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 with respect to `package-get-remote', or an absolute path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 :type 'file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (defcustom package-get-always-update nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 "*If Non-nil always make sure we are using the latest package index (base).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 Otherwise respect the `force-current' argument of `package-get-require-base'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
413 (defun package-get-pgp-available-p ()
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
414 "Checks the availability of Mailcrypt and PGP executable.
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
415
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
416 Returns t if both are found, nil otherwise. As a side effect, set
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
417 `mc-default-scheme' dependent on the PGP executable found."
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
418 (let (result)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
419 (when (featurep 'mailcrypt-autoloads)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
420 (autoload 'mc-setversion "mc-setversion"))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
421 (when-fboundp 'mc-setversion
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
422 (cond ((locate-file "gpg" exec-path
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
423 '("" ".btm" ".bat" ".cmd" ".exe" ".com")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
424 'executable)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
425 (mc-setversion "gpg")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
426 (setq result t))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
427 ((locate-file "pgpe" exec-path
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
428 '("" ".btm" ".bat" ".cmd" ".exe" ".com")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
429 'executable)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
430 (mc-setversion "5.0")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
431 (setq result t))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
432 ((locate-file "pgp" exec-path
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
433 '("" ".btm" ".bat" ".cmd" ".exe" ".com")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
434 'executable)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
435 (mc-setversion "2.6")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
436 (setq result t))))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
437 (if result
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
438 result
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
439 nil)))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
440
1479
84d95f07cb42 [xemacs-hg @ 2003-05-14 08:47:15 by youngs]
youngs
parents: 1439
diff changeset
441 (defcustom package-get-require-signed-base-updates (package-get-pgp-available-p)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
442 "*If non-nil, try to verify the package index database via PGP.
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
443
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
444 If nil, no PGP verification is done. If the package index database
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
445 entries are not PGP signed and this variable is non-nil, require user
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
446 confirmation to continue with the package-get procedure.
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
447
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
448 The default for this variable is the return value of
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
449 `package-get-pgp-available-p', non-nil if both the \"Mailcrypt\"
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
450 package and a suitable PGP executable are available, nil otherwise."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
454 (defvar package-entries-are-signed nil
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
455 "Non-nil when the package index file has been PGP signed.")
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
456
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
457 (defvar package-get-continue-update-base nil
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
458 "Non-nil update the index even if it hasn't been signed.")
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
459
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 (defvar package-get-was-current nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 "Non-nil we did our best to fetch a current database.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 (defun package-get-require-base (&optional force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 "Require that a package-get database has been loaded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 If the optional FORCE-CURRENT argument or the value of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 `package-get-always-update' is Non-nil, try to update the database
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 from a location in `package-get-remote'. Otherwise a local copy is used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 if available and remote access is never done.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 Please use FORCE-CURRENT only when the user is explictly dealing with packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 and remote access is likely in the near future."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 (setq force-current (or force-current package-get-always-update))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 (unless (and (boundp 'package-get-base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (or (not force-current) package-get-was-current))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (package-get-update-base nil force-current))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 (if (or (not (boundp 'package-get-base))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (not package-get-base))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
480 (error 'void-variable
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
481 "Package-get database not loaded")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 (setq package-get-was-current force-current)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (defconst package-get-pgp-signed-begin-line "^-----BEGIN PGP SIGNED MESSAGE-----"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 "Text for start of PGP signed messages.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 (defconst package-get-pgp-signature-begin-line "^-----BEGIN PGP SIGNATURE-----"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 "Text for beginning of PGP signature.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 (defconst package-get-pgp-signature-end-line "^-----END PGP SIGNATURE-----"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 "Text for end of PGP signature.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 (defun package-get-update-base-entry (entry)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 "Update an entry in `package-get-base'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 (let ((existing (assq (car entry) package-get-base)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (if existing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 (setcdr existing (cdr entry))
824
0cce4fee510b [xemacs-hg @ 2002-05-01 08:25:40 by youngs]
youngs
parents: 793
diff changeset
497 (setq package-get-base (cons entry package-get-base)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 (defun package-get-locate-file (file &optional nil-if-not-found no-remote)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 "Locate an existing FILE with respect to `package-get-remote'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 If FILE is an absolute path or is not found, simply return FILE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 If optional argument NIL-IF-NOT-FOUND is non-nil, return nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 if FILE can not be located.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 If NO-REMOTE is non-nil never search remote locations."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (if (file-name-absolute-p file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 file
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
507 (let ((site package-get-remote)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 (expanded nil))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
509 (when site
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
510 (unless (and no-remote (caar (list site)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
511 (let ((expn (package-get-remote-filename (car (list site)) file)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 (if (and expn (file-exists-p expn))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
513 (setq site nil
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
514 expanded expn)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 (or expanded
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 (and (not nil-if-not-found)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 file)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 (defun package-get-locate-index-file (no-remote)
1483
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
520 "Locate the package-get index file.
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
521
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
522 Do not return remote paths if NO-REMOTE is non-nil. If the index
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
523 file doesn't exist in `package-get-package-index-file-location', ask
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
524 the user if one should be created using the index file in core as a
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
525 template."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (or (package-get-locate-file package-get-base-filename t no-remote)
1483
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
527 (if (file-exists-p (expand-file-name package-get-base-filename
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
528 package-get-package-index-file-location))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
529 (expand-file-name package-get-base-filename
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
530 package-get-package-index-file-location)
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
531 (if (y-or-n-p (format "No index file, shall I create one in %s? "
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
532 package-get-package-index-file-location))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
533 (progn
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
534 (save-excursion
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
535 (set-buffer
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
536 (find-file-noselect (expand-file-name
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
537 package-get-base-filename
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
538 package-get-package-index-file-location)))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
539 (let ((coding-system-for-write 'binary))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
540 (erase-buffer)
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
541 (insert-file-contents-literally
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
542 (locate-data-file package-get-base-filename))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
543 (save-buffer (current-buffer))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
544 (kill-buffer (current-buffer))))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
545 (expand-file-name package-get-base-filename
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
546 package-get-package-index-file-location))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
547 (error 'search-failed
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
548 "Can't locate a package index file.")))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 (defun package-get-maybe-save-index (filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 "Offer to save the current buffer as the local package index file,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 if different."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 (let ((location (package-get-locate-index-file t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 (unless (and filename (equal filename location))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 (unless (and location
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 (equal (md5 (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 (with-temp-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 (insert-file-contents-literally location)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 (md5 (current-buffer)))))
1483
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
560 (when (not (file-writable-p location))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
561 (if (y-or-n-p (format "Sorry, %s is read-only, can I use %s? "
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
562 location user-init-directory))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
563 (setq location (expand-file-name
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
564 package-get-base-filename
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
565 package-get-package-index-file-location))
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
566 (error 'file-error
410360d3e34e [xemacs-hg @ 2003-05-14 23:57:34 by youngs]
youngs
parents: 1479
diff changeset
567 (format "%s is read-only" location))))
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
568 (when (y-or-n-p (concat "Update package index in " location "? "))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
569 (let ((coding-system-for-write 'binary))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
570 (write-file location)))))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
571
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 (defun package-get-update-base (&optional db-file force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 "Update the package-get database file with entries from DB-FILE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 Unless FORCE-CURRENT is non-nil never try to update the database."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 (let ((dflt (package-get-locate-index-file nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 (list (read-file-name "Load package-get database: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 (file-name-directory dflt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 dflt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 (file-name-nondirectory dflt)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 (setq db-file (expand-file-name (or db-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 (package-get-locate-index-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 (not force-current)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 (if (not (file-exists-p db-file))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
587 (error 'file-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
588 (format "Package-get database file `%s' does not exist" db-file)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 (if (not (file-readable-p db-file))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
590 (error 'file-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
591 (format "Package-get database file `%s' not readable" db-file)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 (let ((buf (get-buffer-create "*package database*")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 (set-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 (erase-buffer buf)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
597 (insert-file-contents-literally db-file)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 (package-get-update-base-from-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 (if (file-remote-p db-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 (package-get-maybe-save-index db-file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 (kill-buffer buf))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 (defun package-get-update-base-from-buffer (&optional buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 "Update the package-get database with entries from BUFFER.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 BUFFER defaults to the current buffer. This command can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 used interactively, for example from a mail or news buffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 (setq buf (or buf (current-buffer)))
1937
cac9e42fd31d [xemacs-hg @ 2004-03-04 21:06:58 by youngs]
youngs
parents: 1832
diff changeset
610 (let ((coding-system-for-read 'binary)
cac9e42fd31d [xemacs-hg @ 2004-03-04 21:06:58 by youngs]
youngs
parents: 1832
diff changeset
611 (coding-system-for-write 'binary)
cac9e42fd31d [xemacs-hg @ 2004-03-04 21:06:58 by youngs]
youngs
parents: 1832
diff changeset
612 content-beg content-end)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 (set-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 (setq content-beg (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 (setq content-end (save-excursion (goto-char (point-max)) (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 (when (re-search-forward package-get-pgp-signed-begin-line nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 (setq content-beg (match-end 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 (when (re-search-forward package-get-pgp-signature-begin-line nil t)
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
621 (setq content-end (match-beginning 0))
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
622 (setq package-entries-are-signed t))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
623 (re-search-forward package-get-pgp-signature-end-line nil t)
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
624 (setq package-get-continue-update-base t)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
625 ;; This is a little overkill because the default value of
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
626 ;; `package-get-require-signed-base-updates' is the return of
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
627 ;; `package-get-pgp-available-p', but we have to allow for
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
628 ;; someone explicitly setting
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
629 ;; `package-get-require-signed-base-updates' to t. --SY
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
630 (when (and package-get-require-signed-base-updates
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
631 (package-get-pgp-available-p))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
632 (if package-entries-are-signed
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
633 (let (good-sig)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
634 (setq package-get-continue-update-base nil)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
635 (autoload 'mc-verify "mc-toplev")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
636 (when (declare-fboundp (mc-verify))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
637 (setq good-sig t))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
638 (if good-sig
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
639 (setq package-get-continue-update-base t)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
640 (error 'process-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
641 "GnuPG error. Package database not updated")))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
642 (if (yes-or-no-p
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
643 "Package Index is not PGP signed. Continue anyway? ")
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
644 (setq package-get-continue-update-base t)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
645 (setq package-get-continue-update-base nil)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
646 (warn "Package database not updated"))))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 434
diff changeset
647 ;; ToDo: We should call package-get-maybe-save-index on the region
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
648 (when package-get-continue-update-base
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
649 (package-get-update-base-entries content-beg content-end)
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
650 (message "Updated package database")))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
652 (defun package-get-update-base-entries (start end)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 "Update the package-get database with the entries found between
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
654 START and END in the current buffer."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 (save-excursion
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
656 (goto-char start)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 (if (not (re-search-forward "^(package-get-update-base-entry" nil t))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
658 (error 'search-failed
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
659 "Buffer does not contain package-get database entries"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 (let ((count 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 (while (and (< (point) end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 (re-search-forward "^(package-get-update-base-entry" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 (let ((entry (read (current-buffer))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 (if (or (not (consp entry))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 (not (eq (car entry) 'package-get-update-base-entry)))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
668 (error 'syntax-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
669 "Invalid package-get database entry found"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 (package-get-update-base-entry
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 (car (cdr (car (cdr entry)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 (setq count (1+ count))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 (message "Got %d package-get database entries" count))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 (defun package-get-save-base (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 "Write the package-get database to FILE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 Note: This database will be unsigned of course."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 (interactive "FSave package-get database to: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 (let ((buf (get-buffer-create "*package database*")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 (set-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 (erase-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 (let ((entries package-get-base) entry plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 (insert ";; Package Index file -- Do not edit manually.\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 (insert ";;;@@@\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 (while entries
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 (setq entry (car entries))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 (setq plist (car (cdr entry)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 (insert "(package-get-update-base-entry (quote\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 (insert (format "(%s\n" (symbol-name (car entry))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 (while plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 (insert (format " %s%s %S\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 (if (eq plist (car (cdr entry))) "(" " ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 (symbol-name (car plist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 (car (cdr plist))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 (setq plist (cdr (cdr plist))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 (insert "))\n))\n;;;@@@\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 (setq entries (cdr entries))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 (insert ";; Package Index file ends here\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 (write-region (point-min) (point-max) file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 (kill-buffer buf))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 (defun package-get-interactive-package-query (get-version package-symbol)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 "Perform interactive querying for package and optional version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 Query for a version if GET-VERSION is non-nil. Return package name as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 a symbol instead of a string if PACKAGE-SYMBOL is non-nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 The return value is suitable for direct passing to `interactive'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 (package-get-require-base t)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
714 (let ((table (mapcar #'(lambda (item)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
715 (let ((name (symbol-name (car item))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
716 (cons name name)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
717 package-get-base))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
718 package package-symbol default-version version)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 (setq package (completing-read "Package: " table nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 (setq package-symbol (intern package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 (if get-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 (progn
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
724 (setq default-version
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
725 (package-get-info-prop
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 (package-get-info-find-package package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 package-symbol) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 (while (string=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 (setq version (read-string "Version: " default-version))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
732 ""))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 (if package-symbol
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 (list package-symbol version)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
735 (list package version)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 (if package-symbol
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 (list package-symbol)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
738 (list package))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 (defun package-get-delete-package (package &optional pkg-topdir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 "Delete an installation of PACKAGE below directory PKG-TOPDIR.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 PACKAGE is a symbol, not a string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 This is just an interactive wrapper for `package-admin-delete-binary-package'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 (interactive (package-get-interactive-package-query nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 (package-admin-delete-binary-package package pkg-topdir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 (defun package-get-update-all ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 "Fetch and install the latest versions of all currently installed packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 ;; Load a fresh copy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 (catch 'exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 (mapcar (lambda (pkg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 (if (not (package-get (car pkg) nil 'never))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
757 (throw 'exit nil))) ;; Bail out if error detected
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 683
diff changeset
758 packages-package-list))
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 683
diff changeset
759 (package-net-update-installed-db))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 (defun package-get-all (package version &optional fetched-packages install-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 "Fetch PACKAGE with VERSION and all other required packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 Uses `package-get-base' to determine just what is required and what
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 package provides that functionality. If VERSION is nil, retrieves
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 latest version. Optional argument FETCHED-PACKAGES is used to keep
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 track of packages already fetched. Optional argument INSTALL-DIR,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 if non-nil, specifies the package directory where fetched packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 should be installed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 Returns nil upon error."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 (interactive (package-get-interactive-package-query t nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 (let* ((the-package (package-get-info-find-package package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 (this-package (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 the-package version))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
777 (this-requires (package-get-info-prop this-package 'requires)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 (catch 'exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 (setq version (package-get-info-prop this-package 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 (unless (package-get-installedp package version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 (if (not (package-get package version nil install-dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 (setq fetched-packages nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 (throw 'exit nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 (setq fetched-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 (append (list package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 (package-get-info-prop this-package 'provides)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 fetched-packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 ;; grab everything that this package requires plus recursively
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 ;; grab everything that the requires require. Keep track
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 ;; in `fetched-packages' the list of things provided -- this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 ;; keeps us from going into a loop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 (while this-requires
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 (if (not (member (car this-requires) fetched-packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 (let* ((reqd-package (package-get-package-provider
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 (car this-requires) t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 (reqd-version (cadr reqd-package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 (reqd-name (car reqd-package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 (if (null reqd-name)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
800 (error 'search-failed
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
801 (format "Unable to find a provider for %s"
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
802 (car this-requires))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 (if (not (setq fetched-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 (package-get-all reqd-name reqd-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 fetched-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 install-dir)))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
807 (throw 'exit nil))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
808 (setq this-requires (cdr this-requires))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
809 fetched-packages))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 (defun package-get-dependencies (packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 "Compute dependencies for PACKAGES.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 Uses `package-get-base' to determine just what is required and what
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 package provides that functionality. Returns the list of packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 required by PACKAGES."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 (let ((orig-packages packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 dependencies provided)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 (while packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 (let* ((package (car packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 (the-package (package-get-info-find-package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 package-get-base package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 (this-package (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 the-package nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 (this-requires (package-get-info-prop this-package 'requires))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 (new-depends (set-difference
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 (mapcar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 #'(lambda (reqd)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 (let* ((reqd-package (package-get-package-provider reqd))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 (reqd-name (car reqd-package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 (if (null reqd-name)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
833 (error 'search-failed
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
834 (format "Unable to find a provider for %s" reqd)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 reqd-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 this-requires)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 dependencies))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 (this-provides (package-get-info-prop this-package 'provides)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 (setq dependencies
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 (union dependencies new-depends))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 (setq provided
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 (union provided (union (list package) this-provides)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 (setq packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 (union new-depends (cdr packages)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 (set-difference dependencies orig-packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 (defun package-get-load-package-file (lispdir file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 (let (pathname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 (setq pathname (expand-file-name file lispdir))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
850 (with-trapping-errors
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
851 :operation (format "loading package file \"%s\"" pathname)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
852 :error-form nil
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
853 (load pathname t)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
854 t)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 (defun package-get-init-package (lispdir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 "Initialize the package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 This really assumes that the package has never been loaded. Updating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 a newer package can cause problems, due to old, obsolete functions in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 the old package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 Return `t' upon complete success, `nil' if any errors occurred."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 (if (and lispdir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 (file-accessible-directory-p lispdir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 ;; Add lispdir to load-path if it doesn't already exist.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 ;; NOTE: this does not take symlinks, etc., into account.
2802
52d126cb63af [xemacs-hg @ 2005-06-05 22:46:55 by adrian]
adrian
parents: 2151
diff changeset
869 (add-to-list 'load-path (file-name-as-directory lispdir))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 (if (not (package-get-load-package-file lispdir "auto-autoloads"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 (package-get-load-package-file lispdir "_pkg"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 t)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
873 nil)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
874
2151
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
875 (defun package-get-info-name-array ()
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
876 "Internal, used by `package-get-info'."
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
877 (let ((pkgs package-get-base)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
878 names)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
879 (while pkgs
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
880 (setq names (let ((name (caar pkgs)))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
881 (push (cons (format "%s" name) name) names)))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
882 (setq pkgs (cdr pkgs)))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
883 names))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
884
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
885 (defconst package-get-info-info-array
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
886 '(("standards-version" . standards-version)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
887 ("version" . version)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
888 ("author-version" . author-version)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
889 ("date" . date)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
890 ("build-date" . build-date)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
891 ("maintainer" . maintainer)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
892 ("distribution" . distribution)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
893 ("priority" . priority)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
894 ("category" . category)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
895 ("dump" . dump)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
896 ("description" . description)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
897 ("filename" . filename)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
898 ("md5sum" . md5sum)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
899 ("size" . size)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
900 ("provides" . provides)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
901 ("requires" . requires)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
902 ("type" . type))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
903 "Internal, used by `package-get-info'.")
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
904
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
905 ;;;###autoload
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
906 (defun package-get-info (package information &optional arg remote)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
907 "Get information about a package.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
908
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
909 Quite similar to `package-get-info-prop', but can retrieve a lot more
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
910 information.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
911
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
912 Argument PACKAGE is the name of an XEmacs package (a symbol). It must
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
913 be a valid package, ie, a member of `package-get-base'.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
914
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
915 Argument INFORMATION is a symbol that can be any one of:
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
916
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
917 standards-version Package system version (not used).
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
918 version Version of the XEmacs package.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
919 author-version The upstream version of the package.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
920 date The date the package was last modified.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
921 build-date The date the package was last built.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
922 maintainer The maintainer of the package.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
923 distribution Will always be \"xemacs\" (not used).
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
924 priority \"low\", \"medium\", or \"high\" (not used).
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
925 category Either \"standard\", \"mule\", or \"unsupported\"..
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
926 dump Is the package dumped (not used).
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
927 description A description of the package.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
928 filename The filename of the binary tarball of the package.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
929 md5sum The md5sum of filename.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
930 size The size in bytes of filename.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
931 provides A list of symbols that this package provides.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
932 requires A list of packages that this package requires.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
933 type Can be either \"regular\" or \"single-file\".
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
934
2151
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
935 Optional argument ARG is a prefix arg. Without a value, ie, just
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
936 doing `C-u M-x package-get-info' will insert the information at point
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
937 in the current buffer using a local package list.
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
938
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
939 ARG can also be given a value of 2 or 3. If 2, use a remote package
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
940 list, displaying the information in the minubuffer. If 3, use a remote
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
941 package list and insert the information at point in the current buffer.
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
942
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
943 If optional argument REMOTE is non-nil use a package list from a
2151
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
944 remote site.
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
945
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
946 To use a remote package list, either via the prefix argument ARG or
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
947 via the REMOTE argument `package-get-remote' must be non-nil. If
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
948 `package-get-remote' is nil, the local package list will be used.
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
949
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
950 If this function is called interactively it will display INFORMATION
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
951 in the minibuffer."
2151
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
952 (interactive "i\ni\np")
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
953 (if (and package-get-remote
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
954 (or (eq arg 2)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
955 (eq arg 3)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
956 remote))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
957 (package-get-require-base t)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
958 (package-get-require-base nil))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
959 (let ((all-pkgs package-get-base)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
960 (package (or package
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
961 (intern (completing-read
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
962 "Package: "
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
963 (package-get-info-name-array) nil t))))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
964 (information (or information
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
965 (intern (completing-read
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
966 "Info: "
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
967 package-get-info-info-array nil t))))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
968 info)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
969 (loop until (equal package (caar all-pkgs))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
970 do (setq all-pkgs (cdr all-pkgs))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
971 do (if (not all-pkgs)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
972 (error 'invalid-argument
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
973 (format "%s is not a valid package" package))))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
974 (setq info (plist-get (cadar all-pkgs) information))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
975 (if (interactive-p)
2151
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
976 (if (or (eq arg 3)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
977 (eq arg 4))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
978 (insert (format "%s" info))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
979 (if (package-get-key package :version)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
980 (message "%s" info)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
981 (message "%s (Package: %s is not installed)" info package)))
2151
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
982 info)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 ;;;###autoload
1832
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
985 (defun package-get-list-packages-where (item field &optional arg)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
986 "Return a list of packages that fulfill certain criteria.
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
987
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
988 Argument ITEM, a symbol, is what you want to check for. ITEM must be a
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
989 symbol even when it doesn't make sense to be a symbol \(think, searching
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
990 maintainers, descriptions, etc\). The function will convert the symbol
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
991 to a string if a string is what is needed. The downside to this is that
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
992 ITEM can only ever be a single word.
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
993
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
994 Argument FIELD, a symbol, is the field to check in. You can specify
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
995 any one of:
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
996
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
997 Field Sane or Allowable Content
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
998 description any single word
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
999 category `standard' or `mule'
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1000 maintainer any single word
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1001 build-date yyyy-mm-dd
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1002 date yyyy-mm-dd
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1003 type `regular' or `single'
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1004 requires any package name
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1005 provides any symbol
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1006 priority `low', `medium', or `high'
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1007
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1008 Optional Argument ARG, a prefix arg, insert output at point in the
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1009 current buffer."
2151
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1010 (interactive
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1011 (list (intern (read-string "List packages that contain (text): "))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1012 (intern (completing-read "in their package-info field (completion available): "
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1013 '(("description" . description)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1014 ("category" . category)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1015 ("maintainer" . maintainer)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1016 ("build-date" . build-date)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1017 ("date" . date)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1018 ("type" . type)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1019 ("requires" . requires)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1020 ("provides" . provides)
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1021 ("priority" . priority)) nil t))
f33f1487208d [xemacs-hg @ 2004-06-25 21:24:36 by youngs]
youngs
parents: 1937
diff changeset
1022 current-prefix-arg))
1832
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1023 (package-get-require-base nil)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1024 (let ((pkgs package-get-base)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1025 (strings '(description category maintainer build-date date))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1026 (symbols '(type requires provides priority))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1027 results)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1028 (cond ((memq field strings)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1029 (setq item (symbol-name item))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1030 (while pkgs
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1031 (when (string-match item (package-get-info (caar pkgs) field))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1032 (setq results (push (caar pkgs) results)))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1033 (setq pkgs (cdr pkgs))))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1034 ((memq field symbols)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1035 (if (or (eq field 'type)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1036 (eq field 'priority))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1037 (while pkgs
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1038 (when (eq item (package-get-info (caar pkgs) field))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1039 (setq results (push (caar pkgs) results)))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1040 (setq pkgs (cdr pkgs)))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1041 (while pkgs
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1042 (when (memq item (package-get-info (caar pkgs) field))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1043 (setq results (push (caar pkgs) results)))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1044 (setq pkgs (cdr pkgs)))))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1045 (t
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1046 (error 'wrong-type-argument field)))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1047 (if (interactive-p)
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1048 (if arg
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1049 (insert (format "%s" results))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1050 (message "%s" results)))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1051 results))
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1052
5d8dcaecc32b [xemacs-hg @ 2003-12-19 11:24:58 by youngs]
youngs
parents: 1563
diff changeset
1053 ;;;###autoload
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 (defun package-get (package &optional version conflict install-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 "Fetch PACKAGE from remote site.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 Optional arguments VERSION indicates which version to retrieve, nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 means most recent version. CONFLICT indicates what happens if the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 package is already installed. Valid values for CONFLICT are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 'always always retrieve the package even if it is already installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 'never do not retrieve the package if it is installed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 INSTALL-DIR, if non-nil, specifies the package directory where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 fetched packages should be installed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1064 The value of `package-get-base' is used to determine what files should
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 be retrieved. The value of `package-get-remote' is used to determine
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1066 where a package should be retrieved from.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 Once the package is retrieved, its md5 checksum is computed. If that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 sum does not match that stored in `package-get-base' for this version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 of the package, an error is signalled.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 Returns `t' upon success, the symbol `error' if the package was
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 successfully installed but errors occurred during initialization, or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 `nil' upon error."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 (interactive (package-get-interactive-package-query nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 (catch 'skip-update
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 (let* ((this-package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 (package-get-info-find-package package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 package) version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 (latest (package-get-info-prop this-package 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 (installed (package-get-key package :version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 (found nil)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1084 (search-dir package-get-remote)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 (base-filename (package-get-info-prop this-package 'filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 (package-status t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 filenames full-package-filename)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1088 (if (and (equal (package-get-info package 'category) "mule")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1089 (not (featurep 'mule)))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1090 (error 'invalid-state
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1091 "Mule packages can't be installed with a non-Mule XEmacs"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 (if (null this-package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 (if package-get-remote
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1094 (error 'search-failed
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1095 (format "Couldn't find package %s with version %s"
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1096 package version))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1097 (error 'syntax-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1098 "No download site or local package location specified.")))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 (if (null base-filename)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1100 (error 'syntax-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1101 (format "No filename associated with package %s, version %s"
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1102 package version)))
1378
69a674f5861f [xemacs-hg @ 2003-03-24 16:30:55 by youngs]
youngs
parents: 1374
diff changeset
1103 (setq install-dir (package-admin-get-install-dir package install-dir))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 ;; If they asked for the latest using version=nil, don't get an older
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 ;; version than we already have.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 (if installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 (if (> (if (stringp installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 (string-to-number installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 (if (stringp latest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 (string-to-number latest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 latest))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 (if (not (null version))
825
eb3bc15a6e0f [xemacs-hg @ 2002-05-02 14:35:28 by youngs]
youngs
parents: 824
diff changeset
1115 (warn "Installing %s package version %s, you had a newer version %s"
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1116 package latest installed)
825
eb3bc15a6e0f [xemacs-hg @ 2002-05-02 14:35:28 by youngs]
youngs
parents: 824
diff changeset
1117 (warn "Skipping %s package, you have a newer version %s"
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1118 package installed)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 (throw 'skip-update t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 ;; Contrive a list of possible package filenames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 ;; Ugly. Is there a better way to do this?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 (setq filenames (cons base-filename nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 (if (string-match "^\\(..*\\)\.tar\.gz$" base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 (setq filenames (append filenames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 (list (concat (match-string 1 base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 ".tgz")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 (setq version latest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 (unless (and (eq conflict 'never)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 (package-get-installedp package version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 ;; Find the package from the search list in package-get-remote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 ;; and copy it into the staging directory. Then validate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 ;; the checksum. Finally, install the package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 (catch 'done
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1136 (let (search-filenames host dir current-filename dest-filename)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 ;; In each search directory ...
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1138 (when search-dir
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1139 (setq host (car search-dir)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1140 dir (car (cdr search-dir))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1141 search-filenames filenames)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 ;; Look for one of the possible package filenames ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 (while search-filenames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 (setq current-filename (car search-filenames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 dest-filename (package-get-staging-dir current-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 ;; No host means look on the current system.
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1149 ((null host)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1150 (setq full-package-filename
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1151 (substitute-in-file-name
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1152 (expand-file-name current-filename
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1153 (file-name-as-directory dir)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 ;; If it's already on the disk locally, and the size is
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1156 ;; correct
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1157 ((and (file-exists-p dest-filename)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1158 (eq (nth 7 (file-attributes dest-filename))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1159 (package-get-info package 'size)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1160 (setq full-package-filename dest-filename))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 ;; If the file exists on the remote system ...
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1163 ((file-exists-p (package-get-remote-filename
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1164 search-dir current-filename))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1165 ;; Get it
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1166 (setq full-package-filename dest-filename)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1167 (message "Retrieving package `%s' ..."
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1168 current-filename)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1169 (sit-for 0)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1170 (copy-file (package-get-remote-filename search-dir
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1171 current-filename)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1172 full-package-filename t)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 ;; If we found it, we're done.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 (if (and full-package-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 (file-exists-p full-package-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 (throw 'done nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 ;; Didn't find it. Try the next possible filename.
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1179 (setq search-filenames (cdr search-filenames))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 (if (or (not full-package-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 (not (file-exists-p full-package-filename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 (if package-get-remote
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1184 (error 'search-failed
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1185 (format "Unable to find file %s" base-filename))
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1186 (error 'syntax-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1187 "No download sites or local package locations specified.")))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 ;; Validate the md5 checksum
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 ;; Doing it with XEmacs removes the need for an external md5 program
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 (message "Validating checksum for `%s'..." package) (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 (with-temp-buffer
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1192 (insert-file-contents-literally full-package-filename)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 (if (not (string= (md5 (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 (package-get-info-prop this-package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 'md5sum)))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1196 (progn
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1197 (delete-file full-package-filename)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1198 (error 'process-error
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1199 (format "Package %s does not match md5 checksum %s has been deleted"
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
1200 base-filename full-package-filename)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 (package-admin-delete-binary-package package install-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 (message "Installing package `%s' ..." package) (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 (let ((status
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 (package-admin-add-binary-package full-package-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 install-dir)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 (if (= status 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 ;; clear messages so that only messages from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 ;; package-get-init-package are seen, below.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 (clear-message)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 (if (package-get-init-package (package-admin-get-lispdir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214 install-dir package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 (progn
628
e545f3ec2337 [xemacs-hg @ 2001-07-14 08:42:16 by youngs]
youngs
parents: 502
diff changeset
1216 (run-hook-with-args 'package-install-hook package install-dir)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217 (message "Added package `%s'" package)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1218 (sit-for 0))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 ;; display message only if there isn't already one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 (if (not (current-message))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 (message "Added package `%s' (errors occurred)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 package)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1225 (sit-for 0)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 (if package-status
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1227 (setq package-status 'errors)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 (message "Installation of package %s failed." base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 (switch-to-buffer package-admin-temp-buffer)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1231 (delete-file full-package-filename)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1232 (setq package-status nil)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 (setq found t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 (if (and found package-get-remove-copy)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 (delete-file full-package-filename))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1236 package-status)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 (defun package-get-info-find-package (which name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239 "Look in WHICH for the package called NAME and return all the info
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 associated with it. See `package-get-base' for info on the format
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241 returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 To access fields returned from this, use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 `package-get-info-version' to return information about particular a
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1245 version. Use `package-get-info-find-prop' to find particular property
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 from a version returned by `package-get-info-version'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 (interactive "xPackage list: \nsPackage Name: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 (if which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 (if (eq (caar which) name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 (cdar which)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 (if (cdr which)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 (package-get-info-find-package (cdr which) name)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 (defun package-get-info-version (package version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 "In PACKAGE, return the plist associated with a particular VERSION of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 package. PACKAGE is typically as returned by
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1257 `package-get-info-find-package'. If VERSION is nil, then return the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 first (aka most recent) version. Use `package-get-info-find-prop'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 to retrieve a particular property from the value returned by this."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 (interactive (package-get-interactive-package-query t t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 (while (and version package (not (string= (plist-get (car package) 'version) version)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 (setq package (cdr package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 (if package (car package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 (defun package-get-info-prop (package-version property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 "In PACKAGE-VERSION, return the value associated with PROPERTY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 PACKAGE-VERSION is typically returned by `package-get-info-version'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268 and PROPERTY is typically (although not limited to) one of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269 following:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 version - version of this package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 provides - list of symbols provided
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273 requires - list of symbols that are required.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 These in turn are provided by other packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 size - size of the bundled package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 md5sum - computed md5 checksum"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 (interactive "xPackage Version: \nSProperty")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 (plist-get package-version property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 (defun package-get-info-version-prop (package-list package version property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 "In PACKAGE-LIST, search for PACKAGE with this VERSION and return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 PROPERTY value."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 (package-get-info-prop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 (package-get-info-find-package package-list package) version) property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 (defun package-get-staging-dir (filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 "Return a good place to stash FILENAME when it is retrieved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289 Use `package-get-dir' for directory to store stuff.
629
a6c89d799f00 [xemacs-hg @ 2001-07-15 08:18:59 by adrian]
adrian
parents: 628
diff changeset
1290 Creates `package-get-dir' if it doesn't exist."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 (interactive "FPackage filename: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 (if (not (file-exists-p package-get-dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 (make-directory package-get-dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294 (expand-file-name
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
1295 (file-name-nondirectory (or (and-fboundp 'efs-ftp-path
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
1296 (nth 2 (efs-ftp-path filename)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 (file-name-as-directory package-get-dir)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 (defun package-get-remote-filename (search filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 "Return FILENAME as a remote filename.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 It first checks if FILENAME already is a remote filename. If it is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 not, then it uses the (car search) as the remote site-name and the (cadr
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 search) as the remote-directory and concatenates filename. In other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 words
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306 site-name:remote-directory/filename.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 If (car search) is nil, (cadr search is interpreted as a local directory).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309 "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 (if (file-remote-p filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 (let ((dir (cadr search)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 (concat (when (car search)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 (concat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 (if (string-match "@" (car search))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 "/"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 "/anonymous@")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 (car search) ":"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 (if (string-match "/$" dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 dir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 (concat dir "/"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 filename))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 (defun package-get-installedp (package version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 "Determine if PACKAGE with VERSION has already been installed.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1326 I'm not sure if I want to do this by searching directories or checking
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 some built in variables. For now, use packages-package-list."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 ;; Use packages-package-list which contains name and version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 (equal (plist-get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 (package-get-info-find-package packages-package-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 package) ':version)
1368
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
1332 (if (floatp version)
1aba3abebad6 [xemacs-hg @ 2003-03-21 01:19:37 by adrian]
adrian
parents: 1365
diff changeset
1333 version
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 1111
diff changeset
1334 (string-to-number version))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 (defun package-get-package-provider (sym &optional force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338 "Search for a package that provides SYM and return the name and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 version. Searches in `package-get-base' for SYM. If SYM is a
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1340 consp, then it must match a corresponding (provide (SYM VERSION)) from
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 the package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 If FORCE-CURRENT is non-nil make sure the database is up to date. This might
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 lead to Emacs accessing remote sites."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 (interactive "SSymbol: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 (package-get-require-base force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 (let ((packages package-get-base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 (done nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 (found nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 (while (and (not done) packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 (let* ((this-name (caar packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 (this-package (cdr (car packages)))) ;strip off package name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 (while (and (not done) this-package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 (if (or (eq this-name sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 (eq (cons this-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 (package-get-info-prop (car this-package) 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 (member sym
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 (package-get-info-prop (car this-package) 'provides)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 (progn (setq done t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 (setq found
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 (list (caar packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 (package-get-info-prop (car this-package) 'version))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 (setq this-package (cdr this-package)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 (setq packages (cdr packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 (when (interactive-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 (if found
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 (message "%S" found)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 (message "No appropriate package found")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 found))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 (defun package-get-ever-installed-p (pkg &optional notused)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 (string-match "-package$" (symbol-name pkg))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1374 (custom-initialize-set
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1375 pkg
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1376 (if (package-get-info-find-package
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1377 packages-package-list
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 (intern (substring (symbol-name pkg) 0 (match-beginning 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 (provide 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 ;;; package-get.el ends here