Mercurial > hg > xemacs-beta
comparison lisp/package-get.el @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children | 11054d720c21 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
30 | 30 |
31 ;; package-get - | 31 ;; package-get - |
32 ;; Retrieve a package and any other required packages from an archive | 32 ;; Retrieve a package and any other required packages from an archive |
33 ;; | 33 ;; |
34 ;; | 34 ;; |
35 ;; Note (JV): Most of this no longer applies! | 35 ;; Note (JV): Most of this no longer aplies! |
36 ;; | 36 ;; |
37 ;; The idea: | 37 ;; The idea: |
38 ;; A new XEmacs lisp-only release is generated with the following steps: | 38 ;; A new XEmacs lisp-only release is generated with the following steps: |
39 ;; 1. The maintainer runs some yet to be written program that | 39 ;; 1. The maintainer runs some yet to be written program that |
40 ;; generates all the dependency information. This should | 40 ;; generates all the dependency information. This should |
66 ;; version: 2.0 | 66 ;; version: 2.0 |
67 ;; | 67 ;; |
68 ;; vm - a mail reader | 68 ;; vm - a mail reader |
69 ;; [] Always install | 69 ;; [] Always install |
70 ;; [] Needs updating | 70 ;; [] Needs updating |
71 ;; [] Required by other [packages] | 71 ;; [] Required by other [packages] |
72 ;; | 72 ;; |
73 ;; Where `[]' indicates a toggle box | 73 ;; Where `[]' indicates a toggle box |
74 ;; | 74 ;; |
75 ;; - Clicking on "Always install" puts this into | 75 ;; - Clicking on "Always install" puts this into |
76 ;; `package-get-here' list. "Needs updating" indicates a new | 76 ;; `package-get-here' list. "Needs updating" indicates a new |
77 ;; version is available. Anything already in | 77 ;; version is available. Anything already in |
78 ;; `package-get-here' has this enabled. | 78 ;; `package-get-here' has this enabled. |
79 ;; - "Required by other" means some other packages are going to force | 79 ;; - "Required by other" means some other packages are going to force |
80 ;; this to be installed. Clicking on [packages] gives a list | 80 ;; this to be installed. Clicking on [packages] gives a list |
81 ;; of packages that require this. | 81 ;; of packages that require this. |
82 ;; | 82 ;; |
83 ;; The `package-get-base' should be installed in a file in | 83 ;; The `package-get-base' should be installed in a file in |
84 ;; `data-directory'. The `package-get-here' should be installed in | 84 ;; `data-directory'. The `package-get-here' should be installed in |
85 ;; site-lisp. Both are then read at run time. | 85 ;; site-lisp. Both are then read at run time. |
86 ;; | 86 ;; |
87 ;; TODO: | 87 ;; TODO: |
111 (defgroup package-get nil | 111 (defgroup package-get nil |
112 "Automatic Package Fetcher and Installer." | 112 "Automatic Package Fetcher and Installer." |
113 :prefix "package-get" | 113 :prefix "package-get" |
114 :group 'package-tools) | 114 :group 'package-tools) |
115 | 115 |
116 ;;;###autoload | 116 ;;;###autoload |
117 (defvar package-get-base nil | 117 (defvar package-get-base nil |
118 "List of packages that are installed at this site. | 118 "List of packages that are installed at this site. |
119 For each element in the alist, car is the package name and the cdr is | 119 For each element in the alist, car is the package name and the cdr is |
120 a plist containing information about the package. Typical fields | 120 a plist containing information about the package. Typical fields |
121 kept in the plist are: | 121 kept in the plist are: |
178 :tag "Package repository" | 178 :tag "Package repository" |
179 :type '(repeat (choice (list :tag "Local" (const :tag "Local" nil) directory ) | 179 :type '(repeat (choice (list :tag "Local" (const :tag "Local" nil) directory ) |
180 (list :tag "Remote" host-name directory) )) | 180 (list :tag "Remote" host-name directory) )) |
181 :group 'package-get) | 181 :group 'package-get) |
182 | 182 |
183 ;;;###autoload | |
184 (defcustom package-get-download-sites | 183 (defcustom package-get-download-sites |
185 '( | 184 '( |
186 ;; North America | 185 ;; North America |
187 ("xemacs.org" "ftp.xemacs.org" "pub/xemacs/packages") | 186 ("xemacs.org" "ftp.xemacs.org" "pub/xemacs/packages") |
188 ("crc.ca (Canada)" "ftp.crc.ca" "pub/packages/editors/xemacs/packages") | 187 ("cso.uiuc.edu" "ftp.cso.uiuc.edu" "pub/packages/xemacs/packages") |
189 ("ualberta.ca (Canada)" "sunsite.ualberta.ca" "pub/Mirror/xemacs/packages") | |
190 ("uiuc.edu (United States)" "uiarchive.uiuc.edu" "pub/packages/xemacs/packages") | |
191 ("unc.edu (United States)" "metalab.unc.edu" "pub/packages/editors/xemacs/packages") | |
192 ("utk.edu (United States)" "ftp.sunsite.utk.edu" "pub/xemacs/packages") | |
193 | 188 |
194 ;; South America | 189 ;; South America |
195 ("unicamp.br (Brazil)" "ftp.unicamp.br" "pub/xemacs/packages") | 190 ("unicamp.br" "ftp.unicamp.br" "pub/xemacs/packages") |
196 | 191 |
197 ;; Europe | 192 ;; Europe |
198 ("tuwien.ac.at (Austria)" "gd.tuwien.ac.at" "editors/xemacs/packages") | 193 ("sunsite.cnlab-switch.ch" "sunsite.cnlab-switch.ch" "mirror/xemacs/packages") |
199 ("auc.dk (Denmark)" "sunsite.auc.dk" "pub/emacs/xemacs/packages") | 194 ("tu-darmstadt.de" "ftp.tu-darmstadt.de" "pub/editors/xemacs/packages") |
200 ("doc.ic.ac.uk (England)" "sunsite.doc.ic.ac.uk" "packages/xemacs/packages") | 195 ("sunsite.auc.dk" "sunsite.auc.dk" "pub/emacs/xemacs/packages") |
201 ("funet.fi (Finland)" "ftp.funet.fi" "pub/mirrors/ftp.xemacs.org/pub/tux/xemacs/packages") | 196 ("pasteur.fr" "ftp.pasteur.fr" "pub/computing/xemacs/packages") |
202 ("cenatls.cena.dgac.fr (France)" "ftp.cenatls.cena.dgac.fr" "Emacs/xemacs/packages") | 197 ("cenatls.cena.dgac.fr" "ftp.cenatls.cena.dgac.fr" "pub/Emacs/xemacs/packages") |
203 ("pasteur.fr (France)" "ftp.pasteur.fr" "pub/computing/xemacs/packages") | 198 ("kfki.hu" "ftp.kfki.hu" "pub/packages/xemacs/packages") |
204 ("tu-darmstadt.de (Germany)" "ftp.tu-darmstadt.de" "pub/editors/xemacs/packages") | 199 ("uniroma2.it" "ftp.uniroma2.it" "unix/misc/dist/XEMACS/packages") |
205 ("kfki.hu (Hungary)" "ftp.kfki.hu" "pub/packages/xemacs/packages") | 200 ("icm.edu.pl" "ftp.icm.edu.pl" "pub/unix/editors/xemacs/packages") |
206 ("eunet.ie (Ireland)" "ftp.eunet.ie" "mirrors/ftp.xemacs.org/pub/xemacs/packages") | 201 ("sunet.se" "ftp.sunet.se" "pub/gnu/xemacs/packages") |
207 ("uniroma2.it (Italy)" "ftp.uniroma2.it" "unix/misc/dist/XEMACS/packages") | 202 ("doc.ic.ac.uk" "sunsite.doc.ic.ac.uk" "packages/xemacs/packages") |
208 ("uio.no (Norway)" "sunsite.uio.no" "pub/xemacs/packages") | 203 ("srcc.msu.su" "ftp1.srcc.msu.su" "mirror/ftp.xemacs.org/packages") |
209 ("icm.edu.pl (Poland)" "ftp.icm.edu.pl" "pub/unix/editors/xemacs/packages") | |
210 ("srcc.msu.su (Russia)" "ftp.srcc.msu.su" "mirror/ftp.xemacs.org/packages") | |
211 ("sunet.se (Sweden)" "ftp.sunet.se" "pub/gnu/xemacs/packages") | |
212 ("cnlab-switch.ch (Switzerland)" "sunsite.cnlab-switch.ch" "mirror/xemacs/packages") | |
213 | 204 |
214 ;; Asia | 205 ;; Asia |
215 ("aist.go.jp (Japan)" "ring.aist.go.jp" "pub/text/xemacs/packages") | 206 ("usyd.edu.au" "ftp.usyd.edu.au" "pub/Xemacs/packages") |
216 ("asahi-net.or.jp (Japan)" "ring.asahi-net.or.jp" "pub/text/xemacs/packages") | 207 ("netlab.is.tsukuba.ac.jp" "ftp.netlab.is.tsukuba.ac.jp" "pub/GNU/xemacs/packages") |
217 ("dti.ad.jp (Japan)" "ftp.dti.ad.jp" "pub/unix/editor/xemacs/packages") | 208 ("jaist.ac.jp" "ftp.jaist.ac.jp" "pub/GNU/xemacs/packages") |
218 ("jaist.ac.jp (Japan)" "ftp.jaist.ac.jp" "pub/GNU/xemacs/packages") | 209 ("ring.aist.go.jp" "ring.aist.go.jp" "pub/text/xemacs/packages") |
219 ("nucba.ac.jp (Japan)" "mirror.nucba.ac.jp" "mirror/xemacs/packages") | 210 ("ring.asahi-net.or.jp" "ring.asahi-net.or.jp" "pub/text/xemacs/packages") |
220 ("sut.ac.jp (Japan)" "sunsite.sut.ac.jp" "pub/archives/packages/xemacs/packages") | 211 ("SunSITE.sut.ac.jp" "SunSITE.sut.ac.jp" "pub/archives/packages/xemacs/packages") |
221 ("tsukuba.ac.jp (Japan)" "ftp.netlab.is.tsukuba.ac.jp" "pub/GNU/xemacs/packages") | 212 ("dti.ad.jp" "ftp.dti.ad.jp" "pub/unix/editor/xemacs/packages") |
222 ("kreonet.re.kr (Korea)" "ftp.kreonet.re.kr" "pub/tools/emacs/xemacs/packages") | 213 ("kreonet.re.kr" "ftp.kreonet.re.kr" "pub/tools/emacs/xemacs/packages") |
223 ("nctu.edu.tw (Taiwan)" "coda.nctu.edu.tw" "Editors/xemacs/packages") | |
224 | |
225 ;; Africa | |
226 ("sun.ac.za (South Africa)" "ftp.sun.ac.za" "xemacs/packages") | |
227 | |
228 ;; Middle East | |
229 ("isu.net.sa (Saudi Arabia)" "ftp.isu.net.sa" "pub/mirrors/ftp.xemacs.org/packages") | |
230 | |
231 ;; Australia | |
232 ("aarnet.edu.au (Australia)" "mirror.aarnet.edu.au" "pub/xemacs/packages") | |
233 ) | 214 ) |
234 "*List of remote sites available for downloading packages. | 215 "*List of remote sites available for downloading packages. |
235 List format is '(site-description site-name directory-on-site). | 216 List format is '(site-description site-name directory-on-site). |
236 SITE-DESCRIPTION is a textual description of the site. SITE-NAME | 217 SITE-DESCRIPTION is a textual description of the site. SITE-NAME |
237 is the internet address of the download site. DIRECTORY-ON-SITE | 218 is the internet address of the download site. DIRECTORY-ON-SITE |
238 is the directory on the site in which packages may be found. | 219 is the directory on the site in which packages may be found. |
239 This variable is used to initialize `package-get-remote', the | 220 This variable is used to initialize `package-get-remote', the |
240 variable actually used to specify package download sites." | 221 variable actually used to specify package download sites." |
241 :tag "Package download sites" | 222 :tag "Package download sites" |
242 :type '(repeat (list (string :tag "Name") host-name directory)) | 223 :type '(repeat (list hostname directory)) |
243 :group 'package-get) | 224 :group 'package-get) |
244 | 225 |
245 (defcustom package-get-remove-copy t | 226 (defcustom package-get-remove-copy t |
246 "*After copying and installing a package, if this is t, then remove the | 227 "*After copying and installing a package, if this is T, then remove the |
247 copy. Otherwise, keep it around." | 228 copy. Otherwise, keep it around." |
248 :type 'boolean | 229 :type 'boolean |
249 :group 'package-get) | 230 :group 'package-get) |
250 | 231 |
251 ;; #### it may make sense for this to be a list of names. | 232 ;; #### it may make sense for this to be a list of names. |
256 This may either be a relative path, in which case it is interpreted | 237 This may either be a relative path, in which case it is interpreted |
257 with respect to `package-get-remote', or an absolute path." | 238 with respect to `package-get-remote', or an absolute path." |
258 :type 'file | 239 :type 'file |
259 :group 'package-get) | 240 :group 'package-get) |
260 | 241 |
261 (defvar package-get-user-index-filename | |
262 (paths-construct-path (list user-init-directory package-get-base-filename)) | |
263 "Name for the user-specific location of the package-get database file.") | |
264 | |
265 (defcustom package-get-always-update nil | 242 (defcustom package-get-always-update nil |
266 "*If Non-nil always make sure we are using the latest package index (base). | 243 "*If Non-nil always make sure we are using the latest package index (base). |
267 Otherwise respect the `force-current' argument of `package-get-require-base'." | 244 Otherwise respect the `force-current' argument of `package-get-require-base'." |
268 :type 'boolean | 245 :type 'boolean |
269 :group 'package-get) | 246 :group 'package-get) |
282 ;Shouldn't this be in package-ui? | 259 ;Shouldn't this be in package-ui? |
283 ;;;###autoload | 260 ;;;###autoload |
284 (defun package-get-download-menu () | 261 (defun package-get-download-menu () |
285 "Build the `Add Download Site' menu." | 262 "Build the `Add Download Site' menu." |
286 (mapcar (lambda (site) | 263 (mapcar (lambda (site) |
287 (vector (car site) | 264 (vector (car site) |
288 `(if (member (quote ,(cdr site)) | 265 `(package-ui-add-site (quote ,(cdr site))) |
289 package-get-remote) | 266 :style 'toggle :selected |
290 (setq package-get-remote | 267 `(member (quote ,(cdr site)) package-get-remote))) |
291 (delete (quote ,(cdr site)) | 268 package-get-download-sites)) |
292 package-get-remote)) | |
293 (package-ui-add-site (quote ,(cdr site)))) | |
294 :style 'toggle | |
295 :selected `(member (quote ,(cdr site)) | |
296 package-get-remote))) | |
297 package-get-download-sites)) | |
298 | 269 |
299 ;;;###autoload | 270 ;;;###autoload |
300 (defun package-get-require-base (&optional force-current) | 271 (defun package-get-require-base (&optional force-current) |
301 "Require that a package-get database has been loaded. | 272 "Require that a package-get database has been loaded. |
302 If the optional FORCE-CURRENT argument or the value of | 273 If the optional FORCE-CURRENT argument or the value of |
355 | 326 |
356 (defun package-get-locate-index-file (no-remote) | 327 (defun package-get-locate-index-file (no-remote) |
357 "Locate the package-get index file. Do not return remote paths if NO-REMOTE | 328 "Locate the package-get index file. Do not return remote paths if NO-REMOTE |
358 is non-nil." | 329 is non-nil." |
359 (or (package-get-locate-file package-get-base-filename t no-remote) | 330 (or (package-get-locate-file package-get-base-filename t no-remote) |
360 (if (file-exists-p package-get-user-index-filename) | 331 (locate-data-file package-get-base-filename) |
361 package-get-user-index-filename))) | 332 package-get-base-filename)) |
333 | |
334 (defvar package-get-user-package-location user-init-directory) | |
362 | 335 |
363 (defun package-get-maybe-save-index (filename) | 336 (defun package-get-maybe-save-index (filename) |
364 "Offer to save the current buffer as the local package index file, | 337 "Offer to save the current buffer as the local package index file, |
365 if different." | 338 if different." |
366 (let ((location (package-get-locate-index-file t))) | 339 (let ((location (package-get-locate-index-file t))) |
367 (unless (and filename (equal filename location)) | 340 (unless (and filename (equal filename location)) |
368 (unless (and location | 341 (unless (equal (md5 (current-buffer)) |
369 (equal (md5 (current-buffer)) | 342 (with-temp-buffer |
370 (with-temp-buffer | 343 (insert-file-contents location) |
371 (insert-file-contents-literally location) | 344 (md5 (current-buffer)))) |
372 (md5 (current-buffer))))) | 345 (unless (file-writable-p location) |
373 (unless (and location (file-writable-p location)) | 346 (setq location (expand-file-name package-get-base-filename |
374 (setq location package-get-user-index-filename)) | 347 (expand-file-name "etc/" package-get-user-package-location)))) |
375 (when (y-or-n-p (concat "Update package index in " location "? ")) | 348 (when (y-or-n-p (concat "Update package index in" location "? ")) |
376 (let ((coding-system-for-write 'binary)) | 349 (write-file location)))))) |
377 (write-file location))))))) | 350 |
378 | |
379 | 351 |
380 ;;;###autoload | 352 ;;;###autoload |
381 (defun package-get-update-base (&optional db-file force-current) | 353 (defun package-get-update-base (&optional db-file force-current) |
382 "Update the package-get database file with entries from DB-FILE. | 354 "Update the package-get database file with entries from DB-FILE. |
383 Unless FORCE-CURRENT is non-nil never try to update the database." | 355 Unless FORCE-CURRENT is non-nil never try to update the database." |
398 (let ((buf (get-buffer-create "*package database*"))) | 370 (let ((buf (get-buffer-create "*package database*"))) |
399 (unwind-protect | 371 (unwind-protect |
400 (save-excursion | 372 (save-excursion |
401 (set-buffer buf) | 373 (set-buffer buf) |
402 (erase-buffer buf) | 374 (erase-buffer buf) |
403 (insert-file-contents-literally db-file) | 375 (insert-file-contents-internal db-file) |
404 (package-get-update-base-from-buffer buf) | 376 (package-get-update-base-from-buffer buf) |
405 (if (file-remote-p db-file) | 377 (if (file-remote-p db-file) |
406 (package-get-maybe-save-index db-file))) | 378 (package-get-maybe-save-index db-file))) |
407 (kill-buffer buf)))) | 379 (kill-buffer buf)))) |
408 | 380 |
451 (yes-or-no-p | 423 (yes-or-no-p |
452 (concat "Can't find PGP, continue without " | 424 (concat "Can't find PGP, continue without " |
453 "package-get DB verification? "))))) | 425 "package-get DB verification? "))))) |
454 (t nil))))) | 426 (t nil))))) |
455 (error "Package-get PGP signature failed to verify")) | 427 (error "Package-get PGP signature failed to verify")) |
456 ;; ToDo: We should call package-get-maybe-save-index on the region | 428 ;; ToDo: We shoud call package-get-maybe-save-index on the region |
457 (package-get-update-base-entries content-beg content-end) | 429 (package-get-update-base-entries content-beg content-end) |
458 (message "Updated package-get database")))) | 430 (message "Updated package-get database")))) |
459 | 431 |
460 (defun package-get-update-base-entries (beg end) | 432 (defun package-get-update-base-entries (beg end) |
461 "Update the package-get database with the entries found between | 433 "Update the package-get database with the entries found between |
515 "Perform interactive querying for package and optional version. | 487 "Perform interactive querying for package and optional version. |
516 Query for a version if GET-VERSION is non-nil. Return package name as | 488 Query for a version if GET-VERSION is non-nil. Return package name as |
517 a symbol instead of a string if PACKAGE-SYMBOL is non-nil. | 489 a symbol instead of a string if PACKAGE-SYMBOL is non-nil. |
518 The return value is suitable for direct passing to `interactive'." | 490 The return value is suitable for direct passing to `interactive'." |
519 (package-get-require-base t) | 491 (package-get-require-base t) |
520 (let ((table (mapcar #'(lambda (item) | 492 (let ( (table (mapcar '(lambda (item) |
521 (let ((name (symbol-name (car item)))) | 493 (let ( (name (symbol-name (car item))) ) |
522 (cons name name))) | 494 (cons name name) |
523 package-get-base)) | 495 )) |
524 package package-symbol default-version version) | 496 package-get-base)) |
497 package package-symbol default-version version) | |
525 (save-window-excursion | 498 (save-window-excursion |
526 (setq package (completing-read "Package: " table nil t)) | 499 (setq package (completing-read "Package: " table nil t)) |
527 (setq package-symbol (intern package)) | 500 (setq package-symbol (intern package)) |
528 (if get-version | 501 (if get-version |
529 (progn | 502 (progn |
530 (setq default-version | 503 (setq default-version |
531 (package-get-info-prop | 504 (package-get-info-prop |
532 (package-get-info-version | 505 (package-get-info-version |
533 (package-get-info-find-package package-get-base | 506 (package-get-info-find-package package-get-base |
534 package-symbol) nil) | 507 package-symbol) nil) |
535 'version)) | 508 'version)) |
536 (while (string= | 509 (while (string= |
541 (list package-symbol version) | 514 (list package-symbol version) |
542 (list package version)) | 515 (list package version)) |
543 ) | 516 ) |
544 (if package-symbol | 517 (if package-symbol |
545 (list package-symbol) | 518 (list package-symbol) |
546 (list package)))))) | 519 (list package))) |
520 ))) | |
547 | 521 |
548 ;;;###autoload | 522 ;;;###autoload |
549 (defun package-get-delete-package (package &optional pkg-topdir) | 523 (defun package-get-delete-package (package &optional pkg-topdir) |
550 "Delete an installation of PACKAGE below directory PKG-TOPDIR. | 524 "Delete an installation of PACKAGE below directory PKG-TOPDIR. |
551 PACKAGE is a symbol, not a string. | 525 PACKAGE is a symbol, not a string. |
704 'always always retrieve the package even if it is already installed | 678 'always always retrieve the package even if it is already installed |
705 'never do not retrieve the package if it is installed. | 679 'never do not retrieve the package if it is installed. |
706 INSTALL-DIR, if non-nil, specifies the package directory where | 680 INSTALL-DIR, if non-nil, specifies the package directory where |
707 fetched packages should be installed. | 681 fetched packages should be installed. |
708 | 682 |
709 The value of `package-get-base' is used to determine what files should | 683 The value of `package-get-base' is used to determine what files should |
710 be retrieved. The value of `package-get-remote' is used to determine | 684 be retrieved. The value of `package-get-remote' is used to determine |
711 where a package should be retrieved from. The sites are tried in | 685 where a package should be retrieved from. The sites are tried in |
712 order so one is better off listing easily reached sites first. | 686 order so one is better off listing easily reached sites first. |
713 | 687 |
714 Once the package is retrieved, its md5 checksum is computed. If that | 688 Once the package is retrieved, its md5 checksum is computed. If that |
812 ;; If the file exists on the remote system ... | 786 ;; If the file exists on the remote system ... |
813 ( (file-exists-p (package-get-remote-filename | 787 ( (file-exists-p (package-get-remote-filename |
814 current-dir-entry current-filename)) | 788 current-dir-entry current-filename)) |
815 ;; Get it | 789 ;; Get it |
816 (setq full-package-filename dest-filename) | 790 (setq full-package-filename dest-filename) |
817 (message "Retrieving package `%s' ..." | 791 (message "Retrieving package `%s' ..." |
818 current-filename) | 792 current-filename) |
819 (sit-for 0) | 793 (sit-for 0) |
820 (copy-file (package-get-remote-filename current-dir-entry | 794 (copy-file (package-get-remote-filename current-dir-entry |
821 current-filename) | 795 current-filename) |
822 full-package-filename t) | 796 full-package-filename t) |
843 "No download sites or local package locations specified."))) | 817 "No download sites or local package locations specified."))) |
844 ;; Validate the md5 checksum | 818 ;; Validate the md5 checksum |
845 ;; Doing it with XEmacs removes the need for an external md5 program | 819 ;; Doing it with XEmacs removes the need for an external md5 program |
846 (message "Validating checksum for `%s'..." package) (sit-for 0) | 820 (message "Validating checksum for `%s'..." package) (sit-for 0) |
847 (with-temp-buffer | 821 (with-temp-buffer |
848 (insert-file-contents-literally full-package-filename) | 822 ;; What ever happened to i-f-c-literally |
823 (let (file-name-handler-alist) | |
824 (insert-file-contents-internal full-package-filename)) | |
849 (if (not (string= (md5 (current-buffer)) | 825 (if (not (string= (md5 (current-buffer)) |
850 (package-get-info-prop this-package | 826 (package-get-info-prop this-package |
851 'md5sum))) | 827 'md5sum))) |
852 (error "Package %s does not match md5 checksum" base-filename))) | 828 (error "Package %s does not match md5 checksum" base-filename))) |
853 | 829 |
896 associated with it. See `package-get-base' for info on the format | 872 associated with it. See `package-get-base' for info on the format |
897 returned. | 873 returned. |
898 | 874 |
899 To access fields returned from this, use | 875 To access fields returned from this, use |
900 `package-get-info-version' to return information about particular a | 876 `package-get-info-version' to return information about particular a |
901 version. Use `package-get-info-find-prop' to find particular property | 877 version. Use `package-get-info-find-prop' to find particular property |
902 from a version returned by `package-get-info-version'." | 878 from a version returned by `package-get-info-version'." |
903 (interactive "xPackage list: \nsPackage Name: ") | 879 (interactive "xPackage list: \nsPackage Name: ") |
904 (if which | 880 (if which |
905 (if (eq (caar which) name) | 881 (if (eq (caar which) name) |
906 (cdar which) | 882 (cdar which) |
908 (package-get-info-find-package (cdr which) name))))) | 884 (package-get-info-find-package (cdr which) name))))) |
909 | 885 |
910 (defun package-get-info-version (package version) | 886 (defun package-get-info-version (package version) |
911 "In PACKAGE, return the plist associated with a particular VERSION of the | 887 "In PACKAGE, return the plist associated with a particular VERSION of the |
912 package. PACKAGE is typically as returned by | 888 package. PACKAGE is typically as returned by |
913 `package-get-info-find-package'. If VERSION is nil, then return the | 889 `package-get-info-find-package'. If VERSION is nil, then return the |
914 first (aka most recent) version. Use `package-get-info-find-prop' | 890 first (aka most recent) version. Use `package-get-info-find-prop' |
915 to retrieve a particular property from the value returned by this." | 891 to retrieve a particular property from the value returned by this." |
916 (interactive (package-get-interactive-package-query t t)) | 892 (interactive (package-get-interactive-package-query t t)) |
917 (while (and version package (not (string= (plist-get (car package) 'version) version))) | 893 (while (and version package (not (string= (plist-get (car package) 'version) version))) |
918 (setq package (cdr package))) | 894 (setq package (cdr package))) |
985 filename)))) | 961 filename)))) |
986 | 962 |
987 | 963 |
988 (defun package-get-installedp (package version) | 964 (defun package-get-installedp (package version) |
989 "Determine if PACKAGE with VERSION has already been installed. | 965 "Determine if PACKAGE with VERSION has already been installed. |
990 I'm not sure if I want to do this by searching directories or checking | 966 I'm not sure if I want to do this by searching directories or checking |
991 some built in variables. For now, use packages-package-list." | 967 some built in variables. For now, use packages-package-list." |
992 ;; Use packages-package-list which contains name and version | 968 ;; Use packages-package-list which contains name and version |
993 (equal (plist-get | 969 (equal (plist-get |
994 (package-get-info-find-package packages-package-list | 970 (package-get-info-find-package packages-package-list |
995 package) ':version) | 971 package) ':version) |
997 | 973 |
998 ;;;###autoload | 974 ;;;###autoload |
999 (defun package-get-package-provider (sym &optional force-current) | 975 (defun package-get-package-provider (sym &optional force-current) |
1000 "Search for a package that provides SYM and return the name and | 976 "Search for a package that provides SYM and return the name and |
1001 version. Searches in `package-get-base' for SYM. If SYM is a | 977 version. Searches in `package-get-base' for SYM. If SYM is a |
1002 consp, then it must match a corresponding (provide (SYM VERSION)) from | 978 consp, then it must match a corresponding (provide (SYM VERSION)) from |
1003 the package. | 979 the package. |
1004 | 980 |
1005 If FORCE-CURRENT is non-nil make sure the database is up to date. This might | 981 If FORCE-CURRENT is non-nil make sure the database is up to date. This might |
1006 lead to Emacs accessing remote sites." | 982 lead to Emacs accessing remote sites." |
1007 (interactive "SSymbol: ") | 983 (interactive "SSymbol: ") |
1023 (setq found | 999 (setq found |
1024 (list (caar packages) | 1000 (list (caar packages) |
1025 (package-get-info-prop (car this-package) 'version)))) | 1001 (package-get-info-prop (car this-package) 'version)))) |
1026 (setq this-package (cdr this-package))))) | 1002 (setq this-package (cdr this-package))))) |
1027 (setq packages (cdr packages))) | 1003 (setq packages (cdr packages))) |
1028 (when (interactive-p) | |
1029 (if found | |
1030 (message "%S" found) | |
1031 (message "No appropriate package found"))) | |
1032 found)) | 1004 found)) |
1033 | 1005 |
1034 ;; | 1006 ;; |
1035 ;; customize interfaces. | 1007 ;; customize interfaces. |
1036 ;; The group is in this file so that custom loads includes this file. | 1008 ;; The group is in this file so that custom loads includes this file. |
1050 t) | 1022 t) |
1051 package-get-base)) | 1023 package-get-base)) |
1052 | 1024 |
1053 (defun package-get-ever-installed-p (pkg &optional notused) | 1025 (defun package-get-ever-installed-p (pkg &optional notused) |
1054 (string-match "-package$" (symbol-name pkg)) | 1026 (string-match "-package$" (symbol-name pkg)) |
1055 (custom-initialize-set | 1027 (custom-initialize-set |
1056 pkg | 1028 pkg |
1057 (if (package-get-info-find-package | 1029 (if (package-get-info-find-package |
1058 packages-package-list | 1030 packages-package-list |
1059 (intern (substring (symbol-name pkg) 0 (match-beginning 0)))) | 1031 (intern (substring (symbol-name pkg) 0 (match-beginning 0)))) |
1060 t))) | 1032 t))) |
1061 | 1033 |
1062 (defvar package-get-custom-groups nil | 1034 (defvar package-get-custom-groups nil |
1063 "List of package-get-custom groups") | 1035 "List of package-get-custom groups") |