emacs-build-system: Handle missing programs when patching.

Previously the string-append here would error, which isn't useful as it
doesn't tell you which command couldn't be found. To make the error
actionable, catch it earlier, and explicitly error.

* guix/build/emacs-build-system.scm (patch-el-files): Handle (which cmd)
  returning #f.
This commit is contained in:
Christopher Baines 2017-10-11 11:59:20 +01:00
parent 791cfa672d
commit dd2de28423
No known key found for this signature in database
GPG Key ID: 5E28A33B0B84F577
1 changed files with 6 additions and 2 deletions

View File

@ -92,8 +92,12 @@ store in '.el' files."
(el-dir (string-append out %install-suffix "/" elpa-name-ver))
(substitute-cmd (lambda ()
(substitute* (find-files "." "\\.el$")
(("\"/bin/([^.].*)\"" _ cmd)
(string-append "\"" (which cmd) "\""))))))
(("\"/bin/([^.].*)\"" _ cmd-name)
(let ((cmd (which cmd-name)))
(unless cmd
(error
"patch-el-files: unable to locate " cmd-name))
(string-append "\"" cmd "\"")))))))
(with-directory-excursion el-dir
;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still encoded
;; with the "ISO-8859-1" locale.