comparison lisp/package-get.el @ 298:70ad99077275 r21-0b47

Import from CVS: tag r21-0b47
author cvs
date Mon, 13 Aug 2007 10:39:40 +0200
parents 4b85ae5eabfb
children 9ea74add5d37
comparison
equal deleted inserted replaced
297:deca3c1083ac 298:70ad99077275
95 ;;; Change Log 95 ;;; Change Log
96 96
97 ;;; Code: 97 ;;; Code:
98 98
99 (require 'package-admin) 99 (require 'package-admin)
100 (require 'package-get-base)
100 101
101 (defvar package-get-base nil 102 (defvar package-get-base nil
102 "List of packages that are installed at this site. 103 "List of packages that are installed at this site.
103 For each element in the alist, car is the package name and the cdr is 104 For each element in the alist, car is the package name and the cdr is
104 a plist containing information about the package. Typical fields 105 a plist containing information about the package. Typical fields
163 ;;;###autoload 164 ;;;###autoload
164 (defun package-get-update-all () 165 (defun package-get-update-all ()
165 "Fetch and install the latest versions of all currently installed packages." 166 "Fetch and install the latest versions of all currently installed packages."
166 (interactive) 167 (interactive)
167 ;; Load a fresh copy 168 ;; Load a fresh copy
168 (load "package-get-base.el")
169 (mapcar (lambda (pkg) 169 (mapcar (lambda (pkg)
170 (package-get-all 170 (package-get-all
171 (car pkg) nil)) 171 (car pkg) nil))
172 packages-package-list)) 172 packages-package-list))
173 173
177 Uses `package-get-base' to determine just what is required and what 177 Uses `package-get-base' to determine just what is required and what
178 package provides that functionality. If VERSION is nil, retrieves 178 package provides that functionality. If VERSION is nil, retrieves
179 latest version. Optional argument FETCHED-PACKAGES is used to keep 179 latest version. Optional argument FETCHED-PACKAGES is used to keep
180 track of packages already fetched." 180 track of packages already fetched."
181 (interactive "sPackage: \nsVersion: ") 181 (interactive "sPackage: \nsVersion: ")
182 (load "package-get-base.el")
183 (let* ((the-package (package-get-info-find-package package-get-base 182 (let* ((the-package (package-get-info-find-package package-get-base
184 package)) 183 package))
185 (this-package (package-get-info-version 184 (this-package (package-get-info-version
186 the-package version)) 185 the-package version))
187 (this-requires (package-get-info-prop this-package 'requires)) 186 (this-requires (package-get-info-prop this-package 'requires))
228 227
229 Once the package is retrieved, its md5 checksum is computed. If that 228 Once the package is retrieved, its md5 checksum is computed. If that
230 sum does not match that stored in `package-get-base' for this version 229 sum does not match that stored in `package-get-base' for this version
231 of the package, an error is signalled." 230 of the package, an error is signalled."
232 (interactive "xPackage List: ") 231 (interactive "xPackage List: ")
233 (load "package-get-base.el")
234 (let* ((this-package 232 (let* ((this-package
235 (package-get-info-version 233 (package-get-info-version
236 (package-get-info-find-package package-get-base 234 (package-get-info-find-package package-get-base
237 package) version)) 235 package) version))
238 (found nil) 236 (found nil)
360 words 358 words
361 site-name:remote-directory/filename 359 site-name:remote-directory/filename
362 " 360 "
363 (if (efs-ftp-path filename) 361 (if (efs-ftp-path filename)
364 filename 362 filename
365 (concat "/" 363 (let ((dir (cadr search)))
366 (car search) ":" 364 (concat "/"
367 (file-name-as-directory (cadr search)) 365 (car search) ":"
368 filename))) 366 (if (string-match "/$" dir)
367 dir
368 (concat dir "/"))
369 filename))))
369 370
370 371
371 (defun package-get-installedp (package version) 372 (defun package-get-installedp (package version)
372 "Determine if PACKAGE with VERSION has already been installed. 373 "Determine if PACKAGE with VERSION has already been installed.
373 I'm not sure if I want to do this by searching directories or checking 374 I'm not sure if I want to do this by searching directories or checking
383 "Search for a package that provides SYM and return the name and 384 "Search for a package that provides SYM and return the name and
384 version. Searches in `package-get-base' for SYM. If SYM is a 385 version. Searches in `package-get-base' for SYM. If SYM is a
385 consp, then it must match a corresponding (provide (SYM VERSION)) from 386 consp, then it must match a corresponding (provide (SYM VERSION)) from
386 the package." 387 the package."
387 (interactive "SSymbol: ") 388 (interactive "SSymbol: ")
388 (load "package-get-base.el")
389 (let ((packages package-get-base) 389 (let ((packages package-get-base)
390 (done nil) 390 (done nil)
391 (found nil)) 391 (found nil))
392 (while (and (not done) packages) 392 (while (and (not done) packages)
393 (let* ((this-name (caar packages)) 393 (let* ((this-name (caar packages))
416 ;;;###autoload 416 ;;;###autoload
417 (defun package-get-custom () 417 (defun package-get-custom ()
418 "Fetch and install the latest versions of all customized packages." 418 "Fetch and install the latest versions of all customized packages."
419 (interactive) 419 (interactive)
420 ;; Load a fresh copy 420 ;; Load a fresh copy
421 (load "package-get-base.el")
422 (load "package-get-custom.el") 421 (load "package-get-custom.el")
423 (mapcar (lambda (pkg) 422 (mapcar (lambda (pkg)
424 (if (eval (intern (concat (symbol-name (car pkg)) "-package"))) 423 (if (eval (intern (concat (symbol-name (car pkg)) "-package")))
425 (package-get-all (car pkg) nil)) 424 (package-get-all (car pkg) nil))
426 t) 425 t)
454 (defun package-get-create-custom () 453 (defun package-get-create-custom ()
455 "Creates a package customization file package-get-custom.el. 454 "Creates a package customization file package-get-custom.el.
456 Entries in the customization file are retrieved from package-get-base.el." 455 Entries in the customization file are retrieved from package-get-base.el."
457 (interactive) 456 (interactive)
458 ;; Load a fresh copy 457 ;; Load a fresh copy
459 (load "package-get-base.el")
460 (let ((custom-buffer (find-file-noselect 458 (let ((custom-buffer (find-file-noselect
461 (or (package-get-file-installed-p 459 (or (package-get-file-installed-p
462 "package-get-custom.el") 460 "package-get-custom.el")
463 (concat (file-name-directory 461 (concat (file-name-directory
464 (package-get-file-installed-p 462 (package-get-file-installed-p