build-system: emacs: Factorize include/exclude default arguments.

The `install' phase of the emacs-build-system contained default arguments
duplicated from the host side `emacs-build' procedure. This change factorizes
them so that:

1. They are not duplicated.
2. They can be reused and extended easily when defining emacs packages.

* guix/build/emacs-build-system.scm (%default-include, %default-exclude): New
  variables.
(install): Use %default-include and %default-exclude as default arguments.
* guix/build-system/emacs.scm: Use and re-export %default-include,
%default-exclude from (guix build emacs-build-system).
(emacs-build): Use %default-include and %default-exclude as default arguments.

Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
This commit is contained in:
Maxim Cournoyer 2017-06-03 23:43:02 -07:00 committed by Arun Isaac
parent dfe93c9ac0
commit df34f47894
No known key found for this signature in database
GPG key ID: 2E25EE8B61802BB3
2 changed files with 17 additions and 5 deletions

View file

@ -17,6 +17,8 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build-system emacs)
#:use-module ((guix build emacs-build-system)
#:select (%default-include %default-exclude))
#:use-module (guix store)
#:use-module (guix utils)
#:use-module (guix packages)
@ -28,7 +30,10 @@ (define-module (guix build-system emacs)
#:use-module (srfi srfi-26)
#:export (%emacs-build-system-modules
emacs-build
emacs-build-system))
emacs-build-system)
#:re-export (%default-include ;for convenience
%default-exclude))
;; Commentary:
;;
@ -83,8 +88,8 @@ (define* (emacs-build store name inputs
(phases '(@ (guix build emacs-build-system)
%standard-phases))
(outputs '("out"))
(include ''("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
(exclude ''("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
(include (quote %default-include))
(exclude (quote %default-exclude))
(search-paths '())
(system (%current-system))
(guile #f)

View file

@ -29,6 +29,8 @@ (define-module (guix build emacs-build-system)
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
#:export (%standard-phases
%default-include
%default-exclude
emacs-build))
;; Commentary:
@ -42,6 +44,11 @@ (define-module (guix build emacs-build-system)
;; archive signature.
(define %install-suffix "/share/emacs/site-lisp/guix.d")
;; These are the default inclusion/exclusion regexps for the install phase.
(define %default-include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
(define %default-exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$"
"^[^/]*tests?\\.el$"))
(define gnu:unpack (assoc-ref gnu:%standard-phases 'unpack))
(define (store-file->elisp-source-file file)
@ -96,8 +103,8 @@ (define* (patch-el-files #:key outputs #:allow-other-keys)
#t))
(define* (install #:key outputs
(include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
(exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
(include %default-include)
(exclude %default-exclude)
#:allow-other-keys)
"Install the package contents."