comparison lisp/package-get.el @ 263:727739f917cb r20-5b30

Import from CVS: tag r20-5b30
author cvs
date Mon, 13 Aug 2007 10:24:41 +0200
parents 89ec2bb86eea
children 6330739388db
comparison
equal deleted inserted replaced
262:9d8607af9e13 263:727739f917cb
143 For version information, it is assumed things are listed in most 143 For version information, it is assumed things are listed in most
144 recent to least recent -- in other words, the version names don't have to 144 recent to least recent -- in other words, the version names don't have to
145 be lexically ordered. It is debatable if it makes sense to have more than 145 be lexically ordered. It is debatable if it makes sense to have more than
146 one version of a package available.") 146 one version of a package available.")
147 147
148 (defvar package-get-dir "/tmp" 148 (defvar package-get-dir (temp-directory)
149 "*Where to store temporary files for staging.") 149 "*Where to store temporary files for staging.")
150 150
151 (defvar package-get-remote 151 (defvar package-get-remote
152 '( 152 '(
153 ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-20.5/packages/binary-packages") 153 ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-20.5/packages/binary-packages")
158 order until the package is found.") 158 order until the package is found.")
159 159
160 (defvar package-get-remove-copy nil 160 (defvar package-get-remove-copy nil
161 "*After copying and installing a package, if this is T, then remove the 161 "*After copying and installing a package, if this is T, then remove the
162 copy. Otherwise, keep it around.") 162 copy. Otherwise, keep it around.")
163
164 (defun package-get-update-all ()
165 "Fetch and install the latest versions of all currently installed packages."
166 (interactive)
167 ;; Load a fresh copy
168 (load "package-get-base.el")
169 (mapcar (lambda (pkg)
170 (package-get-all
171 (car pkg) nil))
172 packages-package-list))
163 173
164 (defun package-get-all (package version &optional fetched-packages) 174 (defun package-get-all (package version &optional fetched-packages)
165 "Fetch PACKAGE with VERSION and all other required packages. 175 "Fetch PACKAGE with VERSION and all other required packages.
166 Uses `package-get-base' to determine just what is required and what 176 Uses `package-get-base' to determine just what is required and what
167 package provides that functionality. If VERSION is nil, retrieves 177 package provides that functionality. If VERSION is nil, retrieves
258 (package-get-info-prop this-package 'md5sum))) 268 (package-get-info-prop this-package 'md5sum)))
259 (error "Package %s does not match md5 checksum" filename))) 269 (error "Package %s does not match md5 checksum" filename)))
260 (message "Retrieved package %s" filename) (sit-for 0) 270 (message "Retrieved package %s" filename) (sit-for 0)
261 (let ((status 271 (let ((status
262 (if (eq (package-get-info-prop this-package 'type) 'single) 272 (if (eq (package-get-info-prop this-package 'type) 'single)
263 (package-admin-add-single-file-package 273 (package-admin-add-single-file-package filename
264 (package-get-staging-dir filename)) 274 (package-get-staging-dir filename))
265 (package-admin-add-binary-package 275 (package-admin-add-binary-package
266 (package-get-staging-dir filename))))) 276 (package-get-staging-dir filename)))))
267 (when (not (= status 0)) 277 (when (not (= status 0))
268 (message "Package failed.") 278 (message "Package failed.")
359 369
360 370
361 (defun package-get-installedp (package version) 371 (defun package-get-installedp (package version)
362 "Determine if PACKAGE with VERSION has already been installed. 372 "Determine if PACKAGE with VERSION has already been installed.
363 I'm not sure if I want to do this by searching directories or checking 373 I'm not sure if I want to do this by searching directories or checking
364 some built in variables. For now, use `locate-library'." 374 some built in variables. For now, use packages-package-list."
365 ;; Use pacakges-package-list which contains name and version 375 ;; Use packages-package-list which contains name and version
366 (if (not (floatp version)) 376 (equal (plist-get
367 (setq version (string-to-number version))) 377 (package-get-info-find-package packages-package-list
368 (member (cons package version) packages-package-list)) 378 package) ':version)
379 (if (floatp version) version (string-to-number version))))
369 380
370 (defun package-get-package-provider (sym) 381 (defun package-get-package-provider (sym)
371 "Search for a package that provides SYM and return the name and 382 "Search for a package that provides SYM and return the name and
372 version. Searches in `package-get-base' for SYM. If SYM is a 383 version. Searches in `package-get-base' for SYM. If SYM is a
373 consp, then it must match a corresponding (provide (SYM VERSION)) from 384 consp, then it must match a corresponding (provide (SYM VERSION)) from