Mercurial > hg > xemacs-beta
comparison lisp/package-get.el @ 288:e11d67e05968 r21-0b42
Import from CVS: tag r21-0b42
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:35:54 +0200 |
parents | 57709be46d1b |
children | 6cb5e14cd98e |
comparison
equal
deleted
inserted
replaced
287:13a0bd77a29d | 288:e11d67e05968 |
---|---|
265 (package-get-info-prop this-package | 265 (package-get-info-prop this-package |
266 'md5sum))) | 266 'md5sum))) |
267 (error "Package %s does not match md5 checksum" filename))) | 267 (error "Package %s does not match md5 checksum" filename))) |
268 (message "Retrieved package %s" filename) (sit-for 0) | 268 (message "Retrieved package %s" filename) (sit-for 0) |
269 (let ((status | 269 (let ((status |
270 (if (eq (package-get-info-prop this-package 'type) 'single) | 270 (package-admin-add-binary-package |
271 (package-admin-add-single-file-package filename | 271 (package-get-staging-dir filename)))) |
272 (package-get-staging-dir filename)) | |
273 (package-admin-add-binary-package | |
274 (package-get-staging-dir filename))))) | |
275 (when (not (= status 0)) | 272 (when (not (= status 0)) |
276 (message "Package failed.") | 273 (message "Package failed.") |
277 (switch-to-buffer package-admin-temp-buffer))) | 274 (switch-to-buffer package-admin-temp-buffer))) |
278 (sit-for 0) | 275 (sit-for 0) |
279 (message "Added package") (sit-for 0) | 276 (message "Added package") (sit-for 0) |
419 (if (eval (intern (concat (symbol-name (car pkg)) "-package"))) | 416 (if (eval (intern (concat (symbol-name (car pkg)) "-package"))) |
420 (package-get-all (car pkg) nil)) | 417 (package-get-all (car pkg) nil)) |
421 t) | 418 t) |
422 package-get-base)) | 419 package-get-base)) |
423 | 420 |
424 (defun package-get-ever-installedp (pkg &optional notused) | 421 (defun package-get-ever-installed-p (pkg &optional notused) |
425 (string-match "-package$" (symbol-name pkg)) | 422 (string-match "-package$" (symbol-name pkg)) |
426 (custom-initialize-set | 423 (custom-initialize-set |
427 pkg | 424 pkg |
428 (if (package-get-info-find-package | 425 (if (package-get-info-find-package |
429 packages-package-list | 426 packages-package-list |
430 (intern (substring (symbol-name pkg) 0 (match-beginning 0)))) | 427 (intern (substring (symbol-name pkg) 0 (match-beginning 0)))) |
431 t))) | 428 t))) |
432 | 429 |
430 (defun package-get-file-installed-p (file &optional paths) | |
431 "Return absolute-path of FILE if FILE exists in PATHS. | |
432 If PATHS is omitted, `load-path' is used." | |
433 (if (null paths) | |
434 (setq paths load-path) | |
435 ) | |
436 (catch 'tag | |
437 (let (path) | |
438 (while paths | |
439 (setq path (expand-file-name file (car paths))) | |
440 (if (file-exists-p path) | |
441 (throw 'tag path) | |
442 ) | |
443 (setq paths (cdr paths)) | |
444 )))) | |
445 | |
433 (defun package-get-create-custom () | 446 (defun package-get-create-custom () |
434 "Creates a package customization file package-get-custom.el. | 447 "Creates a package customization file package-get-custom.el. |
435 Entries in the customization file are retrieved from package-get-base.el." | 448 Entries in the customization file are retrieved from package-get-base.el." |
436 (interactive) | 449 (interactive) |
437 ;; Load a fresh copy | 450 ;; Load a fresh copy |
438 (load "package-get-base.el") | 451 (load "package-get-base.el") |
439 (let ((custom-buffer (find-file-noselect | 452 (let ((custom-buffer (find-file-noselect |
440 (or (file-installed-p "package-get-custom.el") | 453 (or (package-get-file-installed-p |
454 "package-get-custom.el") | |
441 (concat (file-name-directory | 455 (concat (file-name-directory |
442 (file-installed-p "package-get-base.el")) | 456 (package-get-file-installed-p |
457 "package-get-base.el")) | |
443 "package-get-custom.el")))) | 458 "package-get-custom.el")))) |
444 (pkg-groups nil)) | 459 (pkg-groups nil)) |
445 | 460 |
446 ;; clear existing stuff | 461 ;; clear existing stuff |
447 (delete-region (point-min custom-buffer) | 462 (delete-region (point-min custom-buffer) |
461 (insert-string | 476 (insert-string |
462 (concat "(defcustom " (symbol-name (car pkg)) | 477 (concat "(defcustom " (symbol-name (car pkg)) |
463 "-package nil \n" | 478 "-package nil \n" |
464 " \"" (plist-get (car (cdr pkg)) 'description) "\"\n" | 479 " \"" (plist-get (car (cdr pkg)) 'description) "\"\n" |
465 " :group '" category "-packages\n" | 480 " :group '" category "-packages\n" |
466 " :initialize 'package-get-ever-installedp\n" | 481 " :initialize 'package-get-ever-installed-p\n" |
467 " :type 'boolean)\n\n") custom-buffer))) | 482 " :type 'boolean)\n\n") custom-buffer))) |
468 package-get-base) custom-buffer) | 483 package-get-base) custom-buffer) |
469 ) | 484 ) |
470 | 485 |
471 ;; need this first to avoid infinite dependency loops | 486 ;; need this first to avoid infinite dependency loops |
472 (provide 'package-get) | 487 (provide 'package-get) |
473 | 488 |
474 ;; potentially update the custom dependencies every time we load this | 489 ;; potentially update the custom dependencies every time we load this |
475 (let ((custom-file (file-installed-p "package-get-custom.el")) | 490 (let ((custom-file (package-get-file-installed-p "package-get-custom.el")) |
476 (package-file (file-installed-p "package-get-base.el"))) | 491 (package-file (package-get-file-installed-p "package-get-base.el"))) |
477 ;; update custom file if it doesn't exist | 492 ;; update custom file if it doesn't exist |
478 (if (or (not custom-file) | 493 (if (or (not custom-file) |
479 (and (< (car (nth 5 (file-attributes custom-file))) | 494 (and (< (car (nth 5 (file-attributes custom-file))) |
480 (car (nth 5 (file-attributes package-file)))) | 495 (car (nth 5 (file-attributes package-file)))) |
481 (< (car (nth 5 (file-attributes custom-file))) | 496 (< (car (nth 5 (file-attributes custom-file))) |