mirror of
https://github.com/dimitri/el-get.git
synced 2024-09-29 13:08:51 +08:00
Condition in elpa install with refresh package
Added a check for new `package-archives' entries to fetch/update their archive-contents and regenerate for new configuration of `package-archives'.
This commit is contained in:
parent
2bd1891e90
commit
6294b849df
|
@ -81,12 +81,24 @@ the recipe, then return nil."
|
|||
"Ask elpa to install given PACKAGE."
|
||||
(let* ((elpa-dir (el-get-elpa-package-directory package))
|
||||
(elpa-repo (el-get-elpa-package-repo package))
|
||||
;; Indicates new archive requiring to download its archive-contents
|
||||
(elpa-new-repo (when (and elpa-repo)
|
||||
(unless (rassoc (cdr-safe elpa-repo)
|
||||
(bound-and-true-p package-archives))
|
||||
elpa-repo)))
|
||||
;; Set `package-archive-base' to elpa-repo for old package.el
|
||||
(package-archive-base (or (cdr-safe elpa-repo)
|
||||
(bound-and-true-p package-archive-base)))
|
||||
;; Prepend elpa-repo to `package-archives' for new package.el
|
||||
(package-archives (append (when elpa-repo (list elpa-repo))
|
||||
(when (boundp 'package-archives) package-archives))))
|
||||
|
||||
(when elpa-new-repo
|
||||
(condition-case-unless-debug nil
|
||||
(package--download-one-archive elpa-new-repo "archive-contents")
|
||||
(error (message "Failed to download `%s' archive." (car archive))))
|
||||
(package-read-all-archive-contents))
|
||||
|
||||
(unless (and elpa-dir (file-directory-p elpa-dir))
|
||||
;; package-install does these only for interactive calls
|
||||
(unless package--initialized
|
||||
|
|
Loading…
Reference in New Issue
Block a user