diff options
author | Arun Isaac <arunisaac@systemreboot.net> | 2017-04-19 12:59:11 +0530 |
---|---|---|
committer | Arun Isaac <arunisaac@systemreboot.net> | 2017-05-23 06:12:43 +0530 |
commit | d879685176d23c111f4fc665698251b25cdf9124 (patch) | |
tree | 43f30bb7cec73c5072415a4392a4b39ef733d507 /guix/build | |
parent | 0dc4a498a33eac046f9448f852949da61d8ded4d (diff) |
build-system: emacs: Install only a subset of files.
* guix/build/emacs-build-system.scm (install): Install files matching
#:include while excluding files matching #:exclude.
* guix/build-system/emacs.scm (emacs-build): Add keyword arguments #:include
and #:exclude.
Diffstat (limited to 'guix/build')
-rw-r--r-- | guix/build/emacs-build-system.scm | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 3538e9ff47..50af4be363 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -95,14 +95,30 @@ store in '.el' files." (substitute-cmd)))) #t)) -(define* (install #:key outputs #:allow-other-keys) +(define* (install #:key outputs + (include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$")) + (exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$")) + #:allow-other-keys) "Install the package contents." + + (define source (getcwd)) + + (define (install-file? file stat) + (let ((stripped-file (string-trim (string-drop file (string-length source)) #\/))) + (and (any (cut string-match <> stripped-file) include) + (not (any (cut string-match <> stripped-file) exclude))))) + (let* ((out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) - (src-dir (getcwd)) - (tgt-dir (string-append out %install-suffix "/" elpa-name-ver))) - (copy-recursively src-dir tgt-dir) - #t)) + (target-directory (string-append out %install-suffix "/" elpa-name-ver))) + (for-each + (lambda (file) + (let* ((stripped-file (string-drop file (string-length source))) + (target-file (string-append target-directory stripped-file))) + (format #t "`~a' -> `~a'~%" file target-file) + (install-file file (dirname target-file)))) + (find-files source install-file?))) + #t) (define* (move-doc #:key outputs #:allow-other-keys) "Move info files from the ELPA package directory to the info directory." |