From c66f03c09517571a03fdf97b86bc571a71e969bf Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Wed, 13 Dec 2017 08:10:21 +0300 Subject: [PATCH] emacs-build-system: Handle EMACSLOADPATH environment variable. Define the 'EMACSLOADPATH' environment variable to carry all inputs in tests. * guix/build/emacs-build-system.scm (setup-environment): New procedure. (%standard-phases): Use the new setup-environment procedure. --- guix/build/emacs-build-system.scm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index bd0d2e026..9897abf9e 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015 Federico Beffa ;;; Copyright © 2016 David Thompson ;;; Copyright © 2016 Alex Kost +;;; Copyright © 2017 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -222,6 +223,37 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." strip-store-file-name) store-dir)) +(define* (setup-environment #:key inputs #:allow-other-keys) + "Export the variable EMACSLOADPATH, which are based on INPUTS respectively." + (define (name+version input) + (package-name->name+version (strip-store-file-name input))) + (match (assoc "emacs" inputs) + ((name . input) + (setenv "EMACSLOADPATH" + (string-join (list input "share" name + ((compose (lambda (_ version) version) + name+version) + input) + "lisp") + "/")))) + (for-each (match-lambda + ((name . input) + (setenv "EMACSLOADPATH" + (string-append + (or (getenv "EMACSLOADPATH") "") + ":" input %install-suffix "/" + ((compose (lambda (name version) + (string-append + (string-drop name + (string-length "emacs-")) + "-" version)) + name+version) + input))))) + (fold alist-delete (emacs-inputs inputs) '("emacs" "source"))) + (format #t "environment variable EMACSLOADPATH set to `~a'~%" + (getenv "EMACSLOADPATH")) + #t) + (define %standard-phases (modify-phases gnu:%standard-phases (replace 'unpack unpack) @@ -229,6 +261,7 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." (delete 'check) (delete 'install) (replace 'build build) + (add-before 'build 'setup-environment setup-environment) (add-before 'build 'install install) (add-after 'install 'make-autoloads make-autoloads) (add-after 'make-autoloads 'patch-el-files patch-el-files) -- 2.15.1