[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/package+vc a00ec87c0b 01/10: Update handling for new elpa-packag
From: |
Philip Kaludercic |
Subject: |
feature/package+vc a00ec87c0b 01/10: Update handling for new elpa-packages.eld format |
Date: |
Sun, 30 Oct 2022 13:55:30 -0400 (EDT) |
branch: feature/package+vc
commit a00ec87c0b1cdc2b156b2a36ad3c9908b7fbe5c6
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Update handling for new elpa-packages.eld format
* lisp/emacs-lisp/package-vc.el (package-vc-elpa-packages-version):
Add constant.
(package-vc-archive-data-alist): Add variable.
(package-vc--read-archive-data): Separate package specifications from
metadata.
(package-vc-unpack): Check archive metadata.
---
lisp/emacs-lisp/package-vc.el | 46 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 8e4f2819db..23249fd59c 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -56,6 +56,9 @@
:group 'package
:version "29.1")
+(defconst package-vc-elpa-packages-version 1
+ "Version number of the package specification format understood by
package-vc.")
+
(defcustom package-vc-heuristic-alist
`((,(rx bos "http" (? "s") "://"
(or (: (? "www.") "github.com"
@@ -144,6 +147,25 @@ was made.
All other values are ignored.")
+(defvar package-vc-archive-data-alist nil
+ "List of package specification archive metadata.
+Each element of the list has the form (ARCHIVE . PLIST), where
+PLIST keys are one of:
+
+ `:version' (integer)
+
+Indicating the version of the file formatting, to be compared
+with `package-vc-elpa-packages-version'.
+
+ `:vc-backend' (symbol)
+
+A symbol indicating what the default VC backend to use if a
+package specification does not indicate anything. The value
+ought to be a member of `vc-handled-backends'. If missing,
+`vc-clone' will fall back onto `package-vc-default-backend'.
+
+All other values are ignored.")
+
(defun package-vc-desc->spec (pkg-desc &optional name)
"Retrieve the package specification for PKG-DESC.
The optional argument NAME can be used to override the default
@@ -171,9 +193,23 @@ This function is meant to be used as a hook for
(when (file-exists-p contents-file)
(with-temp-buffer
(let ((coding-system-for-read 'utf-8))
- (insert-file-contents contents-file))
- (setf (alist-get (intern archive) package-vc-archive-spec-alist)
- (read (current-buffer)))))))
+ (insert-file-contents contents-file)
+ ;; The response from the server is expected to have the form
+ ;;
+ ;; ((("foo" :url "..." ...) ...)
+ ;; :version 1
+ ;; :default-vc Git)
+ (let ((spec (read (current-buffer))))
+ (when (= package-vc-elpa-packages-version
+ (plist-get (cdr spec) :version))
+ (setf (alist-get (intern archive) package-vc-archive-spec-alist)
+ (car spec)))
+ (setf (alist-get (intern archive) package-vc-archive-data-alist)
+ (cdr spec))
+ (when-let ((default-vc (plist-get (cdr spec) :default-vc))
+ ((not (memq default-vc vc-handled-backends))))
+ (warn "Archive `%S' expects missing VC backend %S"
+ archive (plist-get (cdr spec) :default-vc)))))))))
(defun package-vc--download-and-read-archives (&optional async)
"Download specifications of all `package-archives' and read them.
@@ -374,6 +410,10 @@ the `:brach' attribute in PKG-SPEC."
(unless (file-exists-p repo-dir)
(make-directory (file-name-directory repo-dir) t)
(let ((backend (or (package-vc-guess-backend url)
+ (plist-get (alist-get (package-desc-archive
pkg-desc)
+ package-vc-archive-data-alist
+ nil nil #'string=)
+ :vc-backend)
package-vc-default-backend)))
(unless (vc-clone url backend repo-dir (or rev branch))
(error "Failed to clone %s from %s" name url))))
- feature/package+vc updated (eaafc10f67 -> 2a4f37fe52), Philip Kaludercic, 2022/10/30
- feature/package+vc bb86ed20e1 08/10: Display a message after installing source packages, Philip Kaludercic, 2022/10/30
- feature/package+vc a00ec87c0b 01/10: Update handling for new elpa-packages.eld format,
Philip Kaludercic <=
- feature/package+vc 4097781655 03/10: Ensure that package specifications are always fetched, Philip Kaludercic, 2022/10/30
- feature/package+vc a52cec7b6b 04/10: Explicitly handle :vc-backend in a package specification, Philip Kaludercic, 2022/10/30
- feature/package+vc 30f1e7c1e9 05/10: Extract last source package release from local VCS data, Philip Kaludercic, 2022/10/30
- feature/package+vc 8b49d553b6 06/10: ; Avoid a type error on malformed "elpa-packages.eld" input, Philip Kaludercic, 2022/10/30
- feature/package+vc ec3f102b8c 07/10: Prefer "Package-Version" over "Version" if available, Philip Kaludercic, 2022/10/30
- feature/package+vc 60b3eb0754 02/10: Allow specifying the VC backend used by 'package-vc-install', Philip Kaludercic, 2022/10/30
- feature/package+vc d33998ed3b 09/10: Have 'last-change' accept a line number instead of a range, Philip Kaludercic, 2022/10/30
- feature/package+vc 2a4f37fe52 10/10: Merge remote-tracking branch 'origin/master' into feature/package+vc, Philip Kaludercic, 2022/10/30