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 6d48139c authored by Noam Postavsky's avatar Noam Postavsky

Merge pull request #1799 from npostavs/recipe-read

Read all recipes fixes
parents 9d56d7cb ad1c2aa7
......@@ -122,6 +122,14 @@ Used to avoid errors when exploring the path for recipes"
(el-get-read-recipe-file filename)
(error "El-get can not find a recipe for package \"%s\"" package))))
(defun el-get-all-recipe-file-names ()
"Return the list of all file based recipe names.
The result may have duplicates."
(loop for dir in (el-get-recipe-dirs)
nconc (mapcar #'file-name-base
(directory-files dir nil "^[^.].*\.\\(rcp\\|el\\)$"))))
(defun el-get-read-all-recipe-files ()
"Return the list of all file based recipes, formated like `el-get-sources'.
......@@ -146,11 +154,31 @@ is the one considered."
We first look in `el-get-sources' then in each directory listed
in `el-get-recipe-path' in order."
(let ((packages (mapcar 'el-get-source-name el-get-sources)))
(remove-if (lambda (recipe) (member (el-get-source-name recipe) packages))
(remove-if 'null (el-get-read-all-recipe-files))))))
(let* ((s-recipes (mapcar (lambda (s) (cons (plist-get s :name) s))
(file-recipes (el-get-read-all-recipe-files)))
(setq file-recipes
(mapcar (lambda (f-recipe)
(let* ((pkg (plist-get f-recipe :name))
(s-recipe (assq pkg s-recipes)))
(if (null s-recipe) f-recipe
(setq s-recipes (assq-delete-all pkg s-recipes))
(el-get-recipe-merge f-recipe (cdr s-recipe)))))
(append (mapcar #'cdr s-recipes) file-recipes)))
(defun el-get-recipe-merge (r1 r2)
"Merge recipe R1 into R2.
If R2 has a `:type' it completely replaces R1, otherwise, R1
fields are the default value and R2 may override them."
(if (plist-get r2 :type)
(loop with merged
for (prop val) on (append r2 r1) by 'cddr
unless (plist-member merged prop)
nconc (list prop val) into merged
finally return merged)))
(defun el-get-package-def (package)
"Return a single `el-get-sources' entry for PACKAGE."
......@@ -165,11 +193,7 @@ in `el-get-recipe-path' in order."
((null (plist-get source :type))
;; we got a list with no :type, that's an override plist
(loop with def = (el-get-read-recipe package)
for (prop override) on source by 'cddr
do (plist-put def prop override)
finally return def))
(el-get-recipe-merge (el-get-read-recipe package) source))
;; none of the previous, must be a full definition
(t source))))
......@@ -221,7 +221,8 @@
This is useful to use for providing completion candidates for
package names."
(mapcar 'el-get-source-name (el-get-read-all-recipes)))
(delete-dups (append (mapcar #'el-get-source-name el-get-sources)
(defun el-get-error-unless-package-p (package)
"Raise an error if PACKAGE does not name a package that has a valid recipe."
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