Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 63097403 authored by Ryan Thompson's avatar Ryan Thompson

Merge pull request #643 from DarwinAwardWinner/reinstall-on-type-change

Reinstall on type change
parents 691ca439 79141993
......@@ -176,6 +176,8 @@ given method."
(let* ((method (if (keywordp method-name) method-name
(intern (concat ":" (format "%s" method-name)))))
(actions (plist-get el-get-methods method)))
(assert actions nil
"Unknown recipe type: %s" method)
(plist-get actions action)))
(defun el-get-check-init ()
......
......@@ -682,6 +682,17 @@ PACKAGE may be either a string or the corresponding symbol."
(el-get-reload package)
(run-hook-with-args 'el-get-post-update-hooks package)))))
(defun el-get-update-requires-reinstall (package)
"Returns true if updating PACKAGE would require a reinstall.
This happens if the cached recipe and the current one have
different install methods."
(let* ((source (el-get-package-def package))
(old-source (el-get-read-package-status-recipe package))
(method (el-get-package-method source))
(old-method (el-get-package-method old-source)))
(not (eq method old-method))))
(defun el-get-update (package)
"Update PACKAGE."
(interactive
......@@ -692,11 +703,13 @@ PACKAGE may be either a string or the corresponding symbol."
(update (el-get-method method :update))
(url (plist-get source :url))
(commands (plist-get source :build)))
;; update the package now
(if (plist-get source :checksum)
(error "el-get: remove checksum from package %s to update it." package)
(funcall update package url 'el-get-post-update)
(message "el-get update %s" package))))
(if (el-get-update-requires-reinstall package)
(el-get-reinstall package)
;; update the package now
(if (plist-get source :checksum)
(error "el-get: remove checksum from package %s to update it." package)
(funcall update package url 'el-get-post-update)
(message "el-get update %s" package)))))
;;;###autoload
(defun el-get-update-all (&optional no-prompt)
......
;; https://github.com/dimitri/el-get/issues/642
;;
;; Reinstall on type change
(let ((debug-on-error t)
;; (el-get-byte-compile nil)
(el-get-verbose t)
(el-get-default-process-sync t))
;; Install pkg with type builtin
(let ((el-get-sources
(list `(:name pkg
:type builtin))))
(el-get 'sync 'pkg))
(assert (eq 'builtin
(el-get-package-method (el-get-read-package-status-recipe 'pkg)))
t
"Package type should be 'builtin.")
;; Even though "no-op" is an alias for the same behavior as
;; "builtin", they are still considered different types. Thus, this
;; should trigger a reinstall.
(let ((el-get-sources
(list `(:name pkg
:type no-op))))
(el-get-update 'pkg))
(assert (eq 'no-op
(el-get-package-method (el-get-read-package-status-recipe 'pkg)))
t
"Package type should now be 'no-op, not 'builtin."))
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