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 4015e1f7 authored by Dimitri Fontaine's avatar Dimitri Fontaine

Merge pull request #1561 from myeffort/master

Unable to install recipes that specify new package-archive for packages installed using ELPA method.
parents a13c661d 67830e2a
......@@ -81,18 +81,29 @@ the recipe, then return nil."
"Ask elpa to install given PACKAGE."
(let* ((elpa-dir (el-get-elpa-package-directory package))
(elpa-repo (el-get-elpa-package-repo package))
;; Indicates new archive requiring to download its archive-contents
(elpa-new-repo (when (and elpa-repo)
(unless (rassoc (cdr-safe elpa-repo)
(bound-and-true-p package-archives))
elpa-repo)))
;; Set `package-archive-base' to elpa-repo for old package.el
(package-archive-base (or (cdr-safe elpa-repo)
(bound-and-true-p package-archive-base)))
;; Prepend elpa-repo to `package-archives' for new package.el
(package-archives (append (when elpa-repo (list elpa-repo))
(when (boundp 'package-archives) package-archives))))
(unless (and elpa-dir (file-directory-p elpa-dir))
;; package-install does these only for interactive calls
(unless package--initialized
(package-initialize t))
(unless package-archive-contents
(package-refresh-contents))
(cond ((not package-archive-contents)
(package-refresh-contents))
(elpa-new-repo
(condition-case-unless-debug nil
(package--download-one-archive elpa-new-repo "archive-contents")
(error (message "Failed to download `%s' archive." (car archive))))
(package-read-all-archive-contents)))
;; TODO: should we refresh and retry once if package-install fails?
;; package-install generates autoloads, byte compiles
(let (emacs-lisp-mode-hook fundamental-mode-hook prog-mode-hook)
......
(require 'cl-lib)
(require 'package-x)
;;; Utility
(defun* create-package-archive (path &key name desc version)
"Creates local archive at PATH that provides signle package
with NAME, DESCRIPTION and VERSION specified according to
values provided in arguments after corresponding keys."
(cond ((not (file-exists-p path)) (mkdir path))
((or (not (file-directory-p path))
(not (file-writable-p path)))
(error "Specified path is not a writeable directory.")))
(with-temp-buffer
(insert (format ";;; %s.el --- %s" name desc) ?\n
(format ";; Version: %s" version) ?\n
(format "(provide '%s)" name) ?\n
(format ";;; %s.el ends here" name))
(let ((package-archive-upload-base path))
(package-upload-buffer))))
;;; Paths
(defconst old-archive-path
(expand-file-name "old-archive" (getenv "HOME"))
"Path to archive included into `package-archives'")
(defconst new-archive-path
(expand-file-name "new-archive" (getenv "HOME"))
"Path to archive introduced through a recipe")
;;; Archives
(create-package-archive old-archive-path
:name 'dummy-funny
:desc "This package goes in archive that was part of `package-archives'"
:version "0.3")
(create-package-archive new-archive-path
:name 'dummy-whammy
:desc "This package goes in archive that was introduced through a recipe"
:version "0.8")
;;; Recipes
(add-to-list 'el-get-sources
`(:name dummy-funny
:type elpa
:repo ("old-archive" . ,old-archive-path)))
(add-to-list 'el-get-sources
`(:name dummy-whammy
:type elpa
:repo ("new-archive" . ,new-archive-path)))
;; Only old-archive is specified in `package-archives' and will remain
;; active regardless of recipe.
(setq package-archives `(("old-archive" . ,old-archive-path)))
(el-get 'sync '(dummy-whammy dummy-funny))
(require 'cl-lib)
(require 'package-x)
;;; Utility
(defun* create-package-archive (path &key name desc version)
"Creates local archive at PATH that provides signle package
with NAME, DESCRIPTION and VERSION specified according to
values provided in arguments after corresponding keys."
(cond ((not (file-exists-p path)) (mkdir path))
((or (not (file-directory-p path))
(not (file-writable-p path)))
(error "Specified path is not a writeable directory.")))
(with-temp-buffer
(insert (format ";;; %s.el --- %s" name desc) ?\n
(format ";; Version: %s" version) ?\n
(format "(provide '%s)" name) ?\n
(format ";;; %s.el ends here" name))
(let ((package-archive-upload-base path))
(package-upload-buffer))))
;;; Paths
(defconst old-archive-path
(expand-file-name "old-archive" (getenv "HOME"))
"Path to archive included into `package-archives'")
(defconst new-archive-path
(expand-file-name "new-archive" (getenv "HOME"))
"Path to archive introduced through a recipe")
;;; Archives
(create-package-archive old-archive-path
:name 'dummy-funny
:desc "This package goes in archive that was part of `package-archives'"
:version "0.3")
(create-package-archive new-archive-path
:name 'dummy-whammy
:desc "This package goes in archive that was introduced through a recipe"
:version "0.8")
;;; Recipes
(add-to-list 'el-get-sources
`(:name dummy-funny
:type elpa
:repo ("old-archive" . ,old-archive-path)))
(add-to-list 'el-get-sources
`(:name dummy-whammy
:type elpa
:repo ("new-archive" . ,new-archive-path)))
;; Only old-archive is specified in `package-archives' and will remain
;; active regardless of recipe.
(setq package-archives `(("old-archive" . ,old-archive-path)))
(el-get 'sync '(dummy-funny dummy-whammy))
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