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 9205317d authored by Gergely Risko's avatar Gergely Risko

Implemented checksum support for http, ftp and emacswiki methods.

parent 90a86c4d
......@@ -282,6 +282,8 @@ definition provided by `el-get' recipes locally.
Checksum calculation is currently supported by these methods
with the following meaning:
* `http', `ftp' and `emacswiki' with the SHA1 of the downloaded file,
"
:type
......
......@@ -38,7 +38,7 @@ filename.el ;;; filename.el --- description"
(el-get-register-method
:emacswiki #'el-get-emacswiki-install #'el-get-emacswiki-install #'el-get-rmdir
#'el-get-http-install-hook)
#'el-get-http-install-hook nil #'el-get-http-compute-checksum)
;;;
;;; Functions to maintain a local recipe list from EmacsWiki
......
......@@ -13,6 +13,7 @@
;; Please see the README.asciidoc file from the same distribution
(require 'el-get-core)
(require 'sha1)
(defcustom el-get-http-install-hook nil
"Hook run after http retrieve."
......@@ -26,6 +27,9 @@ Test url: http://repo.or.cz/w/ShellArchive.git?a=blob_plain;hb=HEAD;f=ack.el"
(replace-regexp-in-string "[^a-zA-Z0-9-_\.\+]" "_"
(file-name-nondirectory url)))
(defvar el-get-http-checksums (make-hash-table)
"Hash table for storing downloaded SHA1 checksums.")
(defun el-get-http-retrieve-callback (status package post-install-fun &optional dest sources)
"Callback function for `url-retrieve', store the emacs lisp file for the package."
(let* ((pdir (el-get-package-directory package))
......@@ -40,6 +44,7 @@ Test url: http://repo.or.cz/w/ShellArchive.git?a=blob_plain;hb=HEAD;f=ack.el"
(forward-char)
(delete-region (point-min) (point))
(write-file part)
(puthash package (sha1 (current-buffer)) el-get-http-checksums)
(when (file-exists-p dest)
(delete-file dest))
(rename-file part dest)
......@@ -68,12 +73,16 @@ into the package :localname option or its `file-name-nondirectory' part."
(el-get-http-retrieve-callback
nil package post-install-fun dest el-get-sources)))))
(defun el-get-http-compute-checksum (package)
"Look up download time SHA1 of PACKAGE."
(gethash package el-get-http-checksums "not installed in this session"))
(el-get-register-method
:http #'el-get-http-install #'el-get-http-install #'el-get-rmdir
#'el-get-http-install-hook)
#'el-get-http-install-hook nil #'el-get-http-compute-checksum)
(el-get-register-method
:ftp #'el-get-http-install #'el-get-http-install #'el-get-rmdir
#'el-get-http-install-hook)
#'el-get-http-install-hook nil #'el-get-http-compute-checksum)
(provide 'el-get-http)
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