diff options
| author | Chong Yidong | 2012-01-28 16:14:24 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-01-28 16:14:24 +0800 |
| commit | 0ce8e868b9c704f5f8630e0b8df5550ecadb0e95 (patch) | |
| tree | 9f937765bd9c6746a5b02c06a5d26a5b7a589159 | |
| parent | f823b8caacfc66957b5936fae989bd609d557a47 (diff) | |
| download | emacs-0ce8e868b9c704f5f8630e0b8df5550ecadb0e95.tar.gz emacs-0ce8e868b9c704f5f8630e0b8df5550ecadb0e95.zip | |
Fix package.el dependency handling so that `require' calls work.
* lisp/emacs-lisp/package.el (package-maybe-load-descriptor): New
function, split from package-maybe-load-descriptor.
(package-maybe-load-descriptor): Use it.
(package-download-transaction): Fully load required packages
inside the loop, so that `require' calls work.
(package-install): No need to call package-initialize now.
Fixes: debbugs:10593
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 61 |
2 files changed, 45 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e94120f566e..887959d2fe0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,14 @@ | |||
| 1 | 2012-01-28 Chong Yidong <cyd@gnu.org> | 1 | 2012-01-28 Chong Yidong <cyd@gnu.org> |
| 2 | 2 | ||
| 3 | * emacs-lisp/package.el (package-maybe-load-descriptor): New | ||
| 4 | function, split from package-maybe-load-descriptor. | ||
| 5 | (package-maybe-load-descriptor): Use it. | ||
| 6 | (package-download-transaction): Fully load required packages | ||
| 7 | inside the loop, so that `require' calls work (Bug#10593). | ||
| 8 | (package-install): No need to call package-initialize now. | ||
| 9 | |||
| 10 | 2012-01-28 Chong Yidong <cyd@gnu.org> | ||
| 11 | |||
| 3 | * tooltip.el (tooltip-mode): Doc fix. | 12 | * tooltip.el (tooltip-mode): Doc fix. |
| 4 | (tooltip-use-echo-area): Mark as obsolete (Bug#6595). | 13 | (tooltip-use-echo-area): Mark as obsolete (Bug#6595). |
| 5 | 14 | ||
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 881760216c3..7e56c5534ec 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -382,30 +382,37 @@ controls which package subdirectories may be loaded. | |||
| 382 | In each valid package subdirectory, this function loads the | 382 | In each valid package subdirectory, this function loads the |
| 383 | description file containing a call to `define-package', which | 383 | description file containing a call to `define-package', which |
| 384 | updates `package-alist' and `package-obsolete-alist'." | 384 | updates `package-alist' and `package-obsolete-alist'." |
| 385 | (let ((all (memq 'all package-load-list)) | 385 | (let ((regexp (concat "\\`" package-subdirectory-regexp "\\'"))) |
| 386 | (regexp (concat "\\`" package-subdirectory-regexp "\\'")) | ||
| 387 | name version force) | ||
| 388 | (dolist (dir (cons package-user-dir package-directory-list)) | 386 | (dolist (dir (cons package-user-dir package-directory-list)) |
| 389 | (when (file-directory-p dir) | 387 | (when (file-directory-p dir) |
| 390 | (dolist (subdir (directory-files dir)) | 388 | (dolist (subdir (directory-files dir)) |
| 391 | (when (and (file-directory-p (expand-file-name subdir dir)) | 389 | (when (string-match regexp subdir) |
| 392 | (string-match regexp subdir)) | 390 | (package-maybe-load-descriptor (match-string 1 subdir) |
| 393 | (setq name (intern (match-string 1 subdir)) | 391 | (match-string 2 subdir) |
| 394 | version (match-string 2 subdir) | 392 | dir))))))) |
| 395 | force (assq name package-load-list)) | 393 | |
| 396 | (when (cond | 394 | (defun package-maybe-load-descriptor (name version dir) |
| 397 | ((null force) | 395 | "Maybe load a specific package from directory DIR. |
| 398 | all) ; not in package-load-list | 396 | NAME and VERSION are the package's name and version strings. |
| 399 | ((null (setq force (cadr force))) | 397 | This function checks `package-load-list', before actually loading |
| 400 | nil) ; disabled | 398 | the package by calling `package-load-descriptor'." |
| 401 | ((eq force t) | 399 | (let ((force (assq (intern name) package-load-list)) |
| 402 | t) | 400 | (subdir (concat name "-" version))) |
| 403 | ((stringp force) ; held | 401 | (and (file-directory-p (expand-file-name subdir dir)) |
| 404 | (version-list-= (version-to-list version) | 402 | ;; Check `package-load-list': |
| 405 | (version-to-list force))) | 403 | (cond ((null force) |
| 406 | (t | 404 | (memq 'all package-load-list)) |
| 407 | (error "Invalid element in `package-load-list'"))) | 405 | ((null (setq force (cadr force))) |
| 408 | (package-load-descriptor dir subdir)))))))) | 406 | nil) ; disabled |
| 407 | ((eq force t) | ||
| 408 | t) | ||
| 409 | ((stringp force) ; held | ||
| 410 | (version-list-= (version-to-list version) | ||
| 411 | (version-to-list force))) | ||
| 412 | (t | ||
| 413 | (error "Invalid element in `package-load-list'"))) | ||
| 414 | ;; Actually load the descriptor: | ||
| 415 | (package-load-descriptor dir subdir)))) | ||
| 409 | 416 | ||
| 410 | (defsubst package-desc-vers (desc) | 417 | (defsubst package-desc-vers (desc) |
| 411 | "Extract version from a package description vector." | 418 | "Extract version from a package description vector." |
| @@ -861,7 +868,13 @@ using `package-compute-transaction'." | |||
| 861 | (package-desc-doc desc) | 868 | (package-desc-doc desc) |
| 862 | (package-desc-reqs desc))) | 869 | (package-desc-reqs desc))) |
| 863 | (t | 870 | (t |
| 864 | (error "Unknown package kind: %s" (symbol-name kind))))))) | 871 | (error "Unknown package kind: %s" (symbol-name kind)))) |
| 872 | ;; If package A depends on package B, then A may `require' B | ||
| 873 | ;; during byte compilation. So we need to activate B before | ||
| 874 | ;; unpacking A. | ||
| 875 | (package-maybe-load-descriptor (symbol-name elt) v-string | ||
| 876 | package-user-dir) | ||
| 877 | (package-activate elt (version-to-list v-string))))) | ||
| 865 | 878 | ||
| 866 | (defvar package--initialized nil) | 879 | (defvar package--initialized nil) |
| 867 | 880 | ||
| @@ -889,9 +902,7 @@ archive in `package-archives'. Interactively, prompt for NAME." | |||
| 889 | (symbol-name name))) | 902 | (symbol-name name))) |
| 890 | (package-download-transaction | 903 | (package-download-transaction |
| 891 | (package-compute-transaction (list name) | 904 | (package-compute-transaction (list name) |
| 892 | (package-desc-reqs (cdr pkg-desc))))) | 905 | (package-desc-reqs (cdr pkg-desc)))))) |
| 893 | ;; Try to activate it. | ||
| 894 | (package-initialize)) | ||
| 895 | 906 | ||
| 896 | (defun package-strip-rcs-id (str) | 907 | (defun package-strip-rcs-id (str) |
| 897 | "Strip RCS version ID from the version string STR. | 908 | "Strip RCS version ID from the version string STR. |