From: ludo@gnu.org (Ludovic Courtès)
To: Christopher Baines <mail@cbaines.net>
Cc: 28787@debbugs.gnu.org
Subject: [bug#28787] [PATCH 1/2] emacs-build-system: Handle missing programs when patching.
Date: Fri, 13 Oct 2017 23:40:02 +0200 [thread overview]
Message-ID: <871sm6zpzh.fsf@gnu.org> (raw)
In-Reply-To: <20171011144218.26718-1-mail@cbaines.net> (Christopher Baines's message of "Wed, 11 Oct 2017 15:42:17 +0100")
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
Hello!
Christopher Baines <mail@cbaines.net> skribis:
> 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.
> ---
> guix/build/emacs-build-system.scm | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
> index 2404dbddb..0260f15bb 100644
> --- a/guix/build/emacs-build-system.scm
> +++ b/guix/build/emacs-build-system.scm
> @@ -93,7 +93,12 @@ store in '.el' files."
> (substitute-cmd (lambda ()
> (substitute* (find-files "." "\\.el$")
> (("\"/bin/([^.].*)\"" _ cmd)
> - (string-append "\"" (which cmd) "\""))))))
> + (string-append
> + "\""
> + (or
> + (which cmd)
> + (error "patch-el-files: unable to locate " cmd))
> + "\""))))))
For clarity I’d move the ‘error’ call out of the way:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 852 bytes --]
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 2404dbddb..bafb1060b 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -93,7 +93,10 @@ store in '.el' files."
(substitute-cmd (lambda ()
(substitute* (find-files "." "\\.el$")
(("\"/bin/([^.].*)\"" _ cmd)
- (string-append "\"" (which cmd) "\""))))))
+ (let ((cmd (which cmd)))
+ (unless cmd
+ (error "..."))
+ (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.
[-- Attachment #3: Type: text/plain, Size: 40 bytes --]
Otherwise LGTM!
Thanks,
Ludo’.
next prev parent reply other threads:[~2017-10-13 21:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 14:40 [bug#28787] [PATCH] emacs-build-system: Improve command patching Christopher Baines
2017-10-11 14:42 ` [bug#28787] [PATCH 1/2] emacs-build-system: Handle missing programs when patching Christopher Baines
2017-10-11 14:42 ` [bug#28787] [PATCH 2/2] emacs-build-system: Change how patch-el-files substitutes commands Christopher Baines
2017-10-13 21:40 ` Ludovic Courtès
2017-10-15 18:09 ` bug#28787: " Christopher Baines
2017-10-13 21:40 ` Ludovic Courtès [this message]
2017-10-15 18:06 ` [bug#28787] [PATCH 1/2] emacs-build-system: Handle missing programs when patching Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871sm6zpzh.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=28787@debbugs.gnu.org \
--cc=mail@cbaines.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.