build: emacs-build-system: Make the install phase more helpful.

Modify the install phase to detect when nothing has been installed, and error
if this happens. This is preferable to continuing, and allowing the next phase
to fail.

Also, when nothing can be found to be installed, print out each file that was
considered, along with the regular expressions that were used to include and
exclude it.

* gnu/build/emacs-build-system.scm (install-file?): Add additional error
  checking and logging.
This commit is contained in:
Christopher Baines 2017-08-22 18:11:35 +01:00
parent ebbb6301a3
commit 81fe131e0f
No known key found for this signature in database
GPG Key ID: 5E28A33B0B84F577
1 changed files with 32 additions and 13 deletions

View File

@ -110,22 +110,41 @@ store in '.el' files."
(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)))))
(define* (install-file? file stat #:key verbose?)
(let* ((stripped-file (string-trim
(string-drop file (string-length source)) #\/)))
(define (match-stripped-file action regex)
(let ((result (string-match regex stripped-file)))
(when (and result verbose?)
(format #t "info: ~A ~A as it matches \"~A\"\n"
stripped-file action regex))
result))
(when verbose?
(format #t "info: considering installing ~A\n" stripped-file))
(and (any (cut match-stripped-file "included" <>) include)
(not (any (cut match-stripped-file "excluded" <>) exclude)))))
(let* ((out (assoc-ref outputs "out"))
(elpa-name-ver (store-directory->elpa-name-version out))
(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)
(target-directory (string-append out %install-suffix "/" elpa-name-ver))
(files-to-install (find-files source install-file?)))
(cond
(files-to-install
(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))))
files-to-install)
#t)
(else
(format #t "error: No files found to install.\n")
(find-files source (lambda (file stat)
(install-file? file stat #:verbose? #t)))
#f))))
(define* (move-doc #:key outputs #:allow-other-keys)
"Move info files from the ELPA package directory to the info directory."