mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
emacs-lisp/package.el (package-install): Mark dependencies as selected.
In particular, when given a package-desc object which is already installed, the package is not downloaded again.
This commit is contained in:
parent
5b83f03725
commit
5687ac9f01
2 changed files with 31 additions and 13 deletions
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
* emacs-lisp/package.el (package-delete): Remove package from
|
||||
`package-selected-packages' even if it can't be deleted.
|
||||
(package-installed-p): Accept package-desc objects.
|
||||
(package-install): Can be used to mark dependencies as
|
||||
selected. When given a package-desc object which is already
|
||||
installed, the package is not downloaded again, but it is marked
|
||||
as selected (if it wasn't already).
|
||||
|
||||
2015-02-03 Artur Malabarba <bruce.connor.am@gmail.com>
|
||||
|
||||
|
|
|
|||
|
|
@ -996,15 +996,22 @@ GnuPG keyring is located under \"gnupg\" in `package-user-dir'."
|
|||
|
||||
(defun package-installed-p (package &optional min-version)
|
||||
"Return true if PACKAGE, of MIN-VERSION or newer, is installed.
|
||||
MIN-VERSION should be a version list."
|
||||
If PACKAGE is a symbol, it is the package name and MIN-VERSION
|
||||
should be a version list.
|
||||
|
||||
If PACKAGE is a package-desc object, MIN-VERSION is ignored."
|
||||
(unless package--initialized (error "package.el is not yet initialized!"))
|
||||
(or
|
||||
(let ((pkg-descs (cdr (assq package package-alist))))
|
||||
(and pkg-descs
|
||||
(version-list-<= min-version
|
||||
(package-desc-version (car pkg-descs)))))
|
||||
;; Also check built-in packages.
|
||||
(package-built-in-p package min-version)))
|
||||
(if (package-desc-p package)
|
||||
(let ((dir (package-desc-dir pkg-desc)))
|
||||
(and (stringp dir)
|
||||
(file-exists-p dir)))
|
||||
(or
|
||||
(let ((pkg-descs (cdr (assq package package-alist))))
|
||||
(and pkg-descs
|
||||
(version-list-<= min-version
|
||||
(package-desc-version (car pkg-descs)))))
|
||||
;; Also check built-in packages.
|
||||
(package-built-in-p package min-version))))
|
||||
|
||||
(defun package-compute-transaction (packages requirements &optional seen)
|
||||
"Return a list of packages to be installed, including PACKAGES.
|
||||
|
|
@ -1219,7 +1226,10 @@ PKG can be a package-desc or the package name of one the available packages
|
|||
in an archive in `package-archives'. Interactively, prompt for its name.
|
||||
|
||||
If called interactively or if MARK-SELECTED is non-nil, add PKG
|
||||
to `package-selected-packages'."
|
||||
to `package-selected-packages'.
|
||||
|
||||
if PKG is a package-desc and it is already installed, don't try
|
||||
to install it but still mark it as selected."
|
||||
(interactive
|
||||
(progn
|
||||
;; Initialize the package system to get the list of package
|
||||
|
|
@ -1243,10 +1253,13 @@ to `package-selected-packages'."
|
|||
(when (and mark-selected (not (package--user-selected-p name)))
|
||||
(customize-save-variable 'package-selected-packages
|
||||
(cons name package-selected-packages))))
|
||||
(package-download-transaction
|
||||
(if (package-desc-p pkg)
|
||||
(package-compute-transaction (list pkg)
|
||||
(package-desc-reqs pkg))
|
||||
(if (package-desc-p pkg)
|
||||
(if (package-installed-p pkg)
|
||||
(message "`%s' is already installed" (package-desc-full-name pkg))
|
||||
(package-download-transaction
|
||||
(package-compute-transaction (list pkg)
|
||||
(package-desc-reqs pkg))))
|
||||
(package-download-transaction
|
||||
(package-compute-transaction ()
|
||||
(list (list pkg))))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue