summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/package.el
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2022-10-18 22:34:11 +0200
committerPhilip Kaludercic <philipk@posteo.net>2022-10-18 22:35:25 +0200
commit5d60ea47f6625dc7da6ceb475dc624e33deb198f (patch)
treeed5150fc11b0a130d5a48b2f8bb774e18b308d4b /lisp/emacs-lisp/package.el
parent65fa87329ce577d1ee907c0716b48aac8c0d7d27 (diff)
downloademacs-5d60ea47f6625dc7da6ceb475dc624e33deb198f.tar.gz
emacs-5d60ea47f6625dc7da6ceb475dc624e33deb198f.tar.bz2
emacs-5d60ea47f6625dc7da6ceb475dc624e33deb198f.zip
Use 'elpa-packages' files for VC metadata
* lisp/emacs-lisp/package-vc.el (package-vc-default-backend): Add new option. (package-vc-archive-spec-alist): Add new variable to store the contents of 'elpa-packages' for each archive. (pacakge-vc-desc->spec): Add function to query package specifications. (package-vc--read-archive-data): Add a 'package-read-archive-hook' implementation. (package-vc--download-and-read-archives): Add a 'package-refresh-contents-hook' implementation. (package-vc-main-file): Remove function. (package-vc-generate-description-file): Use package specifications. (package-vc-unpack-1): Adapt to previous changes. (package-vc-unpack): Adapt to previous changes. (package-vc-sourced-packages-list): Adapt to previous changes. (package-vc-install): Adapt to previous changes. * lisp/emacs-lisp/package.el (package-read-archive-hook): Allow extending 'package-read-all-archive-contents' using a hook. (package-read-all-archive-contents): Use 'package-read-archive-hook'. (package-refresh-contents-hook): Allow extending 'package-refresh-contents' using a hook. (package-refresh-contents): Use 'package-refresh-contents-hook'.
Diffstat (limited to 'lisp/emacs-lisp/package.el')
-rw-r--r--lisp/emacs-lisp/package.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 245e41ee74a..425abfeea5c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1650,13 +1650,19 @@ This is the value of `package-archive-priorities' last time
by arbitrary functions to decide whether it is necessary to call
it again.")
+(defvar package-read-archive-hook (list #'package-read-archive-contents)
+ "List of functions to call to read the archive contents.
+Each function must take an optional argument, a symbol indicating
+what archive to read in. The symbol ought to be a key in
+`package-archives'.")
+
(defun package-read-all-archive-contents ()
"Read cached archive file for all archives in `package-archives'.
If successful, set or update `package-archive-contents'."
(setq package-archive-contents nil)
(setq package--old-archive-priorities package-archive-priorities)
(dolist (archive package-archives)
- (package-read-archive-contents (car archive))))
+ (run-hook-with-args 'package-read-archive-hook (car archive))))
;;;; Package Initialize
@@ -1832,6 +1838,11 @@ asynchronously."
(error (message "Failed to download `%s' archive."
(car archive))))))
+(defvar package-refresh-contents-hook (list #'package--download-and-read-archives)
+ "List of functions to call to refresh the package archive.
+Each function may take an optional argument indicating that the
+operation ought to be executed asynchronously.")
+
;;;###autoload
(defun package-refresh-contents (&optional async)
"Download descriptions of all configured ELPA packages.
@@ -1850,7 +1861,7 @@ downloads in the background."
(condition-case-unless-debug error
(package-import-keyring default-keyring)
(error (message "Cannot import default keyring: %S" (cdr error))))))
- (package--download-and-read-archives async))
+ (run-hook-with-args 'package-refresh-contents-hook async))
;;; Dependency Management