Commit 90a86c4d authored by Gergely Risko's avatar Gergely Risko

Added framework for :checksum support.

parent 7769ada0
......@@ -36,16 +36,17 @@
The methods list is a PLIST, each entry has a method name
property which value is another PLIST, which must contain values
for :install, :install-hook, :update and :remove
for :install, :install-hook, :update, :remove and :checksum
properties. Those should be the elisp functions to call for doing
the named package action in the given method.")
(defun el-get-register-method (name install update remove
&optional install-hook remove-hook)
&optional install-hook remove-hook compute-checksum)
"Register the method for backend NAME, with given functions"
(let ((def (list :install install :update update :remove remove)))
(when install-hook (setq def (append def (list :install-hook install-hook))))
(when remove-hook (setq def (append def (list :remove-hook remove-hook))))
(when install-hook (setq def (append def (list :install-hook install-hook))))
(when remove-hook (setq def (append def (list :remove-hook remove-hook))))
(when compute-checksum (setq def (append def (list :compute-checksum compute-checksum))))
(setq el-get-methods (plist-put el-get-methods name def))))
......@@ -269,6 +269,19 @@ definition provided by `el-get' recipes locally.
A short description of the project.
Some methods in el-get download files that are not so
trusted (e.g. anyone is allowed to modify emacswiki anytime).
For these cases you can set up a checksum value for a
package, so you will notice if el-get tries to install a
version that you haven't seen before. The installation will
simply fail and you will see the good and bad checksum values
in `*Messages*'. To get the checksum value for a package
initially, install the package while `el-get-verbose' is on.
Checksum calculation is currently supported by these methods
with the following meaning:
......@@ -479,9 +479,28 @@ PACKAGE may be either a string or the corresponding symbol."
(defun el-get-post-install (package)
"Post install PACKAGE. This will get run by a sentinel."
(let* ((sync el-get-default-process-sync)
(hooks (el-get-method (el-get-package-type package) :install-hook))
(commands (el-get-build-commands package)))
(let* ((sync el-get-default-process-sync)
(type (el-get-package-type package))
(hooks (el-get-method type :install-hook))
(commands (el-get-build-commands package))
(checksum (plist-get (el-get-package-def package) :checksum))
(compute-checksum (el-get-method type :compute-checksum)))
;; check the checksum of the package here, as early as possible
(and checksum
(not compute-checksum)
"Checksum verification of package %s is not supported with method %s."
package type))
(when compute-checksum
(let ((computed (funcall compute-checksum package)))
(if checksum
(when (not (equal computed checksum))
(error "Checksum verification failed. Required: %s, actual: %s."
checksum computed))
"el-get: Checksum value for unchecked pakage %s is %s."
package computed))))
;; post-install is the right place to run install-hook
(run-hook-with-args hooks package)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment