mirror of
https://github.com/correl/melpa.git
synced 2024-11-14 19:19:32 +00:00
Assert that recipes are well-formed at the time they are read
This commit is contained in:
parent
913386ac8d
commit
9428a70292
3 changed files with 25 additions and 10 deletions
|
@ -8,7 +8,7 @@
|
||||||
;; Created: 2011-09-30
|
;; Created: 2011-09-30
|
||||||
;; Version: 0.1
|
;; Version: 0.1
|
||||||
;; Keywords: tools
|
;; Keywords: tools
|
||||||
;; Package-Requires: ((cl-lib "0.2"))
|
;; Package-Requires: ((cl-lib "0.5"))
|
||||||
|
|
||||||
;; This file is not (yet) part of GNU Emacs.
|
;; This file is not (yet) part of GNU Emacs.
|
||||||
;; However, it is distributed under the same license.
|
;; However, it is distributed under the same license.
|
||||||
|
@ -805,13 +805,28 @@ of the same-named package which is to be kept."
|
||||||
|
|
||||||
(defun pb/read-recipe (file-name)
|
(defun pb/read-recipe (file-name)
|
||||||
"Return the plist of recipe info for the package called FILE-NAME."
|
"Return the plist of recipe info for the package called FILE-NAME."
|
||||||
(let ((pkg-info (pb/read-from-file file-name)))
|
(let* ((pkg-info (pb/read-from-file file-name))
|
||||||
(if (string= (symbol-name (car pkg-info))
|
(pkg-name (car pkg-info))
|
||||||
(file-name-nondirectory file-name))
|
(rest (cdr pkg-info)))
|
||||||
pkg-info
|
(cl-assert pkg-name)
|
||||||
(error "Recipe '%s' contains mismatched package name '%s'"
|
(cl-assert (symbolp pkg-name))
|
||||||
(file-name-nondirectory file-name)
|
(cl-assert (string= (symbol-name pkg-name) (file-name-nondirectory file-name))
|
||||||
(car pkg-info)))))
|
"Recipe '%s' contains mismatched package name '%s'"
|
||||||
|
(file-name-nondirectory file-name)
|
||||||
|
(car pkg-info))
|
||||||
|
(cl-assert rest)
|
||||||
|
(let ((fetcher (plist-get rest :fetcher)))
|
||||||
|
(cl-assert fetcher)
|
||||||
|
(cl-assert (symbolp fetcher)))
|
||||||
|
(dolist (key '(:files :old-names))
|
||||||
|
(let ((val (plist-get rest key)))
|
||||||
|
(when val
|
||||||
|
(cl-assert (listp val) nil "%s must be a list but is %S" key val ))))
|
||||||
|
(dolist (key '(:url :repo :module :commit :branch))
|
||||||
|
(let ((val (plist-get rest key)))
|
||||||
|
(when val
|
||||||
|
(cl-assert (stringp val) nil "%s must be a string but is %S" key val ))))
|
||||||
|
pkg-info))
|
||||||
|
|
||||||
(defun pb/read-recipes ()
|
(defun pb/read-recipes ()
|
||||||
"Return a list of data structures for all recipes in `package-build-recipes-dir'."
|
"Return a list of data structures for all recipes in `package-build-recipes-dir'."
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
(backup-walker
|
(backup-walker
|
||||||
:fetcher github
|
:fetcher github
|
||||||
:repo lewang/backup-walker)
|
:repo "lewang/backup-walker")
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
(vagrant :fetcher github :repo ottbot/vagrant.el :files ("*.el"))
|
(vagrant :fetcher github :repo "ottbot/vagrant.el" :files ("*.el"))
|
||||||
|
|
Loading…
Reference in a new issue