From cd54d7af471213736b989fcc16192f779ff13873 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 16 Jan 2016 10:02:49 -0600 Subject: [PATCH] melpaBuild: don't download dependencies Stop package.el from trying to download dependencies. It wouldn't work anyway. --- pkgs/build-support/emacs/melpa2nix.el | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/emacs/melpa2nix.el b/pkgs/build-support/emacs/melpa2nix.el index ea5b1390ad8..fb35fc68125 100644 --- a/pkgs/build-support/emacs/melpa2nix.el +++ b/pkgs/build-support/emacs/melpa2nix.el @@ -12,7 +12,7 @@ (pcase command-line-args-left (`(,archive ,elpa) (progn (setq package-user-dir elpa) - (package-install-file archive))))) + (melpa2nix-install-file archive))))) (defun melpa2nix-build-package () (if (not noninteractive) @@ -48,3 +48,20 @@ (time-to-seconds (time-since start-time)) (current-time-string)) (princ (format "%s\n" archive-file))))) + +(defun melpa2nix-install-from-buffer () + "Install a package from the current buffer." + (let ((pkg-desc (if (derived-mode-p 'tar-mode) + (package-tar-file-info) + (package-buffer-info)))) + ;; Install the package itself. + (package-unpack pkg-desc) + pkg-desc)) + +(defun melpa2nix-install-file (file) + "Install a package from a file. +The file can either be a tar file or an Emacs Lisp file." + (with-temp-buffer + (insert-file-contents-literally file) + (when (string-match "\\.tar\\'" file) (tar-mode)) + (melpa2nix-install-from-buffer)))