Skip to content

Commit

Permalink
allow to pin packages to specific archive
Browse files Browse the repository at this point in the history
  • Loading branch information
d12frosted committed Jul 14, 2016
1 parent 653da2a commit 8f0cfca
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions core/core-configuration-layer.el
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ LAYER has to be installed for this method to work properly."
(defvar configuration-layer--elpa-archives
'(("melpa" . "melpa.org/packages/")
("org" . "orgmode.org/elpa/")
("gnu" . "elpa.gnu.org/packages/"))
("gnu" . "elpa.gnu.org/packages/")
("melpa-stable" . "stable.melpa.org/packages/"))
"List of ELPA archives required by Spacemacs.")

(defvar configuration-layer-no-layer nil
Expand Down Expand Up @@ -486,13 +487,16 @@ If TOGGLEP is nil then `:toggle' parameter is ignored."
(let* ((name-sym (if (listp pkg) (car pkg) pkg))
(name-str (symbol-name name-sym))
(location (when (listp pkg) (plist-get (cdr pkg) :location)))
(archive (when (listp pkg) (plist-get (cdr pkg) :archive)))
(min-version (when (listp pkg) (plist-get (cdr pkg) :min-version)))
(step (when (listp pkg) (plist-get (cdr pkg) :step)))
(excluded (when (listp pkg) (plist-get (cdr pkg) :excluded)))
(toggle (when (and togglep (listp pkg)) (plist-get (cdr pkg) :toggle)))
(protected (when (listp pkg) (plist-get (cdr pkg) :protected)))
(copyp (not (null obj)))
(obj (if obj obj (cfgl-package name-str :name name-sym))))
(when archive
(configuration-layer/pin-package name-sym archive))
(when location (oset obj :location location))
(when min-version (oset obj :min-version (version-to-list min-version)))
(when step (oset obj :step step))
Expand Down Expand Up @@ -1866,7 +1870,18 @@ FILE-TO-LOAD is an explicit file to load after the installation."
(1+ configuration-layer-error-count))
(setq configuration-layer-error-count 1)))

(defun configuration-layer/pin-package (package archive)
"Pin PACKAGE to ARCHIVE.
When PACKAGE is pinned to specific ARCHIVE, it is installed
exactly from that ARCHIVE.
ARCHIVE must be one of the following symbols: melpa, org, gnu,
melpa-stable."
(unless (memq archive '(melpa org gnu melpa-stable))
(error "Archive '%s' is not supported." archive))
(push `(,package . ,(symbol-name archive)) package-pinned-packages))

(provide 'core-configuration-layer)

;;; core-configuration-layer.el ends here

0 comments on commit 8f0cfca

Please sign in to comment.