annotate lisp/package-get.el @ 793:e38acbeb1cae

[xemacs-hg @ 2002-03-29 04:46:17 by ben] lots o' fixes etc/ChangeLog: New file. Separated out all entries for etc/ into their own ChangeLog. Includes entries for the following files: etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad, etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL, etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS, etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL, etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se, etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh, etc/custom/example-themes/europe-theme.el, etc/custom/example-themes/ex-custom-file, etc/custom/example-themes/example-theme.el, etc/e/eterm.ti, etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1, etc/gnuserv.README, etc/package-index.LATEST.gpg, etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm, etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs, etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E, etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm, etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm, etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar, etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1, etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL, etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el, etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\* unicode/unicode-consortium/8859-16.TXT: New file. mule/english.el: Define this charset now, since a bug was fixed that formerly prevented it. mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be integers. Makefile.in.in: Always include gui.c, to fix compile error when TTY-only. EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo(). Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate nearly all uses of Lisp_String * in favor of Lisp_Object, and correct macros so most of them favor Lisp_Object. Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings, but at level `debug' (usually ignored). Use it when instantiating specifiers, so problems can be debugged. Move log-warning-minimum-level into C so that we can optimize ERROR_ME_DEBUG_WARN. Fix warning levels consistent with new definitions. Add default_ and parent fields to char table; not yet implemented. New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as Courier New but less interline spacing, so more lines fit). Increase default frame size on Windows to 50 lines. (If that's too big for the workspace, the frame will be shrunk as necessary.) Fix problem with text files with no newlines (). (Change `convert-eol' coding system to use `nil' for autodetect, consistent with make-coding-system.) Correct compile warnings in vm-limit.c. Fix handling of reverse-direction charsets to avoid errors when opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el. Recode some object printing methods to use write_fmt_string() instead of a fixed buffer and sprintf. Turn on display of png comments as warnings (level `info'), now that they're unobtrusive. Revamped the sound documentation. Fixed bug in redisplay w.r.t. hscroll/truncation/continuation glyphs causing jumping up and down of the lines, since they're bigger than the line size. (It was seen most obviously when there's a horizontal scroll bar, e.g. do C-h a glyph or something like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now.
author ben
date Fri, 29 Mar 2002 04:49:13 +0000
parents 79940b592197
children 0cce4fee510b
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.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Author: Pete Ware <ware@cis.ohio-state.edu>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Heavy-Modifications: Greg Klanderman <greg@alphatech.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Jan Vroonhof <vroonhof@math.ethz.ch>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Keywords: internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
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 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; 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
25 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;;; Synched up with: Not in FSF
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 ;;; Commentary:
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 ;; package-get -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 ;; Retrieve a package and any other required packages from an archive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 ;;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 434
diff changeset
36 ;; Note (JV): Most of this no longer applies!
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 ;; The idea:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 ;; A new XEmacs lisp-only release is generated with the following steps:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; 1. The maintainer runs some yet to be written program that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; generates all the dependency information. This should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 ;; determine all the require and provide statements and associate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 ;; them with a package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 ;; 2. All the packages are then bundled into their own tar balls
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;; (or whatever format)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ;; 3. Maintainer automatically generates a new `package-get-base'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ;; data structure which contains information such as the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ;; package name, the file to be retrieved, an md5 checksum,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ;; etc (see `package-get-base').
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ;; 4. The maintainer posts an announcement with the new version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ;; of `package-get-base'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 ;; 5. A user/system manager saves this posting and runs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 ;; `package-get-update' which uses the previously saved list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 ;; of packages, `package-get-here' that the user/site
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 ;; wants to determine what new versions to download and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 ;; install.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 ;; A user/site manager can generate a new `package-get-here' structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 ;; by using `package-get-setup' which generates a customize like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 ;; interface to the list of packages. The buffer looks something
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 ;; like:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;; gnus - a mail and news reader
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ;; [] Always install
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 ;; [] Needs updating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 ;; [] Required by other [packages]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 ;; version: 2.0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 ;; vm - a mail reader
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 ;; [] Always install
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 ;; [] Needs updating
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
72 ;; [] Required by other [packages]
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 ;; Where `[]' indicates a toggle box
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 ;; - Clicking on "Always install" puts this into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ;; `package-get-here' list. "Needs updating" indicates a new
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 ;; version is available. Anything already in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 ;; `package-get-here' has this enabled.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 ;; - "Required by other" means some other packages are going to force
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 ;; this to be installed. Clicking on [packages] gives a list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 ;; of packages that require this.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
83 ;;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 ;; The `package-get-base' should be installed in a file in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 ;; `data-directory'. The `package-get-here' should be installed in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ;; site-lisp. Both are then read at run time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ;; TODO:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;; - Implement `package-get-setup'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ;; - Actually put `package-get-base' and `package-get-here' into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 ;; files that are read.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 ;; - Allow users to have their own packages that they want installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 ;; in ~/.xemacs/.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 ;; - SOMEONE needs to write the programs that generate the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 ;; provides/requires database and makes it into a lisp data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 ;; structure suitable for `package-get-base'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 ;; - Handle errors such as no package providing a required symbol.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 ;; - Tie this into the `require' function to download packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 ;; transparently.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 ;;; Change Log
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 ;;; Code:
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 (require 'package-admin)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 ;; (require 'package-get-base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (defgroup package-tools nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 "Tools to manipulate packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 :group 'emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 (defgroup package-get nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 "Automatic Package Fetcher and Installer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 :prefix "package-get"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 :group 'package-tools)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
117 ;;;###autoload
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 (defvar package-get-base nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 "List of packages that are installed at this site.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 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
121 a plist containing information about the package. Typical fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 kept in the plist are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 version - version of this package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 provides - list of symbols provided
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 requires - list of symbols that are required.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 These in turn are provided by other packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 filename - name of the file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 size - size of the file (aka the bundled package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 md5sum - computed md5 checksum
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 description - What this package is for.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 type - Whether this is a 'binary (default) or 'single file package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 More fields may be added as needed. An example:
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 '(
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 (name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 (version \"<version 2>\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 file \"filename\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 description \"what this package is about.\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 provides (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 requires (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 size <integer-bytes>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 md5sum \"<checksum\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 type single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 (version \"<version 1>\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 file \"filename\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 description \"what this package is about.\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 provides (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 requires (<list>)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 size <integer-bytes>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 md5sum \"<checksum\"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 type single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 ...
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 For version information, it is assumed things are listed in most
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 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
161 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
162 one version of a package available.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 (defcustom package-get-dir (temp-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 "*Where to store temporary files for staging."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 :tag "Temporary directory"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 :type 'directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 (define-widget 'host-name 'string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 "A Host name."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 :tag "Host")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 (defcustom package-get-remote nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 "*List of remote sites to contact for downloading packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 List format is '(site-name directory-on-site). Each site is tried in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 order until the package is found. As a special case, `site-name' can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 `nil', in which case `directory-on-site' is treated as a local directory."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 :tag "Package repository"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 :type '(repeat (choice (list :tag "Local" (const :tag "Local" nil) directory )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 (list :tag "Remote" host-name directory) ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 (defcustom package-get-download-sites
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 '(
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 ;; North America
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
188 ("Pre-Releases" "ftp.xemacs.org" "pub/xemacs/beta/experimental/packages")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 ("xemacs.org" "ftp.xemacs.org" "pub/xemacs/packages")
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
190 ("crc.ca (Canada)" "ftp.crc.ca" "pub/packages/editors/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
191 ("ualberta.ca (Canada)" "sunsite.ualberta.ca" "pub/Mirror/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
192 ("uiuc.edu (United States)" "uiarchive.uiuc.edu" "pub/packages/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
193 ("unc.edu (United States)" "metalab.unc.edu" "pub/packages/editors/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
194 ("utk.edu (United States)" "ftp.sunsite.utk.edu" "pub/xemacs/packages")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 ;; South America
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
197 ("unicamp.br (Brazil)" "ftp.unicamp.br" "pub/xemacs/packages")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 ;; Europe
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
200 ("tuwien.ac.at (Austria)" "gd.tuwien.ac.at" "editors/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
201 ("auc.dk (Denmark)" "sunsite.auc.dk" "pub/emacs/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
202 ("doc.ic.ac.uk (England)" "sunsite.doc.ic.ac.uk" "packages/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
203 ("funet.fi (Finland)" "ftp.funet.fi" "pub/mirrors/ftp.xemacs.org/pub/tux/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
204 ("cenatls.cena.dgac.fr (France)" "ftp.cenatls.cena.dgac.fr" "Emacs/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
205 ("pasteur.fr (France)" "ftp.pasteur.fr" "pub/computing/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
206 ("tu-darmstadt.de (Germany)" "ftp.tu-darmstadt.de" "pub/editors/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
207 ("kfki.hu (Hungary)" "ftp.kfki.hu" "pub/packages/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
208 ("eunet.ie (Ireland)" "ftp.eunet.ie" "mirrors/ftp.xemacs.org/pub/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
209 ("uniroma2.it (Italy)" "ftp.uniroma2.it" "unix/misc/dist/XEMACS/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
210 ("uio.no (Norway)" "sunsite.uio.no" "pub/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
211 ("icm.edu.pl (Poland)" "ftp.icm.edu.pl" "pub/unix/editors/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
212 ("srcc.msu.su (Russia)" "ftp.srcc.msu.su" "mirror/ftp.xemacs.org/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
213 ("sunet.se (Sweden)" "ftp.sunet.se" "pub/gnu/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
214 ("cnlab-switch.ch (Switzerland)" "sunsite.cnlab-switch.ch" "mirror/xemacs/packages")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 ;; Asia
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
217 ("aist.go.jp (Japan)" "ring.aist.go.jp" "pub/text/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
218 ("asahi-net.or.jp (Japan)" "ring.asahi-net.or.jp" "pub/text/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
219 ("dti.ad.jp (Japan)" "ftp.dti.ad.jp" "pub/unix/editor/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
220 ("jaist.ac.jp (Japan)" "ftp.jaist.ac.jp" "pub/GNU/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
221 ("nucba.ac.jp (Japan)" "mirror.nucba.ac.jp" "mirror/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
222 ("sut.ac.jp (Japan)" "sunsite.sut.ac.jp" "pub/archives/packages/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
223 ("tsukuba.ac.jp (Japan)" "ftp.netlab.is.tsukuba.ac.jp" "pub/GNU/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
224 ("kreonet.re.kr (Korea)" "ftp.kreonet.re.kr" "pub/tools/emacs/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
225 ("nctu.edu.tw (Taiwan)" "coda.nctu.edu.tw" "Editors/xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
226
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
227 ;; Africa
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
228 ("sun.ac.za (South Africa)" "ftp.sun.ac.za" "xemacs/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
229
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
230 ;; Middle East
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
231 ("isu.net.sa (Saudi Arabia)" "ftp.isu.net.sa" "pub/mirrors/ftp.xemacs.org/packages")
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
232
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
233 ;; Australia
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
234 ("aarnet.edu.au (Australia)" "mirror.aarnet.edu.au" "pub/xemacs/packages")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 "*List of remote sites available for downloading packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 List format is '(site-description site-name directory-on-site).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 SITE-DESCRIPTION is a textual description of the site. SITE-NAME
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 is the internet address of the download site. DIRECTORY-ON-SITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 is the directory on the site in which packages may be found.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 This variable is used to initialize `package-get-remote', the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 variable actually used to specify package download sites."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 :tag "Package download sites"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
244 :type '(repeat (list (string :tag "Name") host-name directory))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 (defcustom package-get-remove-copy t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 "*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
249 copy. Otherwise, keep it around."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 ;; #### it may make sense for this to be a list of names.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 ;; #### also, should we rename "*base*" to "*index*" or "*db*"?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 ;; "base" is a pretty poor name.
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
256 (defcustom package-get-base-filename "package-index.LATEST.gpg"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 "*Name of the default package-get database file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 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
259 with respect to `package-get-remote', or an absolute path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 :type 'file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 (defvar package-get-user-index-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 (paths-construct-path (list user-init-directory package-get-base-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 "Name for the user-specific location of the package-get database file.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 (defcustom package-get-always-update nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 "*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
269 Otherwise respect the `force-current' argument of `package-get-require-base'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
273 (defcustom package-get-require-signed-base-updates nil
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 "*If set to a non-nil value, require explicit user confirmation for updates
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 to the package-get database which cannot have their signature verified via PGP.
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
276 When nil, no PGP verification will be done."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 :group 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
280 (defvar package-entries-are-signed nil
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
281 "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
282
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
283 (defvar package-get-continue-update-base nil
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
284 "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
285
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 (defvar package-get-was-current nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 "Non-nil we did our best to fetch a current database.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 ;Shouldn't this be in package-ui?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 (defun package-get-download-menu ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 "Build the `Add Download Site' menu."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 (mapcar (lambda (site)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 (vector (car site)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 `(if (member (quote ,(cdr site))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 package-get-remote)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 (setq package-get-remote
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
299 (delete (quote ,(cdr site))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
300 package-get-remote))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 (package-ui-add-site (quote ,(cdr site))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 :style 'toggle
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 :selected `(member (quote ,(cdr site))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 package-get-remote)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 package-get-download-sites))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 (defun package-get-require-base (&optional force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 "Require that a package-get database has been loaded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 If the optional FORCE-CURRENT argument or the value of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 `package-get-always-update' is Non-nil, try to update the database
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 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
313 if available and remote access is never done.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 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
316 and remote access is likely in the near future."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 (setq force-current (or force-current package-get-always-update))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 (unless (and (boundp 'package-get-base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 (or (not force-current) package-get-was-current))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 (package-get-update-base nil force-current))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 (if (or (not (boundp 'package-get-base))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 (not package-get-base))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 (error "Package-get database not loaded")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 (setq package-get-was-current force-current)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 (defconst package-get-pgp-signed-begin-line "^-----BEGIN PGP SIGNED MESSAGE-----"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 "Text for start of PGP signed messages.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 (defconst package-get-pgp-signature-begin-line "^-----BEGIN PGP SIGNATURE-----"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 "Text for beginning of PGP signature.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 (defconst package-get-pgp-signature-end-line "^-----END PGP SIGNATURE-----"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 "Text for end of PGP signature.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 (defun package-get-update-base-entry (entry)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 "Update an entry in `package-get-base'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 (let ((existing (assq (car entry) package-get-base)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (if existing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 (setcdr existing (cdr entry))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 (setq package-get-base (cons entry package-get-base))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 (package-get-custom-add-entry (car entry) (car (cdr entry))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 (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
344 "Locate an existing FILE with respect to `package-get-remote'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 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
346 If optional argument NIL-IF-NOT-FOUND is non-nil, return nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 if FILE can not be located.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 If NO-REMOTE is non-nil never search remote locations."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 (if (file-name-absolute-p file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 (let ((entries package-get-remote)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 (expanded nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 (while entries
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 (unless (and no-remote (caar entries))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 (let ((expn (package-get-remote-filename (car entries) file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 (if (and expn (file-exists-p expn))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 (setq entries nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 expanded expn))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 (setq entries (cdr entries)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 (or expanded
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 (and (not nil-if-not-found)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 file)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 (defun package-get-locate-index-file (no-remote)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 "Locate the package-get index file. Do not return remote paths if NO-REMOTE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 is non-nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 (or (package-get-locate-file package-get-base-filename t no-remote)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 (if (file-exists-p package-get-user-index-filename)
678
8e8a7b205142 [xemacs-hg @ 2001-11-29 17:00:38 by youngs]
youngs
parents: 629
diff changeset
369 package-get-user-index-filename)
8e8a7b205142 [xemacs-hg @ 2001-11-29 17:00:38 by youngs]
youngs
parents: 629
diff changeset
370 (locate-data-file package-get-base-filename)
8e8a7b205142 [xemacs-hg @ 2001-11-29 17:00:38 by youngs]
youngs
parents: 629
diff changeset
371 (error "Can't locate a package index file.")))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 (defun package-get-maybe-save-index (filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 "Offer to save the current buffer as the local package index file,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 if different."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 (let ((location (package-get-locate-index-file t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 (unless (and filename (equal filename location))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 (unless (and location
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 (equal (md5 (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 (with-temp-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 (insert-file-contents-literally location)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 (md5 (current-buffer)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 (unless (and location (file-writable-p location))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 (setq location package-get-user-index-filename))
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
385 (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
386 (let ((coding-system-for-write 'binary))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
387 (write-file location)))))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
388
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 (defun package-get-update-base (&optional db-file force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 "Update the package-get database file with entries from DB-FILE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 Unless FORCE-CURRENT is non-nil never try to update the database."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 (let ((dflt (package-get-locate-index-file nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 (list (read-file-name "Load package-get database: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 (file-name-directory dflt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 dflt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 (file-name-nondirectory dflt)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 (setq db-file (expand-file-name (or db-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 (package-get-locate-index-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 (not force-current)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 (if (not (file-exists-p db-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 (error "Package-get database file `%s' does not exist" db-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 (if (not (file-readable-p db-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (error "Package-get database file `%s' not readable" db-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 (let ((buf (get-buffer-create "*package database*")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 (set-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 (erase-buffer buf)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
413 (insert-file-contents-literally db-file)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 (package-get-update-base-from-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 (if (file-remote-p db-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 (package-get-maybe-save-index db-file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 (kill-buffer buf))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (defun package-get-update-base-from-buffer (&optional buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 "Update the package-get database with entries from BUFFER.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 BUFFER defaults to the current buffer. This command can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 used interactively, for example from a mail or news buffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 (setq buf (or buf (current-buffer)))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
426 (let (content-beg content-end ;beg end
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
427 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 (set-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 (setq content-beg (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 (setq content-end (save-excursion (goto-char (point-max)) (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (when (re-search-forward package-get-pgp-signed-begin-line nil t)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
434 ;(setq beg (match-beginning 0))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 (setq content-beg (match-end 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (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
437 (setq content-end (match-beginning 0))
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
438 (setq package-entries-are-signed t))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (when (re-search-forward package-get-pgp-signature-end-line nil t)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
440 ;(setq end (point))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
441 )
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
442 (setq package-get-continue-update-base t)
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
443 (if package-get-require-signed-base-updates
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
444 (if package-entries-are-signed
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
445 (progn
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
446 (setq package-get-continue-update-base nil)
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
447 (autoload 'mc-setversion "mc-setversion")
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
448 (with-fboundp 'mc-setversion
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
449 (if-boundp 'exec-suffix-list
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
450 (or
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
451 (cond ((locate-file "gpg" exec-path exec-suffix-list)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
452 (mc-setversion "gpg"))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
453 ((locate-file "pgpe" exec-path exec-suffix-list)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
454 (mc-setversion "5.0"))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
455 ((locate-file "pgp" exec-path exec-suffix-list)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
456 (mc-setversion "2.6")))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
457 (error "Can't find a suitable pgp executable"))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
458 (error 'unimplemented "`apel' package unavailable")))
682
e558c78d22f8 [xemacs-hg @ 2001-12-02 15:27:37 by youngs]
youngs
parents: 681
diff changeset
459 (autoload 'mc-verify "mc-toplev")
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
460 (declare-fboundp (mc-verify))
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
461 (setq package-get-continue-update-base t))
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
462 (if (yes-or-no-p
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
463 "Package Index is not PGP signed. Continue anyway? ")
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
464 (setq package-get-continue-update-base t)
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
465 (error "Package database not updated")
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
466 (setq package-get-continue-update-base nil))))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 434
diff changeset
467 ;; ToDo: We should call package-get-maybe-save-index on the region
681
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
468 (if package-get-continue-update-base
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
469 (progn
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
470 (package-get-update-base-entries content-beg content-end)
c00aa0615465 [xemacs-hg @ 2001-12-02 07:27:14 by youngs]
youngs
parents: 678
diff changeset
471 (message "Updated package-get database"))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
473 (defun package-get-update-base-entries (start end)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 "Update the package-get database with the entries found between
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
475 START and END in the current buffer."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (save-excursion
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
477 (goto-char start)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 (if (not (re-search-forward "^(package-get-update-base-entry" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (error "Buffer does not contain package-get database entries"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 (let ((count 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 (while (and (< (point) end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 (re-search-forward "^(package-get-update-base-entry" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 (let ((entry (read (current-buffer))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 (if (or (not (consp entry))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 (not (eq (car entry) 'package-get-update-base-entry)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 (error "Invalid package-get database entry found"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 (package-get-update-base-entry
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 (car (cdr (car (cdr entry)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 (setq count (1+ count))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 (message "Got %d package-get database entries" count))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (defun package-get-save-base (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 "Write the package-get database to FILE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 Note: This database will be unsigned of course."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 (interactive "FSave package-get database to: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 (let ((buf (get-buffer-create "*package database*")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 (set-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (erase-buffer buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 (let ((entries package-get-base) entry plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 (insert ";; Package Index file -- Do not edit manually.\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 (insert ";;;@@@\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 (while entries
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 (setq entry (car entries))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 (setq plist (car (cdr entry)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 (insert "(package-get-update-base-entry (quote\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 (insert (format "(%s\n" (symbol-name (car entry))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 (while plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 (insert (format " %s%s %S\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 (if (eq plist (car (cdr entry))) "(" " ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 (symbol-name (car plist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 (car (cdr plist))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 (setq plist (cdr (cdr plist))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 (insert "))\n))\n;;;@@@\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (setq entries (cdr entries))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 (insert ";; Package Index file ends here\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 (write-region (point-min) (point-max) file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 (kill-buffer buf))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (defun package-get-interactive-package-query (get-version package-symbol)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 "Perform interactive querying for package and optional version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 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
530 a symbol instead of a string if PACKAGE-SYMBOL is non-nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 The return value is suitable for direct passing to `interactive'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 (package-get-require-base t)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
533 (let ((table (mapcar #'(lambda (item)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
534 (let ((name (symbol-name (car item))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
535 (cons name name)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
536 package-get-base))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
537 package package-symbol default-version version)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 (setq package (completing-read "Package: " table nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 (setq package-symbol (intern package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 (if get-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 (progn
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
543 (setq default-version
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
544 (package-get-info-prop
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 (package-get-info-find-package package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 package-symbol) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 (while (string=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 (setq version (read-string "Version: " default-version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 (if package-symbol
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 (list package-symbol version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 (list package version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 (if package-symbol
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 (list package-symbol)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
559 (list package))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 (defun package-get-delete-package (package &optional pkg-topdir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 "Delete an installation of PACKAGE below directory PKG-TOPDIR.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 PACKAGE is a symbol, not a string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 This is just an interactive wrapper for `package-admin-delete-binary-package'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 (interactive (package-get-interactive-package-query nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 (package-admin-delete-binary-package package pkg-topdir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 (defun package-get-update-all ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 "Fetch and install the latest versions of all currently installed packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 ;; Load a fresh copy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 (catch 'exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 (mapcar (lambda (pkg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 (if (not (package-get (car pkg) nil 'never))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 (throw 'exit nil) ;; Bail out if error detected
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 ))
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 683
diff changeset
580 packages-package-list))
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 683
diff changeset
581 (package-net-update-installed-db))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 (defun package-get-all (package version &optional fetched-packages install-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 "Fetch PACKAGE with VERSION and all other required packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 Uses `package-get-base' to determine just what is required and what
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 package provides that functionality. If VERSION is nil, retrieves
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 latest version. Optional argument FETCHED-PACKAGES is used to keep
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 track of packages already fetched. Optional argument INSTALL-DIR,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 if non-nil, specifies the package directory where fetched packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 should be installed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 Returns nil upon error."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 (interactive (package-get-interactive-package-query t nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 (let* ((the-package (package-get-info-find-package package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 (this-package (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 the-package version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 (this-requires (package-get-info-prop this-package 'requires))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 (catch 'exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 (setq version (package-get-info-prop this-package 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 (unless (package-get-installedp package version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 (if (not (package-get package version nil install-dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 (setq fetched-packages nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 (throw 'exit nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 (setq fetched-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 (append (list package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 (package-get-info-prop this-package 'provides)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 fetched-packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 ;; grab everything that this package requires plus recursively
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 ;; grab everything that the requires require. Keep track
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 ;; in `fetched-packages' the list of things provided -- this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 ;; keeps us from going into a loop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 (while this-requires
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 (if (not (member (car this-requires) fetched-packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 (let* ((reqd-package (package-get-package-provider
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 (car this-requires) t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 (reqd-version (cadr reqd-package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 (reqd-name (car reqd-package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 (if (null reqd-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 (error "Unable to find a provider for %s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 (car this-requires)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 (if (not (setq fetched-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 (package-get-all reqd-name reqd-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 fetched-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 install-dir)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 (throw 'exit nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 (setq this-requires (cdr this-requires)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 fetched-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 (defun package-get-dependencies (packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 "Compute dependencies for PACKAGES.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 Uses `package-get-base' to determine just what is required and what
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 package provides that functionality. Returns the list of packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 required by PACKAGES."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 (let ((orig-packages packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 dependencies provided)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 (while packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 (let* ((package (car packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 (the-package (package-get-info-find-package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 package-get-base package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 (this-package (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 the-package nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 (this-requires (package-get-info-prop this-package 'requires))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 (new-depends (set-difference
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 (mapcar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 #'(lambda (reqd)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 (let* ((reqd-package (package-get-package-provider reqd))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 (reqd-name (car reqd-package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 (if (null reqd-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 (error "Unable to find a provider for %s" reqd))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 reqd-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 this-requires)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 dependencies))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 (this-provides (package-get-info-prop this-package 'provides)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 (setq dependencies
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 (union dependencies new-depends))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 (setq provided
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 (union provided (union (list package) this-provides)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 (setq packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 (union new-depends (cdr packages)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 (set-difference dependencies orig-packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 (defun package-get-load-package-file (lispdir file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 (let (pathname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 (setq pathname (expand-file-name file lispdir))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
674 (with-trapping-errors
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
675 :operation (format "loading package file \"%s\"" pathname)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
676 :error-form nil
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
677 (load pathname t)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
678 t)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 (defun package-get-init-package (lispdir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 "Initialize the package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 This really assumes that the package has never been loaded. Updating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 a newer package can cause problems, due to old, obsolete functions in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 the old package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 Return `t' upon complete success, `nil' if any errors occurred."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 (if (and lispdir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 (file-accessible-directory-p lispdir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 ;; Add lispdir to load-path if it doesn't already exist.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 ;; NOTE: this does not take symlinks, etc., into account.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 (if (let ( (dirs load-path) )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 (catch 'done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 (while dirs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 (if (string-equal (car dirs) lispdir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 (throw 'done nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 (setq dirs (cdr dirs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 (setq load-path (cons lispdir load-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 (if (not (package-get-load-package-file lispdir "auto-autoloads"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 (package-get-load-package-file lispdir "_pkg"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 ))
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 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 (defun package-get (package &optional version conflict install-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 "Fetch PACKAGE from remote site.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 Optional arguments VERSION indicates which version to retrieve, nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 means most recent version. CONFLICT indicates what happens if the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 package is already installed. Valid values for CONFLICT are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 'always always retrieve the package even if it is already installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 'never do not retrieve the package if it is installed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 INSTALL-DIR, if non-nil, specifies the package directory where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 fetched packages should be installed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
719 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
720 be retrieved. The value of `package-get-remote' is used to determine
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 where a package should be retrieved from. The sites are tried in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 order so one is better off listing easily reached sites first.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 Once the package is retrieved, its md5 checksum is computed. If that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 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
726 of the package, an error is signalled.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 Returns `t' upon success, the symbol `error' if the package was
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 successfully installed but errors occurred during initialization, or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 `nil' upon error."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 (interactive (package-get-interactive-package-query nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 (catch 'skip-update
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 (let* ((this-package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 (package-get-info-find-package package-get-base
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 package) version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 (latest (package-get-info-prop this-package 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 (installed (package-get-key package :version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 (this-requires (package-get-info-prop this-package 'requires))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 (found nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 (search-dirs package-get-remote)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 (base-filename (package-get-info-prop this-package 'filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 (package-status t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 filenames full-package-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 (if (null this-package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 (if package-get-remote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 (error "Couldn't find package %s with version %s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 package version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 (error "No download sites or local package locations specified.")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 (if (null base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 (error "No filename associated with package %s, version %s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 package version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 (setq install-dir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 (package-admin-get-install-dir package install-dir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 (or (eq package 'mule-base) (memq 'mule-base this-requires))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 ;; 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
758 ;; version than we already have.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 (if installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 (if (> (if (stringp installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 (string-to-number installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 (if (stringp latest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 (string-to-number latest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 latest))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 (if (not (null version))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
767 (lwarn 'packages
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
768 "Installing %s package version %s, you had a newer version %s"
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
769 package latest installed)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
770 (lwarn 'packages
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
771 "Skipping %s package, you have a newer version %s"
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
772 package installed)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 (throw 'skip-update t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 ;; Contrive a list of possible package filenames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 ;; Ugly. Is there a better way to do this?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 (setq filenames (cons base-filename nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 (if (string-match "^\\(..*\\)\.tar\.gz$" base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 (setq filenames (append filenames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 (list (concat (match-string 1 base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 ".tgz")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 (setq version latest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 (unless (and (eq conflict 'never)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 (package-get-installedp package version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 ;; Find the package from the search list in package-get-remote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 ;; and copy it into the staging directory. Then validate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 ;; the checksum. Finally, install the package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 (catch 'done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 (let (search-filenames current-dir-entry host dir current-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 dest-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 ;; In each search directory ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 (while search-dirs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 (setq current-dir-entry (car search-dirs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 host (car current-dir-entry)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 dir (car (cdr current-dir-entry))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 search-filenames filenames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 ;; Look for one of the possible package filenames ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 (while search-filenames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 (setq current-filename (car search-filenames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 dest-filename (package-get-staging-dir current-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 ;; No host means look on the current system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 ( (null host)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 (setq full-package-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 (substitute-in-file-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 (expand-file-name current-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 (file-name-as-directory dir))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 ;; If it's already on the disk locally, and the size is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 ;; greater than zero ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 ( (and (file-exists-p dest-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 (let (attrs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 ;; file-attributes could return -1 for LARGE files,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 ;; but, hopefully, packages won't be that large.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 (and (setq attrs (file-attributes dest-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 (> (nth 7 attrs) 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 (setq full-package-filename dest-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 ;; If the file exists on the remote system ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 ( (file-exists-p (package-get-remote-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 current-dir-entry current-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 ;; Get it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 (setq full-package-filename dest-filename)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
829 (message "Retrieving package `%s' ..."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 current-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 (copy-file (package-get-remote-filename current-dir-entry
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 current-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 full-package-filename t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 ;; If we found it, we're done.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 (if (and full-package-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 (file-exists-p full-package-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 (throw 'done nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 ;; Didn't find it. Try the next possible filename.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 (setq search-filenames (cdr search-filenames))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 ;; Try looking in the next possible directory ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 (setq search-dirs (cdr search-dirs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 (if (or (not full-package-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 (not (file-exists-p full-package-filename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 (if package-get-remote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 (error "Unable to find file %s" base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 (error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 "No download sites or local package locations specified.")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 ;; Validate the md5 checksum
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 ;; Doing it with XEmacs removes the need for an external md5 program
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 (message "Validating checksum for `%s'..." package) (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 (with-temp-buffer
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
860 (insert-file-contents-literally full-package-filename)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 (if (not (string= (md5 (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 (package-get-info-prop this-package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 'md5sum)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 (error "Package %s does not match md5 checksum" base-filename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 (package-admin-delete-binary-package package install-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 (message "Installing package `%s' ..." package) (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 (let ((status
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 (package-admin-add-binary-package full-package-filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 install-dir)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 (if (= status 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 ;; clear messages so that only messages from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 ;; package-get-init-package are seen, below.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 (clear-message)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 (if (package-get-init-package (package-admin-get-lispdir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 install-dir package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 (progn
628
e545f3ec2337 [xemacs-hg @ 2001-07-14 08:42:16 by youngs]
youngs
parents: 502
diff changeset
880 (run-hook-with-args 'package-install-hook package install-dir)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 (message "Added package `%s'" package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 ;; display message only if there isn't already one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 (if (not (current-message))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 (message "Added package `%s' (errors occurred)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 (if package-status
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 (setq package-status 'errors))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 (message "Installation of package %s failed." base-filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 (switch-to-buffer package-admin-temp-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 (setq package-status nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 (setq found t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 (if (and found package-get-remove-copy)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 (delete-file full-package-filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 package-status
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 (defun package-get-info-find-package (which name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 "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
909 associated with it. See `package-get-base' for info on the format
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 To access fields returned from this, use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 `package-get-info-version' to return information about particular a
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
914 version. Use `package-get-info-find-prop' to find particular property
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 from a version returned by `package-get-info-version'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 (interactive "xPackage list: \nsPackage Name: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 (if which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 (if (eq (caar which) name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 (cdar which)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 (if (cdr which)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 (package-get-info-find-package (cdr which) name)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 (defun package-get-info-version (package version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 "In PACKAGE, return the plist associated with a particular VERSION of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 package. PACKAGE is typically as returned by
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
926 `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
927 first (aka most recent) version. Use `package-get-info-find-prop'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 to retrieve a particular property from the value returned by this."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 (interactive (package-get-interactive-package-query t t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 (while (and version package (not (string= (plist-get (car package) 'version) version)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 (setq package (cdr package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 (if package (car package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 (defun package-get-info-prop (package-version property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 "In PACKAGE-VERSION, return the value associated with PROPERTY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 PACKAGE-VERSION is typically returned by `package-get-info-version'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 and PROPERTY is typically (although not limited to) one of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 following:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 version - version of this package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 provides - list of symbols provided
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 requires - list of symbols that are required.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 These in turn are provided by other packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 size - size of the bundled package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 md5sum - computed md5 checksum"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 (interactive "xPackage Version: \nSProperty")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 (plist-get package-version property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 (defun package-get-info-version-prop (package-list package version property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 "In PACKAGE-LIST, search for PACKAGE with this VERSION and return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 PROPERTY value."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 (package-get-info-prop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 (package-get-info-find-package package-list package) version) property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 (defun package-get-set-version-prop (package-list package version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 property value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 "A utility to make it easier to add a VALUE for a specific PROPERTY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 in this VERSION of a specific PACKAGE kept in the PACKAGE-LIST.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 Returns the modified PACKAGE-LIST. Any missing fields are created."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 (defun package-get-staging-dir (filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 "Return a good place to stash FILENAME when it is retrieved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 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
966 Creates `package-get-dir' if it doesn't exist."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 (interactive "FPackage filename: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 (if (not (file-exists-p package-get-dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 (make-directory package-get-dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 (expand-file-name
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
971 (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
972 (nth 2 (efs-ftp-path filename)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 (file-name-as-directory package-get-dir)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 (defun package-get-remote-filename (search filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 "Return FILENAME as a remote filename.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 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
979 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
980 search) as the remote-directory and concatenates filename. In other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 words
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 site-name:remote-directory/filename.
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 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
985 "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 (if (file-remote-p filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 (let ((dir (cadr search)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 (concat (when (car search)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 (concat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 (if (string-match "@" (car search))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 "/"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 "/anonymous@")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 (car search) ":"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 (if (string-match "/$" dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 dir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 (concat dir "/"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 filename))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 (defun package-get-installedp (package version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 "Determine if PACKAGE with VERSION has already been installed.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1003 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
1004 some built in variables. For now, use packages-package-list."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 ;; Use packages-package-list which contains name and version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 (equal (plist-get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 (package-get-info-find-package packages-package-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 package) ':version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 (if (floatp version) version (string-to-number version))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 (defun package-get-package-provider (sym &optional force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 "Search for a package that provides SYM and return the name and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 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
1015 consp, then it must match a corresponding (provide (SYM VERSION)) from
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 the package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 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
1019 lead to Emacs accessing remote sites."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 (interactive "SSymbol: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 (package-get-require-base force-current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 (let ((packages package-get-base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 (done nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 (found nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 (while (and (not done) packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 (let* ((this-name (caar packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 (this-package (cdr (car packages)))) ;strip off package name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 (while (and (not done) this-package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 (if (or (eq this-name sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 (eq (cons this-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 (package-get-info-prop (car this-package) 'version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 (member sym
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 (package-get-info-prop (car this-package) 'provides)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 (progn (setq done t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 (setq found
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 (list (caar packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 (package-get-info-prop (car this-package) 'version))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 (setq this-package (cdr this-package)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 (setq packages (cdr packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 (when (interactive-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 (if found
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 (message "%S" found)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 (message "No appropriate package found")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 found))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 ;; customize interfaces.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 ;; The group is in this file so that custom loads includes this file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 (defgroup packages nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 "Configure XEmacs packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 :group 'emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 (defun package-get-custom ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 "Fetch and install the latest versions of all customized packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 (mapcar (lambda (pkg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 (if (eval (intern (concat (symbol-name (car pkg)) "-package")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 (package-get (car pkg) nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 t)
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
1064 package-get-base)
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
1065 (package-net-update-installed-db))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 (defun package-get-ever-installed-p (pkg &optional notused)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 (string-match "-package$" (symbol-name pkg))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1069 (custom-initialize-set
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1070 pkg
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1071 (if (package-get-info-find-package
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1072 packages-package-list
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 (intern (substring (symbol-name pkg) 0 (match-beginning 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 (defvar package-get-custom-groups nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 "List of package-get-custom groups")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 (defun package-get-custom-add-entry (package props)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 (let* ((category (plist-get props 'category))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 (group (intern (concat category "-packages")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 (custom-var (intern (concat (symbol-name package) "-package")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 (description (plist-get props 'description)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 (when (not (memq group package-get-custom-groups))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 (setq package-get-custom-groups (cons group
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 package-get-custom-groups))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 (eval `(defgroup ,group nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 ,(concat category " package group")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 :group 'packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 (eval `(defcustom ,custom-var nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 ,description
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 :group ',group
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 :initialize 'package-get-ever-installed-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 :type 'boolean))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 (provide 'package-get)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 ;;; package-get.el ends here